Esempio n. 1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        NPlayerController np = collision.collider.gameObject.GetComponent <NPlayerController>();
        NWeapon           w  = collision.collider.gameObject.GetComponent <NWeapon>();

        if (np != null && np.GetLivingStatus() && np != wielder)
        {
            np.HitByEarth(-collision.contacts[0].normal);
        }
        if (w != null)
        {
            w.HitByEarth();
        }
        else if (collision.collider.gameObject.layer.Equals(LayerMask.NameToLayer("Platforms")) && (wielder != null))
        {
            wielder         = null;
            decelerating    = true;
            falling         = true;
            rb.gravityScale = gravityScale;
        }
    }