// Update is called once per frame
        public override TowerState Update(TowerController tower)
        {
            if (tower.Zap(tower.GetClosestEnemy()) == true)
            {
                switch (tower.currentAttack)
                {
                case TowerController.AttackType.Zap:
                    tower.Zap(tower.GetClosestEnemy());
                    break;

                case TowerController.AttackType.Projectile:
                    tower.Shoot(tower.GetClosestEnemy());
                    break;

                case TowerController.AttackType.Ice:
                    tower.Freeze(tower.GetClosestEnemy());
                    break;

                default:
                    break;
                }

                return(new TowerStateIdle());
            }
            else
            {
                return(new TowerStateSearch());
            }
        }
Пример #2
0
        // Update is called once per frame
        public override TowerState Update(TowerController tower)
        {
            if (tower.GetClosestEnemy() != null)
            {
                Debug.Log("target locked");

                tower.atkTimer = 0;

                return(new TowerStateAttack());
            }
            else
            {
                Debug.Log("No enemy");
            }
            return(null);
        }