Example #1
0
    // Update is called once per frame
    void Update()
    {
        thisAnimator.SetBool("AtDesk", stats.isWorking);
        if (isMoving)
        {
            transform.position = Vector3.MoveTowards(transform.position, destination, movementSpeed);
        }

        if (transform.position == destination)
        {
            if (destination == origPosition)
            {
                stats.isWorking = true;
                isMoving        = false;
                //Debug.Log("Back to work again");
            }
            else
            {
                if (stats.isReprimanding)
                {
                    if (currentIntern.CurrentActivity != Activity.Work && currentIntern.CurrentActivity != Activity.Bug)
                    {
                        stats.ActivateHand();
                        audioSource.PlayOneShot(AudioManager.instance.slapClip);
                    }
                }
                else
                {
                    stats.isHelping = true;
                    stats.isWorking = false;
                }
                //Debug.Log("I have reached my destination");
                isMoving = false;
            }
            if (loopingAudioSource.enabled == true)
            {
                loopingAudioSource.Stop();
                loopingAudioSource.enabled = false;
            }
        }
        else
        {
            stats.isWorking = false;
        }
    }