コード例 #1
0
 public void Read()
 {
     _shooting = UnityEngine.Input.GetKey(_shootKey) && _accumCooldown >= ShootingCooldownSeconds;
     if (_shooting)
     {
         _accumCooldown = 0f;
     }
     _currentInput = new Input(UnityEngine.Input.GetKey(_forwardKey), UnityEngine.Input.GetKey(_backwardsKey),
                               UnityEngine.Input.GetKey(_leftKey), UnityEngine.Input.GetKey(_rightKey));
     _inputsToSend[++_biggestInputIdQueuedToSend] = _currentInput;
 }
コード例 #2
0
 public PlayerInput(KeyCode forwardKey, KeyCode backwardsKey, KeyCode leftKey, KeyCode rightKey, KeyCode shootKey)
 {
     _forwardKey    = forwardKey;
     _backwardsKey  = backwardsKey;
     _leftKey       = leftKey;
     _rightKey      = rightKey;
     _shootKey      = shootKey;
     _accumCooldown = 0f;
     _shooting      = false;
     _currentInput  = new Input();
     _biggestInputIdQueuedToSend = -1;
     _inputsToSend = new SortedDictionary <int, Input>();
     _shootsToSend = new SortedDictionary <int, Shoot>();
 }