using UnityEngine; using System.Collections; public class Button1 : MonoBehaviour, Predicate { private Vector3 startPosition; public float logicLevel = 0.05f; private bool pressed = false; public bool Automatic = true; void Start () { startPosition = transform.position; } public bool Pressed{ get{return pressed;} set{pressed = value;} } public bool State(){ return pressed; } void Update () { } void FixedUpdate(){ if (Automatic) { pressed = Vector3.Distance(startPosition, transform.position) > logicLevel; } //Debug.Log ("Is pressed = " + pressed); } }