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

public class SquareEnemy : MonoBehaviour {

	//Movement
	float moveSpeed = 2f;
	float moveRadius = 2f;
	float angle = 0;

	//Damage
	int damage = 12;


	// Use this for initialization
	void Start () {

	}
	
	// Update is called once per frame
	void Update () {
		//Set damage amount
		GetComponent<Enemy>().damageAmount = damage;

		//Move enemy on plane
		GetComponent<Enemy>().localX = Mathf.Cos((Mathf.PI/180) * angle) * moveRadius;
		GetComponent<Enemy>().localZ = Mathf.Sin((Mathf.PI/180) * angle) * moveRadius;
		angle += moveSpeed;
		
		//Move based on the layer's position and local position
		transform.position = new Vector3(GetComponent<Enemy>().layers[GetComponent<Enemy>().layerName].transform.position.x + GetComponent<Enemy>().localX,
		                                 GetComponent<Enemy>().layers[GetComponent<Enemy>().layerName].transform.position.y,
		                                 GetComponent<Enemy>().layers[GetComponent<Enemy>().layerName].transform.position.z + GetComponent<Enemy>().localZ);

	}
}
