예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.R) || Input.GetKeyDown(KeyCode.K))
     {
         cph.playReset();
     }
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (started)
        {
            if (state >= 2 && state < 4)
            {
                if (RunningSequence)
                {
                    if (bipPreventif > 0)
                    {
                        doBipPreventif(Time.deltaTime);
                    }
                    else
                    {
                        DepleteTime(Time.deltaTime);
                    }
                }
                else
                {
                    if (blankTimer < 0)
                    {
                        bipsTodo     = UnityEngine.Random.Range(1, 5);
                        bipPreventif = bipsTodo;

                        RunningSequence = true;
                        blankTimer      = UnityEngine.Random.Range(0.3f, 2f);
                    }
                    else
                    {
                        blankTimer -= Time.deltaTime;
                        safe        = false;
                        RedSprite.SetActive(true);
                    }
                }
            }
            else if (state == 4)
            {
                started = false;
                safe    = true;
                RedSprite.SetActive(false);
            }
            else
            {
                DepleteTime(Time.deltaTime);
            }
        }

        if (alarmState)
        {
            alarm.enabled = true;
            if (timeUntilHand < 0)
            {
                cph.playReset(ResetEnum.HAND_KILL, hand);//hand.Trigger();
            }
            else
            {
                timeUntilHand -= Time.deltaTime;
            }
        }
    }
예제 #3
0
    private void Update()
    {
        if (crunchDeath && !bookDetected)
        {
            if (!once)
            {
                return;
            }

            mouving = rb.velocity.magnitude > 0.5f;

            if (playerDetected && mouving && groundDetected)
            {
                if ((Mathf.Sign(playerRelativePosition) == Mathf.Sign(rb.velocity.x)))
                {
                    cph.playReset();
                    once = false;
                }
            }
        }
    }