Exemple #1
0
 private void Awake()
 {
     agent      = GetComponent <NavMeshAgent>();
     dorgAI     = GetComponent <RobotDogAI>();
     dorgSensor = GetComponent <RobotDogSensor>();
     animator   = GetComponentInChildren <PoochAnimator>();
     EventBus.Subscribe <UntouchedObjectiveItemDetectedEvent>(OnUntouchedObjectiveItemDetectedEvent);
 }
Exemple #2
0
    /*
     * tree "Root"
     *  fallback
     *          while IsValidObjectiveInRange
     *                  GoToPointNearObjective
     *          while not IsValidObjectiveInRange
     *                  fallback
     *                          while ShouldFollowPlayerAhead
     *                                  FollowPlayerAhead
     *                          while not ShouldFollowPlayerAhead
     *                                  FollowPlayerBehind
     */

    void Awake()
    {
        dorgSensor = GetComponent <RobotDogSensor>();
        animator   = GetComponentInChildren <PoochAnimator>();

        // Debug.Log("RobotDogAI.Awake()");
        agent = GetComponent <NavMeshAgent>();
        startFollowingDistance = agent.stoppingDistance + startFollowingHysteresis;

        PlaceOnNavMesh(this.transform.position);
        nextPosition     = this.transform.position;
        previousPosition = this.transform.position;

        // Debug.Log("Player: " + player);
        if (player == null)
        {
            player = FindObjectOfType <PlayerMovement>();
        }
    }