Exemple #1
0
 private void FixedUpdate()
 {
     if (MyBehaviour == MinionBehaviour.Follow)
     {
         FollowTarget();
     }
     else if (MyBehaviour == MinionBehaviour.Attack)
     {
         AttackTarget();
     }
     else if (MyBehaviour == MinionBehaviour.Wander)
     {
         UpdateWander();
     }
     else if (MyBehaviour == MinionBehaviour.SeekTarget)
     {
         UpdateWander();
         if (Time.time - LastSeekedTarget >= 2f)
         {
             LastSeekedTarget = Time.time;
             AttackClosest();
         }
     }
     else if (MyBehaviour == MinionBehaviour.Idle)
     {
         InputMovement.Set(0, 0);
     }
     // Pass all parameters to the character control script.
     m_Character.Move(InputMovement.x, InputMovement.y);
 }
Exemple #2
0
        protected virtual void FixedUpdate()
        {
            // Read the inputs.
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            float v = CrossPlatformInputManager.GetAxis("Vertical");

            if (!CanInput)
            {
                h = 0;
                v = 0;
            }
            // Pass all parameters to the character control script.
            MyCharacter.Move(h, v);
        }