private void Play(int entityID, RPGGameEvent actionStarted) { var animation = this.EntityManager.GetComponent <AnimationComponent>(entityID); if (animation == null) { return; } var form = this.EntityManager.GetComponent <FormComponent>(entityID); if (form == null) { return; } var animationData = animation.Animations.Find(x => x.TriggerEvent == actionStarted); if (animationData == null) { return; } if (animationData.DisablePhysics) { form.PhysicsEnabled = false; } animationData.theAnimation = form.PlayAnimation(animationData.Name, animationData.Sound); if (animationData.theAnimation != null) { ActiveAnimations.Add(animationData); this.EventManager.QueueEvent(RPGGameEvent.AnimationStarted, animationData); } }
public void Clear() { ActionType = RPGGameEvent.None; Duration = 0.0f; IsTimed = false; TargetID = -1; }
public static int MenuSortOrder(RPGGameEvent option) { switch (option) { case RPGGameEvent.Menu_None: return(0); case RPGGameEvent.Menu_Open: return(10); case RPGGameEvent.Menu_Close: return(11); case RPGGameEvent.Menu_AttackMelee: return(20); case RPGGameEvent.Menu_PickLock: return(30); case RPGGameEvent.Menu_UseKey: return(40); case RPGGameEvent.Menu_Locked: return(50); case RPGGameEvent.Menu_DisarmTrap: return(60); case RPGGameEvent.Menu_TrapDetected: return(70); default: return(-1); } }
public void ClearAll() { MenuOptions = new SortedList <int, RPGGameEvent>(); Distance = -1; EntityID_Item = -1; MouseButtonPressed = false; SelectedOption = RPGGameEvent.None; }
public void AddOption(RPGGameEvent option) { int s = RPGGameEventUtils.MenuSortOrder(option); if (!MenuOptions.ContainsKey(s)) { MenuOptions.Add(s, option); } }
private void UntimedActionCompleted(int entityID, RPGGameEvent actionType) { MenuSystem.ClearOptions(entityID); var action = this.EntityManager.GetComponent <ActionComponent>(entityID); if (action != null && action.ActionType == RPGGameEvent.FallStarted) { action.ActionType = RPGGameEvent.None; } }
public static bool MenuOptionIsDisabledType(RPGGameEvent option) { switch (option) { case RPGGameEvent.Menu_Locked: case RPGGameEvent.Menu_None: case RPGGameEvent.Menu_TrapDetected: return(true); default: return(false); } }
private void UntimedActionStarted(int entityID, RPGGameEvent actionType) { var action = this.EntityManager.GetComponent <ActionComponent>(entityID); if (action != null) { return; } action.ActionType = actionType; action.Duration = 0.0f; action.IsTimed = false; action.TargetID = -1; MenuSystem.SetMenuToBusy(entityID); }
public static void AddOption(int entityID, RPGGameEvent option) { var menu = GameBehavior.thisGame.EntityManager.GetComponent <MenuComponent>(entityID); if (menu == null) { return; } int s = RPGGameEventUtils.MenuSortOrder(option); if (!menu.MenuOptions.ContainsKey(s)) { menu.MenuOptions.Add(s, option); } }
private void TimedActionStarted(int entityID, RPGGameEvent actionType, float duration, bool isTimed, int targetID) { var action = this.EntityManager.GetComponent <ActionComponent>(entityID); if (action == null) { return; } action.ActionType = actionType; action.Duration = duration; action.IsTimed = isTimed; action.TargetID = targetID; MenuSystem.SetMenuToBusy(entityID); this.EventManager.QueueEvent(RPGGameEvent.ActionStarted, new ActionStartedData() { ActorID = entityID, TargetID = action.TargetID, ActionType = action.ActionType }); }
private static Delegate_CallOnActionCompleted ActionCompletedEvent(RPGGameEvent option) { switch (option) { case RPGGameEvent.Menu_DisarmTrap: return(TrapSystem.OnDisarmTrap); case RPGGameEvent.Menu_Close: return(OpenSystem.ToggleOpen); case RPGGameEvent.Menu_Open: return(OpenSystem.ToggleOpen); case RPGGameEvent.Menu_PickLock: return(LockSystem.OnPickLock); case RPGGameEvent.Menu_UseKey: return(LockSystem.OnUseKey); default: return(null); } }
public void RemoveOption(RPGGameEvent option) { MenuOptions.Remove(RPGGameEventUtils.MenuSortOrder(option)); }
public bool OptionIsActive(RPGGameEvent option) { return(MenuOptions.ContainsKey(RPGGameEventUtils.MenuSortOrder(option))); }
public static bool BusyWithMenuOption(RPGGameEvent action) { return(action.ToString().StartsWith("Menu_")); }