Exemplo n.º 1
0
 public ScriptAction Clone()
 {
   ScriptAction scriptAction = new ScriptAction();
   scriptAction.Operation = this.Operation;
   scriptAction.Killswitch = this.Killswitch;
   scriptAction.Blocking = this.Blocking;
   scriptAction.Arguments = this.Arguments == null ? (string[]) null : Enumerable.ToArray<string>((IEnumerable<string>) this.Arguments);
   scriptAction.Object = this.Object == null ? (Entity) null : this.Object.Clone();
   return scriptAction;
 }
Exemplo n.º 2
0
 private void TryInitialize()
 {
   if (this.isHooked)
   {
     this.Gomez.EnteredDoor -= new Action(this.CheckWinCondition);
     this.isHooked = false;
   }
   if (this.LevelManager.Name != "CRYPT")
   {
     this.TraversedVolumes.Clear();
   }
   else
   {
     if (this.LevelManager.LastLevelName == "CRYPT")
     {
       this.TraversedVolumes.Add(this.PlayerManager.DoorVolume.Value);
       if (this.TraversedVolumes.Count > 4)
         this.TraversedVolumes.RemoveAt(0);
       for (int index = 0; index < this.TraversedVolumes.Count; ++index)
       {
         if (CryptHost.VolumeSequence[this.TraversedVolumes.Count - 1 - index] != this.TraversedVolumes[this.TraversedVolumes.Count - 1 - index])
         {
           this.TraversedVolumes.Clear();
           break;
         }
       }
     }
     else
       this.TraversedVolumes.Clear();
     ICollection<int> keys = this.LevelManager.Scripts.Keys;
     int[] numArray = new int[4]
     {
       0,
       1,
       2,
       3
     };
     foreach (int key in Enumerable.ToArray<int>(Enumerable.Except<int>((IEnumerable<int>) keys, (IEnumerable<int>) numArray)))
       this.LevelManager.Scripts.Remove(key);
     foreach (Volume volume in (IEnumerable<Volume>) this.LevelManager.Volumes.Values)
     {
       if (volume.Id > 1 && (volume.Id != 14 || this.TraversedVolumes.Count != 3))
       {
         int key = IdentifierPool.FirstAvailable<Script>(this.LevelManager.Scripts);
         int num = RandomHelper.InList<int>(Enumerable.Except<int>((IEnumerable<int>) this.LevelManager.Volumes.Keys, (IEnumerable<int>) new int[3]
         {
           0,
           1,
           volume.Id
         }));
         Script script1 = new Script();
         script1.Id = key;
         List<ScriptTrigger> triggers = script1.Triggers;
         ScriptTrigger scriptTrigger1 = new ScriptTrigger();
         scriptTrigger1.Event = "Enter";
         scriptTrigger1.Object = new Entity()
         {
           Type = "Volume",
           Identifier = new int?(volume.Id)
         };
         ScriptTrigger scriptTrigger2 = scriptTrigger1;
         triggers.Add(scriptTrigger2);
         List<ScriptAction> actions = script1.Actions;
         ScriptAction scriptAction1 = new ScriptAction();
         scriptAction1.Operation = "ChangeLevelToVolume";
         scriptAction1.Arguments = new string[4]
         {
           "CRYPT",
           num.ToString(),
           "True",
           "False"
         };
         scriptAction1.Object = new Entity()
         {
           Type = "Level"
         };
         ScriptAction scriptAction2 = scriptAction1;
         actions.Add(scriptAction2);
         Script script2 = script1;
         foreach (ScriptAction scriptAction3 in script2.Actions)
           scriptAction3.Process();
         this.LevelManager.Scripts.Add(key, script2);
       }
     }
     this.LevelManager.Scripts[2].Disabled = this.TraversedVolumes.Count != 3;
   }
 }