Ejemplo n.º 1
0
    void CalculateState()
    {
        state = DoggoState.ROAMING;

        if (status.IsHungry)
        {
            state = DoggoState.LOOKING_FOR_FOOD;
        }
        else if (status.IsBored)
        {
            if (IsHoldingBall)
            {
                state = DoggoState.RETURNING_BALL;
            }
            else
            {
                state = DoggoState.LOOKING_TO_PLAY;
            }
        }

        if (state != DoggoState.RETURNING_BALL)
        {
            DropBall();
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        state       = DoggoState.ROAMING;
        audioSource = GetComponent <AudioSource>();

        status          = GetComponent <DogStatus>();
        agent           = GetComponent <NavMeshAgent>();
        pb              = GetComponent <PhysicsBehaviour>();
        foodDetector    = GetComponentInChildren <FoodDetector>();
        ballDetector    = GetComponentInChildren <BallDetector>();
        myTransform     = transform;
        playerTransform = FindObjectOfType <Player>().transform;
        animator        = GetComponent <Animator>();

        audioSource.Play();
        spawnDespawnParticleSystem.Play();
        AudioSource.PlayClipAtPoint(spawnClip, transform.position);

        StartCoroutine(BarkRandomly());
    }