private void CheckAxisInputs(string name) { float axis = InputBuffer.Instance.GetAxis(name); //active will be non-null if input was active (non-zero) last frame TASInput active; activeInputs.TryGetValue(name, out active); if (axis != 0.0f) { if (active != null) { //if axis is still active and has the same value, increase its duration and time to live if (active.Value == axis) { active.Duration++; active.TimeToLive++; return; } //no need to remove input from active dictionary as it will be replaced next } //create a new input with a duration of 1 frame active = new TASInput(name, axis, 1); activeInputs[name] = active; //add the input to the input list for this frame GetInputListForThisFrame().Inputs.Add(active); } else if (active != null) { activeInputs.Remove(name); } }