Exemplo n.º 1
0
 private void instantiateDebugArrows(Brain currentBrain)
 {
     if (currentBrain is MouseAIBrain)
     {
         MouseAIBrain mouseAIBrain = ((MouseAIBrain)currentBrain);
         if (debugLastAiUpdate != mouseAIBrain.GetLastUpdate())
         {
             List <Vector3> newAiPath = ((MouseAIBrain)currentBrain).GetCurrentPath();
             if (!areListEquals(debugAiPath, newAiPath))
             {
                 debugAiPath = newAiPath;
                 foreach (Transform child in debugArrowContainer.transform)
                 {
                     Destroy(child.gameObject);
                 }
                 if (newAiPath.Count > 1)
                 {
                     for (int i = 0; i < newAiPath.Count - 1; ++i)
                     {
                         Quaternion arrowRotation = Quaternion.FromToRotation(Vector3.right, newAiPath[i + 1] - newAiPath[i]);
                         Instantiate(debugArrowObject, new Vector3(newAiPath[i].x, 0.08f, newAiPath[i].z), arrowRotation, debugArrowContainer.transform);
                     }
                 }
                 Instantiate(debugTargetObject, new Vector3(newAiPath[newAiPath.Count - 1].x, 0.08f, newAiPath[newAiPath.Count - 1].z), Quaternion.identity, debugArrowContainer.transform);
             }
         }
     }
 }
Exemplo n.º 2
0
 protected new void Awake()
 {
     base.Awake();
     if (brainType.Equals(BrainType.PLAYER))
     {
         brain = new PlayerBrain();
     }
     else
     {
         brain = new MouseAIBrain();
     }
 }