예제 #1
0
    public void Die()
    {
        if (!isDead && boredomClock.isGameRunning())
        {
            isDead = true;
            audio.PlayOneShot(deathSound);
            if (ridingRocket)
            {
                transform.localRotation = Quaternion.Euler(new Vector3(0f, -180f, 0f));
                AbandonRocket();
            }
            else
            {
                transform.localRotation = Quaternion.Euler(new Vector3(0f, -180f, 0f));
            }

            animation.Play("StandAnimation", PlayMode.StopAll);
            transform.rigidbody.constraints = RigidbodyConstraints.FreezePositionZ;
            rigidbody.AddTorque(Random.rotation.eulerAngles, ForceMode.VelocityChange);

            boredomClock.GameOver();

            getScreen().HeavyShakeTime(0.3f);
        }
    }
예제 #2
0
 void OnTriggerEnter(Collider other)
 {
     if (null != other.GetComponent("PigBehaviour") && boredomClock.isGameRunning())
     {
         collider.enabled = false;
         effect.RunEffect();
         audio.PlayOneShot(powerupSound);
         boredomClock.WinGame();
         Destroy(gameObject, 5f);
     }
 }