/// <summary> /// Find the first action in this collection with a matching /// input trigger to the one provided /// </summary> /// <param name="trigger"></param> /// <returns></returns> public GameAction FirstMatch(ActionInputTrigger trigger) { foreach (var gA in this) { if (gA.Trigger != null && gA.Trigger.Matches(trigger)) { return(gA); } } return(null); }
/// <summary> /// Does this input trigger match the given one? /// For the purposes of matching, top level input /// functions are taken to be equivalent to any of /// their sub-inputs /// </summary> /// <param name="other"></param> /// <returns></returns> public virtual bool Matches(ActionInputTrigger other) { if (other.Input.IsTopLevel()) { return(_Input.ToTopLevel() == other.Input); } else if (_Input.IsTopLevel()) { return(_Input == other.Input.ToTopLevel()); } else { return(_Input == other.Input); } }
public WaitAction() : base("Wait") { Trigger = new ActionInputTrigger(InputFunction.Wait); }
/// <summary> /// Creates an action to pick up the target item /// </summary> /// <param name="target"></param> public PickUpAction(Element target) { Trigger = new ActionInputTrigger(InputFunction.PickUp); Target = target; Effects.Add(new PickUpItemEffect()); }
public WindUpAction(ActionFactory actionFactory, InputFunction input) : this(actionFactory) { Trigger = new ActionInputTrigger(input); }
public override bool Matches(ActionInputTrigger other) { return(base.Matches(other) && other is ActionCellInputTrigger && _TargetCell == ((ActionCellInputTrigger)other).TargetCell); }
/// <summary> /// Get the action assigned to the specified user input function /// </summary> /// <param name="input"></param> /// <returns></returns> public GameAction ActionForInput(InputFunction input) { var trigger = new ActionInputTrigger(input); return(Actions.FirstMatch(trigger)); }
public ExitStageAction(StageExit exit) { Trigger = new ActionInputTrigger(InputFunction.UseExit); SelfEffects.Add(new ExitStageEffect(exit)); }