/// <summary> /// Updates the time of the given PlayerPedAction /// </summary> /// <param name="action">Target PlayerPedAction</param> private void UpdateLastAction(PlayerPedAction action) { lastActions[action] = Game.GameTime; }
/// <summary> /// Helper method to determine if player 2 is allowed to do the given PlayerPedAction /// </summary> /// <param name="action">PlayerPedAction to check</param> /// <param name="time">minimal time that has to be past before true</param> /// <returns>true if time since last PlayerPedAction is more than given time, false otherwise</returns> private bool CanDoAction(PlayerPedAction action, int time) { return(Game.GameTime - lastActions[action] >= time); }