Esempio n. 1
0
    // SET STATE
    private void SetState(HOUSE_STATE state)
    {
        switch (state)
        {
        case HOUSE_STATE.healthy:
            currState = HOUSE_STATE.healthy;
            animator.SetInteger(stateKey, 0);
            break;

        case HOUSE_STATE.dying:
            currState = HOUSE_STATE.dying;
            animator.SetInteger(stateKey, 1);
            SetLifespan();
            break;

        case HOUSE_STATE.dead:
            currState = HOUSE_STATE.dead;
            animator.SetInteger(stateKey, 2);
            AudioSource.PlayClipAtPoint(collapseSound, transform.position, .2f);
            break;

        default:
            break;
        }
    }
Esempio n. 2
0
 // START
 void Start()
 {
     animator      = GetComponent <Animator>();
     collapseSound = Resources.Load("Sounds/CollapseSound") as AudioClip;
     repairSound   = Resources.Load("Sounds/WrenchSound") as AudioClip;
     currState     = HOUSE_STATE.dying;
     SetLifespan();
 }