public override void OnTriggerEnter(Collider other) { WaypointEnemy Enemy = other.GetComponent <WaypointEnemy>(); // If it is indeed an enemy if (Enemy) { Enemy.TakeDamage(damage); } }
// Update is called once per frame public virtual void OnTriggerEnter(Collider other) { WaypointEnemy Enemy = other.GetComponent <WaypointEnemy>(); // If it is indeed an enemy if (Enemy) { //Deal damage to the enemy Enemy.TakeDamage(damage); //Destroy the bullet Destroy(gameObject); } Destroy(gameObject); Instantiate(particles, transform.position, transform.rotation); }
// Update is called once per frame void OnTriggerEnter(Collider other) { //Get the enemy component from it WaypointEnemy Enemy = other.GetComponent <WaypointEnemy>(); // If it is indeed an enemy if (Enemy) { //Deal damage to the enemy Enemy.TakeDamage(damage); //Destroy the bullet Destroy(gameObject); } Destroy(gameObject); Instantiate(particles); }
public override void OnTriggerEnter(Collider other) { // Tell the enemy that they're frozen and by a certain value enemy = other.GetComponent <WaypointEnemy>(); // If it is indeed an enemy if (enemy) { enemy.TakeDamage(damage); frozeness += 0.1f; } if (frozeness >= 2f) { StartCoroutine("Freeze"); } }