// get the waypoint
 Vector3 GetWaypoint(bool isRandom)
 {
     // if isRandom is true then get a random position location
     if (isRandom)
     {
         return(m_AIManager.RandomPosition());
     }
     // otherwise ge a random waypoint from the list of waypoint gameobjects
     else
     {
         return(m_AIManager.RandomWaypoint());
     }
 }
Example #2
0
 Vector3 GetWayPoint(bool isRandom)
 {
     //if true get random position
     if (isRandom)
     {
         return(m_AIManager.RandomPosition());
     }
     //else get from list of waypoint objects
     else
     {
         return(m_AIManager.RandomWaypoint());
     }
 }
Example #3
0
    bool CanFindTarget(float start = 1f, float end = 7f)
    {
        m_wayPoint = m_AIManager.RandomWaypoint();

        //Avoids setting same waypoint twice
        if (m_lastWaypoint == m_wayPoint)
        {
            //Get new waypoint
            m_wayPoint = m_AIManager.RandomWaypoint();
            return(false);
        }
        else
        {
            //Set waypoint to last waypoint
            m_lastWaypoint = m_wayPoint;
            //Get random speed for movement and animation
            m_speed          = Random.Range(start, end);
            m_animator.speed = m_speed;
            //Bool sets to true to sshow new WP found
            return(true);
        }
    }
Example #4
0
 private bool CanFindTarget(float start = 1f, float end = 7f)
 {
     m_wayPoint = m_AIManager.RandomWaypoint();
     // Make sure we don't set the same waypoint twice
     if (m_lastWaypoint == m_wayPoint)
     {
         // Get a new waypoint
         m_wayPoint = m_AIManager.RandomWaypoint();
         return(false);
     }
     else
     {
         // Set the new waypoints as the last waypoint
         m_lastWaypoint = m_wayPoint;
         // Get random speed for movement and animation
         m_speed          = Random.Range(start, end);
         m_animator.speed = m_speed;
         // Set bool to true to say we found a WP
         Debug.Log("Speed: " + m_speed);
         return(true);
     }
 }