Esempio n. 1
0
        private void AddUpdateRemoveCmd(BehaviorscriptCommandTypes cmdType, bool conditionAddUpdate, Func <BehaviorscriptCommand> createCmd, Action <BehaviorscriptCommand> updateCmd)
        {
            var cmd = Script.FirstOfType(cmdType);

            if (cmd is object)
            {
                if (conditionAddUpdate)
                {
                    updateCmd(cmd);
                }
                else
                {
                    Script.Remove(cmd);
                    cmd.Close();
                }
            }
            else if (conditionAddUpdate)
            {
                cmd = createCmd();
                Script.Insert(1, cmd);
            }
        }
Esempio n. 2
0
 public BehaviorscriptCommand FirstOfType(BehaviorscriptCommandTypes cmdType)
 {
     return((BehaviorscriptCommand)this.FirstOrDefault(n => n.CommandType == cmdType));
 }
Esempio n. 3
0
 public int IndexOfType(BehaviorscriptCommandTypes cmdType)
 {
     return(IndexOf(this.FirstOrDefault(n => n.CommandType == cmdType)));
 }