private void OnTriggerEnter(Collider target) { if (target.gameObject.tag == "Enemy") { Destroy(target.gameObject); GameController_Script.IncreaseScore(1); Debug.Log(GameController_Script.GetScore()); } }
private void OnTriggerEnter(Collider target) { if (target.gameObject.tag.Contains("Enemy")) { target.GetComponent <slime_mover>().life--; if (target.GetComponent <slime_mover>().life <= 0) { Destroy(target.gameObject); GameController_Script.IncreaseScore(0.3f); } } }
private void OnTriggerEnter(Collider target) { if (target.gameObject.tag.Contains("Enemy")) { target.GetComponent <slime_mover>().life--; if (target.GetComponent <slime_mover>().life <= 0) { if (target.gameObject.tag == "Enemy S") { GameController_Script.IncreaseScore(1); } else if (target.gameObject.tag == "Enemy M") { GameController_Script.IncreaseScore(2); GameObject slime = Instantiate(smallSlime, transform.position, transform.rotation); slime.GetComponent <slime_mover>().canMerge = false; } else if (target.gameObject.tag == "Enemy L") { GameController_Script.IncreaseScore(3); GameObject slime = Instantiate(mediumSlime, transform.position, transform.rotation); slime.GetComponent <slime_mover>().canMerge = false; } Debug.Log(GameController_Script.GetScore()); Destroy(target.gameObject); } Instantiate(explosion, transform.position, transform.rotation); Destroy(gameObject); } else if (target.gameObject.tag == "BOSS") { target.GetComponent <slime_boss>().life--; if (target.GetComponent <slime_boss>().life <= 0) { GameController_Script.IncreaseScore(20); Debug.Log(GameController_Script.GetScore()); Destroy(target.gameObject); } Instantiate(explosion, transform.position, transform.rotation); Destroy(gameObject); } }