using UnityEngine;
using System.Collections;

public class Food : Entity {

	public float value = 1.0f;

	private int ID;

	public void OnTriggerEnter (Collider other) {
		other.SendMessage ("OnFood", this, SendMessageOptions.DontRequireReceiver);
	}

	public void Init() {
		fixYAxis ();
		this.ID = networkController.controller.GetNextFoodID();
		networkController.controller.SendSpawnFood (this);
	}

	void Update() {
		float dt = Time.deltaTime;

		transform.Rotate (0f, 36f * dt, 0f);
	}

	void OnDestroy() {
		networkController.controller.SendDestroyFood (this);
	}

	public int GetFoodID() {
		return ID;
	}
}
