示例#1
0
        public void AddItem(T item, float time)
        {
            bool shouldAdd = _itemList.Count == 0 || _itemList.Last.Value.Time < time;

            if (shouldAdd)
            {
                TimeStampedItem <T> nextItem = new TimeStampedItem <T>(time, item);
                _itemList.AddLast(nextItem);
            }
        }
示例#2
0
        public void ApplyInput(Dictionary <InputEnum, bool> inputMap, float mouseX, float timeStamp)
        {
            _playerMovement.ApplyInput(inputMap);
            Vector3 movement         = _playerMovement.GetMovement();
            Vector3 directedMovement = transform.forward * movement.z + transform.right * movement.x;
            bool    walking          = !directedMovement.magnitude.Equals(0);

            if (walking)
            {
                TimeStampedItem <Vector3> timeStampedMovement = new TimeStampedItem <Vector3>(timeStamp, directedMovement);
                _movementBuffer.AddLast(timeStampedMovement);
            }
        }