Esempio n. 1
0
 /// <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);
 }
Esempio n. 2
0
 /// <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);
     }
 }
Esempio n. 3
0
 public WaitAction() : base("Wait")
 {
     Trigger = new ActionInputTrigger(InputFunction.Wait);
 }
Esempio n. 4
0
 /// <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());
 }
Esempio n. 5
0
 public WindUpAction(ActionFactory actionFactory, InputFunction input) : this(actionFactory)
 {
     Trigger = new ActionInputTrigger(input);
 }
Esempio n. 6
0
 public override bool Matches(ActionInputTrigger other)
 {
     return(base.Matches(other) && other is ActionCellInputTrigger &&
            _TargetCell == ((ActionCellInputTrigger)other).TargetCell);
 }
Esempio n. 7
0
        /// <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));
        }
Esempio n. 8
0
 public ExitStageAction(StageExit exit)
 {
     Trigger = new ActionInputTrigger(InputFunction.UseExit);
     SelfEffects.Add(new ExitStageEffect(exit));
 }