using UnityEngine;
using System.Collections;

public class playerHandReact : MonoBehaviour {
	private bool used = false;
	void OnTriggerStay(Collider other){
		if (other.tag == "player1Hand" && this.tag == "paka") {
			float click = Input.GetAxis("Fire1");
			if(click > 0 && !used){
				used = true;
				this.animation.Play ("akce");
				openDoor.leverdown();
			}
		}
		if (other.tag == "player2Hand" && this.tag == "paka") {
			float click = Input.GetAxis("Fire2");
			if(click > 0 && !used){
				used = true;
				this.animation.Play ("akce");
				openDoor.leverdown();
			}
		}
		if (other.tag == "player1Hand" && this.tag == "objective") {
			float click = Input.GetAxis("Fire1");
			if(click > 0){
				openDoor.objective();
				this.renderer.enabled = false;
			}
		}
		if (other.tag == "player2Hand" && this.tag == "objective") {
			float click = Input.GetAxis("Fire2");
			if(click > 0){
				openDoor.objective();
				this.renderer.enabled = false;
			}
		}


	}
}
