Beispiel #1
0
            private static GameObject smethod_183(Spawns.SpawnerLootable spawnerLootable_0)
            {
                GameObject result;

                if (spawnerLootable_0.SpawnedObject == null && spawnerLootable_0.vector3_0 != Vector3.zero && spawnerLootable_0.List.Count > 0)
                {
                    string text = spawnerLootable_0.method_0();
                    if (text != null)
                    {
                        Vector3 vector;
                        Vector3 vector2;
                        TransformHelpers.GetGroundInfo(spawnerLootable_0.vector3_0, out vector, out vector2);
                        if (text == "BoxLoot")
                        {
                            vector.y += 0.35f;
                        }
                        Quaternion     quaternion = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);
                        GameObject     gameObject = NetCull.InstantiateStatic(text, vector, quaternion);
                        LootableObject component  = gameObject.GetComponent <LootableObject>();
                        if (component != null)
                        {
                            component.LootCycle = spawnerLootable_0.List[text].LootCycle;
                            component.lifeTime  = spawnerLootable_0.List[text].LifeTime;
                            component.ResetInvokes();
                        }
                        result = gameObject;
                        return(result);
                    }
                }
                result = spawnerLootable_0.SpawnedObject;
                return(result);
            }
Beispiel #2
0
 public static void smethod_96()
 {
     using (StreamReader streamReader = File.OpenText(Spawns.OverrideFile))
     {
         string a = string.Empty;
         Spawns.SpawnerGeneric  spawnerGeneric  = null;
         Spawns.SpawnerLootable spawnerLootable = null;
         string[] separator = new string[]
         {
             "//"
         };
         while (!streamReader.EndOfStream)
         {
             string text = streamReader.ReadLine().Trim();
             if (!string.IsNullOrEmpty(text) && text.Contains("//"))
             {
                 text = text.Split(separator, StringSplitOptions.RemoveEmptyEntries)[0];
                 text = text.Trim();
             }
             if (!string.IsNullOrEmpty(text))
             {
                 if (text.IndexOf('[') < text.IndexOf(']'))
                 {
                     a = text.Substring(1, text.Length - 2).ToLower();
                     if (spawnerGeneric != null && !spawnerGeneric.Initialized)
                     {
                         spawnerGeneric.Initialize();
                         Spawns.GenericSpawners.Add(spawnerGeneric);
                     }
                     if (spawnerLootable != null && !spawnerLootable.Initialized)
                     {
                         spawnerLootable.Initialize();
                         Spawns.LootableSpawners.Add(spawnerLootable);
                     }
                     if (a == "generic")
                     {
                         spawnerGeneric = new Spawns.SpawnerGeneric();
                     }
                     if (a == "lootable")
                     {
                         spawnerLootable = new Spawns.SpawnerLootable();
                     }
                 }
                 else
                 {
                     string[] array = text.Split(new char[]
                     {
                         '='
                     });
                     if (array.Length > 1)
                     {
                         string a2 = array[0].Trim().ToLower();
                         array = array[1].RemoveChars(new char[]
                         {
                             ' ',
                             '\t'
                         }).Split(new char[]
                         {
                             ','
                         });
                         if (a == "lootable" && spawnerLootable != null)
                         {
                             if (!(a2 == "position"))
                             {
                                 if (!(a2 == "spawntimemin"))
                                 {
                                     if (!(a2 == "spawntimemax"))
                                     {
                                         if (!(a2 == "spawnonstart"))
                                         {
                                             if (a2 == "spawnobject" && array.Length == 4)
                                             {
                                                 string prefab    = array[0];
                                                 float  weight    = float.Parse(array[1]);
                                                 float  lifetime  = float.Parse(array[2]);
                                                 float  lootcycle = float.Parse(array[3]);
                                                 spawnerLootable.AddLoot(prefab, weight, lifetime, lootcycle);
                                             }
                                         }
                                         else if (array.Length == 1)
                                         {
                                             spawnerLootable.SpawnOnStart = bool.Parse(array[0]);
                                         }
                                     }
                                     else if (array.Length == 1)
                                     {
                                         spawnerLootable.SpawnTimeMax = float.Parse(array[0]);
                                     }
                                 }
                                 else if (array.Length == 1)
                                 {
                                     spawnerLootable.SpawnTimeMin = float.Parse(array[0]);
                                 }
                             }
                             else if (array.Length == 3)
                             {
                                 float x = float.Parse(array[0]);
                                 float y = float.Parse(array[1]);
                                 float z = float.Parse(array[2]);
                                 spawnerLootable.SetPostition(new Vector3(x, y, z));
                             }
                         }
                         else if (a == "generic" && spawnerGeneric != null)
                         {
                             if (!(a2 == "position"))
                             {
                                 if (!(a2 == "spawnradius"))
                                 {
                                     if (!(a2 == "updatedelay"))
                                     {
                                         if (a2 == "spawnobject" && array.Length == 5)
                                         {
                                             Spawns.SpawnerGeneric.SpawnInstance spawnInstance = new Spawns.SpawnerGeneric.SpawnInstance();
                                             spawnInstance.PrefabName        = array[0];
                                             spawnInstance.TargetPopulation  = int.Parse(array[1]);
                                             spawnInstance.NumToSpawnPerTick = int.Parse(array[2]);
                                             spawnInstance.StaticInstantiate = bool.Parse(array[3]);
                                             spawnInstance.UseNavmeshSample  = bool.Parse(array[4]);
                                             spawnerGeneric.SpawnList.Add(spawnInstance);
                                         }
                                     }
                                     else if (array.Length == 1)
                                     {
                                         spawnerGeneric.ThinkDelay = float.Parse(array[0]);
                                     }
                                 }
                                 else if (array.Length == 1)
                                 {
                                     spawnerGeneric.SpawnRadius = float.Parse(array[0]);
                                 }
                             }
                             else if (array.Length == 3)
                             {
                                 float x2 = float.Parse(array[0]);
                                 float y2 = float.Parse(array[1]);
                                 float z2 = float.Parse(array[2]);
                                 spawnerGeneric.Position = new Vector3(x2, y2, z2);
                             }
                         }
                     }
                 }
             }
         }
         if (spawnerGeneric != null && !spawnerGeneric.Initialized)
         {
             spawnerGeneric.Initialize();
             Spawns.GenericSpawners.Add(spawnerGeneric);
         }
         if (spawnerLootable != null && !spawnerLootable.Initialized)
         {
             spawnerLootable.Initialize();
             Spawns.LootableSpawners.Add(spawnerLootable);
         }
     }
 }