static void Main(string[] args) { // get reference to default piface device with all inputs enabled for ISR var piface = new PiFaceDevice(255); var pinDetector = new InputPinController(piface, 0); pinDetector.PinChanged += pinDetector_PinChanged; var buttonDetector = new ButtonInputController(piface, 1); buttonDetector.ButtonClicked += buttonDetector_ButtonClicked; while (Console.KeyAvailable) { Console.ReadKey(true); } Console.WriteLine("Detectin changes on PiFace input pin 0 and Button clicks on pin 1. Press <Enter> key to exit.."); var ki = Console.ReadKey(true); while (ki.Key != ConsoleKey.Enter) { System.Threading.Thread.Sleep(100); ki = Console.ReadKey(true); } }
void LateUpdate() { ButtonInputController.LateTick(); }
void FixedUpdate() { ButtonInputController.FixedTick(); UpdatePlayer(); }
void RegisterCommandDelegates() { ButtonInputController.RegisterButtonDelegate(Action.Jump, this.Jump); ButtonInputController.RegisterButtonDelegate(Action.Climb, this.Climb); Debug.Log("Delegates registered"); }