예제 #1
0
    public virtual void RecieveDamage(HitInfo hitInfo)
    {
        Splat.Create(3, this.transform.position);

        hitSource.Play();

        Health -= hitInfo.damage;

        if (Health <= 0 && !dead)
        {
            StartCoroutine(Die());
        }
    }
예제 #2
0
    IEnumerator Die()
    {
        dead = true;
        agent.Stop();
        GetComponent <Rigidbody2D>().velocity        = Vector2.zero;
        GetComponent <Rigidbody2D>().angularVelocity = 0;
        GetComponent <Collider2D>().enabled          = false;

        animator.SetTrigger("die");

        SpeechBubble.Create(GameManager.instance.GetRandomDeathText(), this.gameObject);

        // Squeeel
        yield return(deathDelay);

        deadSource.Play();
        Splat.Create(10, this.transform.position, 75f);
        this.enabled = false;
    }
예제 #3
0
    IEnumerator Die()
    {
        dead = true;

        deadSource.Play();

        GetComponent <Rigidbody2D>().velocity        = Vector2.zero;
        GetComponent <Rigidbody2D>().angularVelocity = 0;

        animator.SetTrigger("die");

        CameraManager.instance.Zoom(3);

        // Squeeel
        yield return(deathDelay);

        Splat.Create(10, this.transform.position, 75f);

        yield return(deathDelay);

        // restart
        SceneManager.LoadScene("DeathScene");
    }