예제 #1
0
        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);
            }
        }
예제 #2
0
 void LateUpdate()
 {
     ButtonInputController.LateTick();
 }
예제 #3
0
    void FixedUpdate()
    {
        ButtonInputController.FixedTick();

        UpdatePlayer();
    }
예제 #4
0
 void RegisterCommandDelegates()
 {
     ButtonInputController.RegisterButtonDelegate(Action.Jump, this.Jump);
     ButtonInputController.RegisterButtonDelegate(Action.Climb, this.Climb);
     Debug.Log("Delegates registered");
 }