Beispiel #1
0
        public override FreezeTowerState Update(FreezeTowerStateMachine freezeTower)
        {
            if (freezeTower.attackTarget != null)                // if attack target isnt null
            {
                freezeTower.timeUntilNextShot -= Time.deltaTime; // start timer

                if (freezeTower.timeUntilNextShot <= 0)
                {
                    freezeTower.enemy.agent.speed = 1.5f; // slows enemy movement
                    if (freezeTower.enemy.isUnfrozen)
                    {
                        freezeTower.enemy.isUnfrozen = false;                     // freeze enemy
                    }
                    freezeTower.enemy.TakeDamage(freezeTower.attackDamage);       // attack
                    freezeTower.timeUntilNextShot = freezeTower.timeBetweenShots; // reset Timer
                }
            }
            return(null); // return back into itself
        }
 public virtual void OnStart(FreezeTowerStateMachine freezeTower) { } // a start function that can be taken over by other classes
 public virtual void OnEnd(FreezeTowerStateMachine freezeTower) { } // a end function that can be taken over by other classes
 public abstract FreezeTowerState Update(FreezeTowerStateMachine freezeTower);// creates a special update that can be taken over by other classes
 /// <summary>
 /// Overrides the freeze tower update to use in this current state
 /// </summary>
 /// <param name="freezeTower">stores a reference of the FreezeTowerStateMachine in freezeTower</param>
 /// <returns>It returns back into itself until something happens</returns>
 public override FreezeTowerState Update(FreezeTowerStateMachine freezeTower)
 {
     return null;// stay in current state
 } // end update