コード例 #1
0
ファイル: FollowTarget.cs プロジェクト: gylesis/Space-Maze
        // Update is called once per frame
        void Update()
        {
            Vector3 Direction = target.position - transform.position;                  //Calculate the direction from the animal to the target
            float   distance  = Vector3.Distance(transform.position, target.position); //Calculate the distance..

            animal.Move(distance > stopDistance ? Direction : Vector3.zero);           //Move the Animal if we are not on the Stop Distance Radius
        }
コード例 #2
0
 void OnDisable()
 {
     if (mCharacterMove != null)
     {
         mCharacterMove.Move(Vector3.zero);       //When the Input is Disable make sure the character/animal is not moving.
     }
     OnInputDisabled.Invoke();
 }
コード例 #3
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 protected override void OnDisable()
 {
     if (mCharacterMove != null)
     {
         mCharacterMove.Move(Vector3.zero);                               //When the Input is Disable make sure the character/animal is not moving.
     }
     base.OnDisable();
 }