示例#1
0
 void OnDestroy()
 {
     if (stats.currentHP <= 0)
     {
         gameController.enemiesKilled++;
         gameController.AddScore(stats.ScoreValue);
     }
 }
示例#2
0
    //Collision Detection Script
    void OnTriggerEnter(Collider other)
    {
        if (other == null)
        {
            return;
        }

        switch (other.tag)
        {
        case "EnemyShieldGenerator":
        case "EnemyShield":
        case "Enemy":
            Debug.Log("This is" + gameObject.tag);
            player.stats.currentHP -= other.GetComponent <scr_enemyStats>().stats.Damage;
            gameController.enemiesKilled++;
            Destroy(other.gameObject);
            Instantiate(explosion, other.transform.position, other.transform.rotation);
            gameController.AddScore(other.GetComponent <scr_enemyStats>().stats.ScoreValue);
            gameController.HUDcharacter.Play("damage");
            break;

        case "FoeWeapon":
            player.stats.currentHP -= other.GetComponent <scr_enemyStats>().stats.Damage;
            Destroy(other.gameObject);
            Instantiate(explosion, other.transform.position, other.transform.rotation);
            gameController.HUDcharacter.Play("damage");
            break;

        case "PickupGreen":
            gameController.powerupAction("Green", player);
            Instantiate(healthPowerup, transform.position, transform.rotation);
            Destroy(other.gameObject);
            break;

        case "PickupRed":
            gameController.powerupAction("Red", player);
            Instantiate(redPowerup, transform.position, transform.rotation);
            Destroy(other.gameObject);
            break;

        case "PickupBlue":
            gameController.powerupAction("Blue", player);
            Instantiate(bluePowerup, transform.position, transform.rotation);
            Destroy(other.gameObject);
            break;
        }
        if (player.stats.currentHP < 0)
        {
            gameController.powerupAction("Death", player);
        }
    }
示例#3
0
    //Collision Detection Script
    void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
        case "Enemy":
            other.GetComponent <scr_enemyStats>().stats.currentHP -= this.stats.Damage;
            Instantiate(explosion, transform.position, transform.rotation);
            if (this.tag != "SS")
            {
                Destroy(gameObject);
            }
            if (other.GetComponent <scr_enemyStats>().stats.currentHP <= 0)
            {
                Destroy(other.gameObject);
                //gameController.HUDcharacter.Play("enemyDown");
            }
            break;

        case "EnemyShield":
            Destroy(gameObject);
            break;

        case "EnemyShieldGenerator":
            other.GetComponent <scr_enemyStats>().stats.currentHP -= this.stats.Damage;
            Instantiate(explosion, transform.position, transform.rotation);
            if (this.tag != "SS")
            {
                Destroy(gameObject);
            }
            if (other.GetComponent <scr_enemyStats>().stats.currentHP <= 0)
            {
                gameController.AddScore(other.GetComponent <scr_enemyStats>().stats.ScoreValue);
            }
            break;
        }
    }
示例#4
0
 public void addScore(int score)
 {
     GC.AddScore(score);
 }