public Creature GenerateCreature (BaseCreatures bodyCreature, BaseCreatures legsCreature, BaseCreatures armsCreature, BaseCreatures headCreature) { GameObject creatureObject = Instantiate(creaturePrefab); Creature creature = creatureObject.GetComponent<Creature>(); creatureObject.name = "Chimera"; // Creature parts creature.body = InstantiatePart(creatureObject, GetCreature(bodyCreature).body, creatureObject.transform.FindChild("Body")); creature.legs = InstantiatePart(creatureObject, GetCreature(legsCreature).legs, creatureObject.transform.FindChild("RightLeg")); creature.legs = InstantiatePart(creatureObject, GetCreature(legsCreature).legs, creatureObject.transform.FindChild("LeftLeg")); creature.arms = InstantiatePart(creatureObject, GetCreature(armsCreature).arms, creatureObject.transform.FindChild("Arms")); creature.head = InstantiatePart(creatureObject, GetCreature(headCreature).head, creatureObject.transform.FindChild("Head")); creature.GenerateStats(); audio.PlayAudio("Spawn"); switch (headCreature){ case BaseCreatures.TRex: audio.PlayAudio("TRex"); break; case BaseCreatures.Chicken: audio.PlayAudio("Chicken"); break; case BaseCreatures.Minotaure: audio.PlayAudio("Minotaure"); break; case BaseCreatures.Yeti: audio.PlayAudio("Yeti"); break; } return creature; }
public Creature GetCreature (BaseCreatures creatureType) { switch (creatureType){ case BaseCreatures.TRex: return this.tRex; case BaseCreatures.Chicken: return this.chicken; case BaseCreatures.Minotaure: return this.minotaure; case BaseCreatures.Yeti: return this.yeti; } throw new Exception("Creature does not exist"); }