Пример #1
0
        private void SetInputFake() // redirect public methods and properties to our replay system
        {
            GetKey             = FakeGetKey;
            GetKeyDown         = FakeGetKeyDown;
            GetKeyUp           = FakeGetKeyUp;
            GetMouseButton     = FakeGetMouseButton;
            GetMouseButtonDown = FakeGetMouseButtonDown;
            GetMouseButtonUp   = FakeGetMouseButtonUp;

            GetButton     = delegate(string name) { return(currentSequence.vB.Contains(name)); };
            GetButtonDown = delegate(string name) { return(currentSequence.vBD.Contains(name)); };
            GetButtonUp   = delegate(string name) { return(currentSequence.vBU.Contains(name)); };
            GetAxis       = delegate(string name) { return(currentSequence.vA.ElementAt(AxisList.FindIndex(str => str == name))); };

            _mousePosition      = delegate { return(currentSequence.mP); };
            _mouseWorldPosition = delegate { return(currentSequence.mWP); };
            _mouseScrollDelta   = delegate { return(currentSequence.mSD); };

            _anyKey     = delegate { return(currentSequence.gK.Any <KeyCode>()); };
            _anyKeyDown = delegate { return(currentSequence.gKD.Any <KeyCode>()); };
        }
Пример #2
0
        private void SetInputStd()  // redirect public methods and properties to actual UnityEngine.Input
        {
            GetKey             = Input.GetKey;
            GetKeyDown         = Input.GetKeyDown;
            GetKeyUp           = Input.GetKeyUp;
            GetMouseButton     = Input.GetMouseButton;
            GetMouseButtonDown = Input.GetMouseButtonDown;
            GetMouseButtonUp   = Input.GetMouseButtonUp;

            GetButton     = Input.GetButton;
            GetButtonDown = Input.GetButtonDown;
            GetButtonUp   = Input.GetButtonUp;
            GetAxis       = Input.GetAxis;

            _mousePosition      = delegate { return(Input.mousePosition); };
            _mouseWorldPosition = delegate { return(Camera.main.ScreenToWorldPoint(Input.mousePosition)); };
            _mouseScrollDelta   = delegate { return(Input.mouseScrollDelta); };

            _anyKey     = delegate { return(Input.anyKey); };
            _anyKeyDown = delegate { return(Input.anyKeyDown); };
        }