Esempio n. 1
0
        // Injects the mutations into the spanwers
        private static void AddMutations(DirectedActorSpawner spawn)
        {
            ZoneDirector.Zone zone = spawn.GetComponentInParent <Region>().GetZoneId();

            foreach (DirectedActorSpawner.SpawnConstraint constraint in spawn.constraints)
            {
                foreach (Identifiable.Id id in MUTATIONS.Keys)
                {
                    if (MUTATIONS[id].Item1 != ZoneDirector.Zone.NONE && zone != MUTATIONS[id].Item1)
                    {
                        continue;
                    }

                    SlimeSet.Member slime = constraint.slimeset.members
                                            .FirstOrDefault(member => member.prefab.GetComponent <Identifiable>().id == id);

                    if (slime == null)
                    {
                        continue;
                    }

                    List <SlimeSet.Member> members = new List <SlimeSet.Member>(constraint.slimeset.members)
                    {
                        new SlimeSet.Member
                        {
                            prefab = GameContext.Instance.LookupDirector.GetPrefab(MUTATIONS[id].Item2),
                            weight = slime.weight / 3
                        }
                    };

                    constraint.slimeset.members = members.ToArray();
                }
            }
        }
 public static void Postfix(DirectedActorSpawner __instance)
 {
     foreach (var v in DirectedActorSpawnerRegistry.spawnerFixers)
     {
         if (v.Key(__instance))
         {
             v.Value(__instance);
         }
     }
 }