private void InitCapsulePrototype() { var capsule = GameObject.CreatePrimitive(PrimitiveType.Capsule); capsule.AddComponent<Rigidbody>(); capsule.GetComponent<Renderer>().material = greenMaterial; var capsuleBehaviour = capsule.AddComponent<GreenCapsule>(); capsuleBehaviour.health = 100; capsuleBehaviour.mana = 100.0f; // Deactivate prototype capsuleBehaviour.gameObject.SetActive(false); // Finally store counstructed object for cloning _greenCapsulePrototype = capsuleBehaviour; }
private void InitCapsulePrototype() { var capsule = GameObject.CreatePrimitive(PrimitiveType.Capsule); capsule.AddComponent <Rigidbody>(); capsule.GetComponent <Renderer>().material = greenMaterial; var capsuleBehaviour = capsule.AddComponent <GreenCapsule>(); capsuleBehaviour.health = 100; capsuleBehaviour.mana = 100.0f; // Deactivate prototype capsuleBehaviour.gameObject.SetActive(false); // Finally store counstructed object for cloning _greenCapsulePrototype = capsuleBehaviour; }