Пример #1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        NPlayerController np = collision.collider.gameObject.GetComponent <NPlayerController>();
        NWeapon           w  = collision.collider.gameObject.GetComponent <NWeapon>();

        if (np != null)
        {
            np.HitByWater();
            StartCoroutine("Explosion");
        }
        else if (collision.collider.gameObject.layer.Equals(LayerMask.NameToLayer("Platforms")))
        {
            StartCoroutine("Explosion");
        }
        else if (w != null)
        {
            w.HitByWater();
        }
    }