GameStateBehaviour.DidAnimateClearingCups C# (CSharp) Méthode

DidAnimateClearingCups() private méthode

private DidAnimateClearingCups ( ) : bool
Résultat bool
	private bool DidAnimateClearingCups () {

		bool animatedAll = true;

		try {
			
			foreach (BeerPongCup hitCup in hitCups) {

				if (dictCup.ContainsKey (hitCup.cupNumber)) {
					AnimateClearingCup (hitCup);
				}

				Bounds tableBounds = TableModel.GetComponentInChildren<Renderer> ().bounds;

				if (tableBounds.max.y + hitCup.GetComponentInChildren<Renderer> ().bounds.size.y * 1.5f < 
					hitCup.GetComponentInChildren<Renderer> ().bounds.min.y && !threwCup) {

					Rigidbody cupRigidBody = hitCup.gameObject.GetComponentInChildren<Rigidbody> ();
					Vector3 xzPosition = Vector3.Scale (cupRigidBody.transform.position - tableBounds.center, new Vector3 (1, 0, 1));
					cupRigidBody.velocity += Physics.gravity.magnitude * 0.15f * xzPosition.normalized;
					cupRigidBody.angularVelocity = new Vector3 (Random.value, Random.value, Random.value) * 5f;
					threwCup = true;
				}

				if (tableBounds.max.y - tableLocalScale.y + hitCup.GetComponentInChildren<Renderer> ().bounds.size.y * 1.5f <
					hitCup.GetComponentInChildren<Renderer> ().bounds.min.y) {
				    
					if (Time.time - hitCup.hitTime < hitCupLifetime) {
				
						animatedAll = false;
					
					} else {
					
						Destroy (hitCup.gameObject);
					}
				}
			}
			
		} catch (System.Exception) {

			Debug.LogWarning ("Conflict in hitCup list");
			return true;
		}

		return animatedAll;
	}