void MakeInstance() { if (instance == null) { instance = this; } }
public void Die(GameObject other) { AnimControlScript.SetRigidbodyState(false); AnimControlScript.SetColliderState(true); Rigidbody[] rigidbodys = gameObject.GetComponentsInChildren <Rigidbody>(); int random = Random.Range(0, rigidbodys.Length); int force = Random.Range(minForceOnDeath, maxForceOnDeath); forceX = force; Vector3 backward = Quaternion.identity * Vector3.forward; rigidbodys[random].AddForce((transform.position + backward) * force, ForceMode.Impulse); other.GetComponent <AnimationController>().SetRigidbodyState(true); UIManagerScript.WinScreen(other); }