Exemple #1
0
 private static void MakeCycles()
 {
     if (teleportCycles != null)
     {
         return;
     }
     teleportCycles = new TeleportCycle[1];
     foreach (var teleport in Game.I.Lvl.Map.GetAllTOOfType <Teleport>())
     {
         TeleportDefinition teleportDef = (TeleportDefinition)teleport.ToDef;
         int cycleIdx = teleportDef.teleportCycleIdx;
         if (cycleIdx + 1 >= teleportCycles.Length)
         {
             Array.Resize <TeleportCycle>(ref teleportCycles, cycleIdx + 1);
         }
         if (teleportCycles[cycleIdx] == null)
         {
             teleportCycles[cycleIdx] = new TeleportCycle();
         }
         if (teleportCycles[cycleIdx].teleportList == null)
         {
             teleportCycles[cycleIdx].teleportList = new List <Teleport>();
         }
         teleportCycles[cycleIdx].teleportList.Add(teleport);
     }
 }
Exemple #2
0
 public override void Set(TileObjectDefintion def)
 {
     base.Set(def);
     if (def.GetType() == typeof(TeleportDefinition))
     {
         TeleportDefinition newDef = (TeleportDefinition)def;
         _def.teleportCycleIdx = newDef.teleportCycleIdx;
     }
     Refresh();
 }