public void OnLevelLoaded(int level)
        {
            List <AirdropNode> nodes = FieldAirdropNodes.GetValue(null) as List <AirdropNode>;

            if (Configuration.Instance.UseDefaultSpawns)
            {
                if (!Configuration.Instance.UseDefaultAirdrops)
                {
                    Random random = new Random();
                    foreach (AirdropNode node in nodes)
                    {
                        node.id = Configuration.Instance.Airdrops[random.Next(Configuration.Instance.Airdrops.Count)].AirdropId;
                    }
                }
            }
            else
            {
                nodes = new List <AirdropNode>();
            }

            foreach (AirdropSpawn spawn in Configuration.Instance.AirdropSpawns)
            {
                AirdropManagerUtility.AddAirdropToNodes(nodes, spawn);
            }

            FieldAirdropNodes.SetValue(null, nodes);
        }
Exemple #2
0
        public void OnLevelLoaded(int level)
        {
            var field = typeof(LevelManager).GetField("airdropNodes", BindingFlags.Static | BindingFlags.NonPublic);
            List <AirdropNode> nodes = field.GetValue(null) as List <AirdropNode>;

            if (Configuration.Instance.UseDefaultSpawns)
            {
                if (!Configuration.Instance.UseDefaultAirdrops)
                {
                    Random random = new Random();
                    foreach (AirdropNode node in nodes)
                    {
                        node.id = Configuration.Instance.Airdrops[random.Next(Configuration.Instance.Airdrops.Count)].AirdropId;
                    }
                }
            }
            else
            {
                nodes = new List <AirdropNode>();
            }

            foreach (AirdropSpawn spawn in Configuration.Instance.AirdropSpawns)
            {
                AirdropManagerUtility.AddAirdropToNodes(nodes, spawn);
            }

            field.SetValue(null, nodes);
        }