Example #1
0
 void Start()
 {
     // Attempt to get this character manager script.
     characterManager = GetComponentInParent <Character_Manager> ();
     // IF we have a target.
     if (target != null)
     {
         // Find a path.
         PathRequestManager.RequestPath((Vector2)transform.position, (Vector2)target.position, OnPathFound);
     }
 }
Example #2
0
        public void DoItNow()
        {
            // See if we can find ourselves a path after a left click.
            Vector2 newPosition = new Vector2();

            newPosition = Random.insideUnitCircle * 8 + new Vector2(characterManager.transform.position.x, characterManager.transform.position.y);

            while (true)
            {
                if (requestManager.IsVectorWalkable(newPosition))
                {
                    break;
                }
                Debug.Log("looking for position");
                newPosition = Random.insideUnitCircle * 8 + new Vector2(characterManager.transform.position.x, characterManager.transform.position.y);
            }
            PathRequestManager.RequestPath((Vector2)transform.position, newPosition, OnPathFound);
        }
Example #3
0
 void Update()
 {
     // IF we didnt have a target.
     if (target == null)
     {
         // IF we want the player AND a Player exists.
         if (targetPlayer && Character_Helper.GetPlayer() != null)
         {
             // Set the player transfer.
             target = Character_Helper.GetPlayer().transform;
             // Leave.
             return;
         }
     }
     else
     {
         // Find a path.
         PathRequestManager.RequestPath((Vector2)transform.position, (Vector2)target.position, OnPathFound);
     }
 }