Beispiel #1
0
 private void RunConditionCommands(ScriptCondition Cond)
 {
     foreach (ScriptRewardCommand Cmd in Cond.RewardCommands)
     {
         DispenseRewardSafe(Cmd.Dispenser);
         //Maze.DispenseReward(Cmd.Dispenser, Cmd.Count);
     }
 }
Beispiel #2
0
 public ScriptState(XElement Def)
 {
     Name = Def.AttributeValue <string>("name").ToLower();
     if (Def.AttributeValue <bool>("start"))
     {
         Type = StateType.Start;
     }
     else if (Def.AttributeValue <bool>("complete"))
     {
         Type = StateType.Complete;
     }
     foreach (var CmdDef in Def.Elements("command"))
     {
         ScriptDoorCommand Cmd = new ScriptDoorCommand(CmdDef);
         DoorCommands.Add(Cmd);
     }
     foreach (var CondDef in Def.Elements("when"))
     {
         ScriptCondition Cond = new ScriptCondition(CondDef);
         Cond.TimerExpired += Cond_TimerExpired;
         Conditions.Add(Cond);
     }
 }
Beispiel #3
0
        private void Cond_TimerExpired(object sender, ScriptConditionEventArgs e)
        {
            ScriptCondition Cond = (ScriptCondition)sender;

            StateCompleted?.Invoke(this, new ScriptStateEventArgs(Cond, e.NextState, true));
        }
 public ScriptStateEventArgs(ScriptCondition Condition, string NextState, bool TimerExpired)
 {
     this.Condition    = Condition;
     this.NextState    = NextState;
     this.TimerExpired = TimerExpired;
 }