public override void OnPrefabCreation() { Chicken = ChickenReferences.Locate(); polymorpher = gameObject.AddComponent <Polymorpher>(); polymorpher.Setup(this, Chicken); AddFire(); Poultryizer.SetupNetworking(); Polymorpher.SetupNetworking(); }
public static ChickenReferences Locate() { ChickenReferences chicken = new ChickenReferences(); chicken.prefab = PrefabMaster.Instance.transform.FindChild("OBJECTS/Prefabs/Animals/WhiteChickenV2").gameObject; chicken.AI = chicken.prefab.GetComponent <EntityAI>(); chicken.visPivot = chicken.prefab.transform.FindChild("Chicken"); chicken.vis = chicken.visPivot.GetChild(0); chicken.mesh = chicken.vis.GetComponent <MeshFilter>().mesh; MeshRenderer ren = chicken.vis.GetComponent <MeshRenderer>(); chicken.mat = ren.material; chicken.tex = ren.material.mainTexture; KillingHandler killer = chicken.prefab.GetComponent <KillingHandler>(); chicken.bloodCorpse = killer.my.GibPrefab; chicken.dustCorpse = killer.my.corpseDust; chicken.fireControl = killer.my.fireControl; chicken.sounds = killer.my.SoundController; return(chicken); }