示例#1
0
    // collision to get damage and die.
    void OnTriggerEnter2D(Collider2D col)
    {
        Shoot missile = col.GetComponent <Shoot>();

        if (missile)
        {
            HP -= missile.GetDamage();
            if (HP <= 0)
            {
                Score.points += point;
                Destroy(gameObject);
            }
        }
    }
示例#2
0
    // function to hit the player.
    void OnTriggerEnter2D(Collider2D col)
    {
        Shoot missile = col.GetComponent <Shoot>();

        if (missile)
        {
            HP -= missile.GetDamage();
            if (HP <= 0)
            {
                Destroy(gameObject);
                Die();
            }
            missile.Hit();
        }
    }
示例#3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        Debug.Log(col);
        Shoot missile = col.gameObject.GetComponent <Shoot>();

        if (missile)
        {
            //zadaje dmg
            health -= missile.GetDamage();
            //niszczy rakiete przy trafieniu
            missile.Hit();
            if (health <= 0)
            {
                Destroy(gameObject);
                scoreKeeper.Score(scoreValue);
            }
        }
    }
示例#4
0
文件: EnemyBeh.cs 项目: raqbiel/Unity
    void OnTriggerEnter2D(Collider2D col)
    {
        Debug.Log(col);
        Shoot missile = col.gameObject.GetComponent <Shoot>();

        if (missile)
        {
            //zadaje dmg
            health -= missile.GetDamage();
            //niszczy rakiete przy trafieniu
            missile.Hit();
            if (health <= 0)
            {
                AudioSource.PlayClipAtPoint(death, transform.position);
                Destroy(gameObject);
                GameObject smokePuff = Instantiate(smoke, transform.position, Quaternion.identity) as GameObject;
                scoreKeeper.Score(scoreValue);
            }
        }
    }
示例#5
0
    void OnTriggerEnter2D(Collider2D col)
    {
        Shoot missile = col.gameObject.GetComponent <Shoot>();

        if (missile)
        {
            bool CoolingDown = true;
            //zadaje dmg
            health -= missile.GetDamage();
            //niszczy rakiete przy trafieniu
            missile.Hit();
            if (CoolingDown == true)
            {
                Health.fillAmount -= 0.25f;
            }
            if (health <= 0)
            {
                Destroy(gameObject);
                SceneManager.LoadScene("Start Menu");
            }
        }
    }