Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Break()
- {
- Debug.Log("Count to break : " + _humanInTower.Count);
- for(int i = 0; i < _humanInTower.Count; i++)
- {
- Transform t = _humanInTower[i].transform;
- int sign = (i % 2 == 0) ? -1 : 1;
- Vector3 forceDir = (t.right * Random.Range(1, 10) * sign + t.forward + t.up * 0.5f).normalized;
- t.parent = null;
- Rigidbody rb = t.gameObject.AddComponent<Rigidbody>();
- rb.isKinematic = false;
- rb.AddForce(forceDir * 500);
- }
- Destroy(gameObject, 3f);
- //Destroy(gameObject);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement