Exemplo n.º 1
0
    void Awake()
    {
        if (randomWalk == null)
        {
            randomWalk = GetComponent <AIRandomWalk>();
        }

        if (followTarget == null)
        {
            followTarget = GetComponent <AIFollowTarget>();
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        m_agent = GetComponent <NavMeshAgent> ();
        m_randomWalkComponent = GetComponent <AIRandomWalk> ();

        //if we haven't assigned a target, let's assume it's the player
        if (targetGameObject == null)
        {
            PlayerManager[] playerManagers = GameObject.FindObjectsOfType <PlayerManager> ();
            if (playerManagers.Length > 0)
            {
                targetGameObject = playerManagers [0].gameObject;
            }
        }

        SwitchState(FollowTargetState.FTS_SEARCH);
    }