コード例 #1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        Pojectile life = collision.gameObject.GetComponent <Pojectile> ();

        if (life)
        {
            Health -= life.GetFire();
            life.LeserDes();
            if (Health <= 0)
            {
                Die();
            }
        }
    }
コード例 #2
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        Pojectile life = collision.gameObject.GetComponent <Pojectile> ();

        if (life)
        {
            Health -= life.GetFire();
            life.LeserDes();
            if (Health <= 0)
            {
                Destroy(gameObject);
                Score.ScorePoint(Point);
                AudioSource.PlayClipAtPoint(DieSound, transform.position);
            }
        }
    }