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

public class BlueWaveScript : MonoBehaviour {
	public Rigidbody2D myRb;
	public bool isHit;

	public int damage = 5;
	public GameObject player;
	public PlayerController script;
	void Start () {
		myRb = gameObject.GetComponent<Rigidbody2D> ();

	}
	void Update () {
		transform.localScale += new Vector3 (0.05f, 0f, 0f);
		transform.localScale += new Vector3 (0f, 0.005f, 0f);


	}
	void OnTriggerEnter2D (Collider2D other) {
		if (other.gameObject.tag == "Blue Enemy") {
			Rigidbody2D otherRb = other.gameObject.GetComponent<Rigidbody2D> ();
			other.gameObject.GetComponent<EnemyScript> ().enabled = false;
			otherRb.velocity = myRb.velocity;

			PlayerController.count += damage;
			isHit = true;
		}
		if (other.gameObject.tag == "Red Enemy" && !isHit || other.gameObject.tag == "Green Enemy" && !isHit || other.gameObject.tag == "Yellow Enemy" && !isHit) {
			PlayerController.count -= damage;
		}
	}
}
