void OnTriggerEnter2D(Collider2D col) { //Damage Aliver on collision and stop moving if (alive && col.tag == "Player") { AliverController aliver = col.gameObject.GetComponent <AliverController> (); aliver.Freeze(); moving = false; aliver.LoseLives(1); delay.Reset(); delay.Start(); waitTime = maxWaitTime; aliver.Unfreeze(); } //Take damage from projectile else if (col.tag == "Bomb" && col.gameObject.GetComponent <Bomb>().armed) { moving = false; canMove = false; delay.Stop(); Hurt(1); anim.Play("Hurt"); } else if (col.tag == "Shield") { moving = false; dest = transform.position; delay.Reset(); delay.Start(); } else if (col.tag == "Boundary" || col.tag == "Ground") { rigidbody2D.velocity = rigidbody2D.velocity * -1; } else if (col.tag == "ChangeDirection") { aim = col.gameObject.GetComponent <ChangeDirection> ().nextVel; } }
void OnTriggerEnter2D(Collider2D col) { //Damage Aliver on collision and stop moving if (alive && col.tag == "Player") { AliverController aliver = col.gameObject.GetComponent <AliverController>(); aliver.Freeze(); moving = false; aliver.LoseLives(1); delay.Reset(); delay.Start(); waitTime = maxWaitTime; aliver.Unfreeze(); } //Take damage from projectile else if (alive && col.tag == "Projectile") { killSound.Play(); col.gameObject.GetComponent <Projectile>().collided = true; moving = false; canMove = false; delay.Stop(); Hurt(1); anim.Play("Break"); } else if (col.tag == "Shield") { moving = false; dest = transform.position; delay.Reset(); delay.Start(); } }