Files
ProjectBall.Unity/Assets/Scripts/Buttons/Button1.cs
T

35 lines
600 B
C#
Raw Normal View History

2025-05-13 05:18:03 +03:00
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);
}
}