This commit is contained in:
Gerard Gascón 2023-03-01 14:48:32 +01:00
parent 0afd388dfc
commit 2206e6f664
14 changed files with 5827 additions and 260 deletions

View file

@ -9,15 +9,15 @@ using Random = UnityEngine.Random;
[System.Serializable]
public enum OrbTypes {
None,
Blue,
Red,
Purple,
InvertedControls,
HighGravity,
LowGravity,
DarkRoom,
Freeze
None = 0,
Blue = 1,
Red = 2,
Purple = 3,
InvertedControls = 4,
HighGravity = 5,
LowGravity = 6,
DarkRoom = 7,
Freeze = 8
};
public class GameManager : MonoBehaviour {
@ -36,9 +36,8 @@ public class GameManager : MonoBehaviour {
public OrbTypes SelectRandomEffect() {
OrbTypes selected;
Array values = Enum.GetValues(typeof(OrbTypes));
do {
selected = (OrbTypes)values.GetValue(Random.Range(1, values.Length));
selected = (OrbTypes)Random.Range(1, 9);
} while (selected == currentType || selected == _lastType);
ChangeEventCall(selected);

View file

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using MyBox;
using UnityEngine;
using UnityEngine.UI;
@ -8,10 +9,15 @@ public class CanvasController : MonoBehaviour {
[SerializeField] Sprite[] orbCountdown;
[SerializeField] Image orb;
[SerializeField] DOTweenAnimation effectTween;
Image _effectImage;
[SerializeField] Sprite[] effectSprites;
// Start is called before the first frame update
[ButtonMethod]
void Start() {
_effectImage = effectTween.GetComponent<Image>();
StartCoroutine(Countdown());
}
@ -25,7 +31,9 @@ public class CanvasController : MonoBehaviour {
orb.sprite = orbCountdown[i];
yield return new WaitForSeconds(1f);
}
GameManager.instance.SelectRandomEffect();
_effectImage.sprite = effectSprites[(int)GameManager.instance.SelectRandomEffect() - 1];
effectTween.DORestart();
StartCoroutine(Countdown());
}
}