Пример #1
0
    public void SetState(GuyStates state)
    {
        if (state == currentState)
        {
            return;
        }

        if (state != GuyStates.Follow)
        {
            followCrono = 0;
        }

        if (state != GuyStates.Attack && punchCoroutine != null)
        {
            StopCoroutine(punchCoroutine);
        }
        anim.ResetTrigger("Attack");

        //Start dos estados
        switch (state)
        {
        case GuyStates.Attack:
            punchCoroutine = StartCoroutine(Attack());
            break;

        case GuyStates.Wait:
            StartCoroutine(Wait(3));
            break;

        case GuyStates.WalkAroundPlayer:
            StartCoroutine(WalkAroundPlayer());
            break;

        case GuyStates.Hit:
            StartCoroutine(Hit(2));
            break;

        case GuyStates.DropItem:
            anim.SetTrigger("ReflectedDown");
            gameObject.tag = "DieWithItem";
            health         = 0;
            Melee_Controller controller = GetComponent <Melee_Controller>();
            if (controller != null)
            {
                controller.enabled = false;
            }
            break;

        case GuyStates.Die:
            anim.SetTrigger("ReflectedDown");
            Die();
            break;
        }

        currentState = state;
    }
Пример #2
0
    public override void Die()
    {
        base.Die();
        if (agent != null)
        {
            agent.enabled = false;
        }

        Melee_Controller controller = GetComponent <Melee_Controller>();

        if (controller != null)
        {
            controller.enabled = false;
        }
    }