Пример #1
0
        public void PushOrb(EnemyColorKind kind)
        {
            var freeBtn = _buttons.FirstOrDefault(b => !b.IsUsed && !b.Letter.OrbColor.HasValue);

            if (freeBtn == null)
            {
                return;
            }
            freeBtn.SetLetter(new Letter(kind));
        }
Пример #2
0
        public void UseOrb(EnemyColorKind kind)
        {
            GameObject usePrefab = null;

            switch (kind)
            {
            case EnemyColorKind.Red:
                AudioController.Instance.PlayOrbRed();
                usePrefab = OrbRedUsePrefab;
                break;

            case EnemyColorKind.Green:
                AudioController.Instance.PlayOrbGreen();
                usePrefab = OrbGreenUsePrefab;
                break;

            case EnemyColorKind.Blue:
                AudioController.Instance.PlayOrbBlue();
                usePrefab = OrbBlueUsePrefab;
                break;
            }


            Instantiate(usePrefab, Player.Instance.transform.position + new Vector3(0, -2.39f, 20), Quaternion.identity);

            ActiveOrb        = kind;
            _orbDurationLeft = OrdDuration;

            foreach (var enemy in Enemy.Enemies.ToList())
            {
                if (enemy.ColorKind != kind && enemy.SpawnKind != SpawnKind.Big && enemy.SpawnKind != SpawnKind.Boss)
                {
                    Destroy(enemy.gameObject);
                }
                else
                {
                    if (enemy.SpawnKind != SpawnKind.Big && enemy.SpawnKind != SpawnKind.Boss)
                    {
                        var go       = CreateEnemyGo(SpawnKind.Big);
                        var bigEnemy = go.GetComponent <Enemy>();
                        bigEnemy.SetKind(SpawnKind.Big, enemy.ColorKind);
                        bigEnemy.transform.position = enemy.transform.position;
                        bigEnemy.transform.rotation = enemy.transform.rotation;

                        Destroy(enemy.gameObject);
                    }
                    else
                    {
                        enemy.Hp = enemy.Preset.Hp;
                    }
                }
            }
        }
Пример #3
0
        private void UpdateOrb()
        {
            if (_orbDurationLeft <= 0)
            {
                return;
            }

            _orbDurationLeft -= Time.deltaTime;

            if (_orbDurationLeft <= 0)
            {
                ActiveOrb = EnemyColorKind.None;
            }
        }
Пример #4
0
        public static KeyboardEffectKindId GetEffect(EnemyColorKind color)
        {
            switch (color)
            {
            case EnemyColorKind.Red:
                return(KeyboardEffectKindId.Shuffle);

            case EnemyColorKind.Green:
                return(KeyboardEffectKindId.Blur);

            case EnemyColorKind.Blue:
                return(KeyboardEffectKindId.Flip);

            default:
                throw new ArgumentOutOfRangeException(nameof(color), color, null);
            }
        }
Пример #5
0
        public static Color GetColor(EnemyColorKind kind)
        {
            switch (kind)
            {
            case EnemyColorKind.Red:
                return(Color.red);

            case EnemyColorKind.Green:
                return(Color.green);

            case EnemyColorKind.Blue:
                return(Color.blue);

            default:
                throw new ArgumentOutOfRangeException(nameof(kind), kind, null);
            }
        }
Пример #6
0
        private void SetSprite(EnemyColorKind orbColor)
        {
            switch (orbColor)
            {
            case EnemyColorKind.Red:
                Image.sprite = Red;
                break;

            case EnemyColorKind.Green:
                Image.sprite = Green;
                break;

            case EnemyColorKind.Blue:
                Image.sprite = Blue;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(orbColor), orbColor, null);
            }
        }
Пример #7
0
        public void SetKind(GameController.SpawnKind kind, EnemyColorKind colorKind)
        {
            Preset    = GameController.Instance.Presets.Find(p => p.Kind == kind);
            ColorKind = colorKind;
            SpawnKind = kind;
            Hp        = Preset.Hp;

            if (RedEffect != null)
            {
                RedEffect.SetActive(false);
                GreenEffect.SetActive(false);
                BlueEffect.SetActive(false);
            }

            switch (colorKind)
            {
            case EnemyColorKind.Red:
                if (RedEffect)
                {
                    RedEffect.SetActive(true);
                }
                SetColor(RedTexture);
                break;

            case EnemyColorKind.Green:
                if (RedEffect)
                {
                    GreenEffect.SetActive(true);
                }
                SetColor(GreenTexture);
                break;

            case EnemyColorKind.Blue:
                if (RedEffect)
                {
                    BlueEffect.SetActive(true);
                }
                SetColor(BlueTexture);
                break;
            }
        }
Пример #8
0
        private void OnEnable()
        {
            Kind = (EnemyColorKind)Random.Range(0, 3);

            Red.gameObject.SetActive(false);
            Green.gameObject.SetActive(false);
            Blue.gameObject.SetActive(false);

            switch (Kind)
            {
            case EnemyColorKind.Red:
                Red.gameObject.SetActive(true);
                break;

            case EnemyColorKind.Green:
                Green.gameObject.SetActive(true);
                break;

            case EnemyColorKind.Blue:
                Blue.gameObject.SetActive(true);
                break;
            }
        }
Пример #9
0
 void Awake()
 {
     Instance    = this;
     ActiveOrb   = EnemyColorKind.None;
     CurrentWave = 1;
 }