private void SetupAnimal(Transform animal, AnimalSpawnZone zone) { if (animal) { animal.GetChild(0).eulerAngles = new Vector3(0f, (float)UnityEngine.Random.Range(0, 360), 0f); } if (animal) { animal.SendMessage("startUpdateSpawn"); } if (animal) { animal.SendMessage("setSnowType", zone.snowType, SendMessageOptions.DontRequireReceiver); } zone.SpawnedAnimals.Add(animal.gameObject); AnimalSpawnController.AttachAnimalToNetwork(zone, animal.gameObject); }
public override void OnEvent(SpawnBunny evnt) { Transform transform = (UnityEngine.Object.Instantiate(Resources.Load <CoopRabbitReference>("CoopRabbitReference").Rabbit, evnt.Pos, Quaternion.identity) as GameObject).transform; if (!transform) { return; } if (transform) { transform.GetChild(0).eulerAngles = new Vector3(0f, (float)UnityEngine.Random.Range(0, 360), 0f); } if (transform) { transform.SendMessage("startUpdateSpawn"); } AnimalSpawnController.AttachAnimalToNetwork(null, null, transform.gameObject); }
private void SpawnOneAnimalForZoneOfType(AnimalSpawnZone zone, AnimalSpawnConfig spawn, Transform basePos) { if (spawn.nocturnal && !Clock.Dark) { return; } float sendDir; if (spawn.largeAnimalType) { sendDir = -1f; } else { sendDir = 1f; } Vector3 pos; if (AnimalSpawnController.TryFindSpawnPosition(basePos, sendDir, out pos)) { Transform transform = PoolManager.Pools["creatures"].Spawn(spawn.Prefab.transform, pos, zone.transform.rotation); if (!transform) { return; } if (transform) { transform.GetChild(0).eulerAngles = new Vector3(0f, (float)UnityEngine.Random.Range(0, 360), 0f); } if (transform) { transform.SendMessage("startUpdateSpawn"); } if (transform) { transform.SendMessage("setSnowType", zone.snowType, SendMessageOptions.DontRequireReceiver); } zone.SpawnedAnimals.Add(transform.gameObject); AnimalSpawnController.AttachAnimalToNetwork(zone, spawn, transform.gameObject); } }