using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerWave : MonoBehaviour {
	public bool isRed;
	public bool isBlue;
	public bool isYellow;
	public bool isGreen;

	public Rigidbody2D myRb;
	void Update () {
		
		transform.localScale += new Vector3 (0.05f, 0f, 0f);

		if (this.gameObject.tag == "Red Wave") {
			isRed = true;
		}
		if (this.gameObject.tag == "Blue Wave") {
			isBlue = true;
		}
		if (this.gameObject.tag == "Yellow Wave") {
			isYellow = true;
		}
		if (this.gameObject.tag == "Green Wave") {
			isGreen = true;
		}
	}
	void OnTriggerEnter2D (Collider2D other) {
		if (other.gameObject.tag == "Red Enemy" && isRed == true) {
			Rigidbody2D otherRb = other.gameObject.GetComponent<Rigidbody2D> ();
			otherRb.velocity = myRb.velocity;
		}	
		if (other.gameObject.tag == "Blue Enemy" && isBlue == true) {
			Destroy (other.gameObject);
		}	
		if (other.gameObject.tag == "Green Enemy" && isGreen == true) {
			Destroy (other.gameObject);
		}	
		if (other.gameObject.tag == "Yellow Enemy" && isYellow == true) {
			Destroy (other.gameObject);
		}	
	}
}
