예제 #1
0
	public void RegisterInsertion (MovementRegistrationEntry data) {
		// TODO: will have mismatch when 2 balls hit same chain ball
		if (balls.Contains (data.chainBall)) {
			if (hitChainBallTable.ContainsKey(data.chainBall)) {
				data.repeatChainBall = hitChainBallTable[data.chainBall] + 1;
				hitChainBallTable[data.chainBall] = data.repeatChainBall;
			}
			else {
				data.repeatChainBall = 1;
				hitChainBallTable.Add (data.chainBall, 1);
			}

			if (brokenChainNodeSet.Contains(data.chainBall)) {
				brokenChainNodeSet.Remove(data.chainBall);
				brokenChainNodeSet.Add (data.bulletBall);
				brokenChainNodeDirty = true;
			}
			insertionQueue.Enqueue (data);
		}
		else {
			Debug.Log ("Ball Hit Chain Ball Being Deleted");
		}
	}
예제 #2
0
파일: BulletBall.cs 프로젝트: oocast/Zuagon
	void OnCollisionEnter (Collision collision) {
		// if the collision object has BallChainMovement
		// then it is in the chain
		BallChainMovement ballChainMovement = collision.gameObject
			.GetComponent<BallChainMovement>();

		if (ballChainMovement != null && !registered && GetComponent<Rigidbody> ().isKinematic == false) {
			MovementRegistrationEntry entry = new MovementRegistrationEntry();
			entry.bulletBall = gameObject;
			entry.chainBall = collision.gameObject;
			entry.proceedTime = 0f;
			entry.registerFrame = Time.frameCount;
			entry.repeatChainBall = 0;
			chainMovement.RegisterInsertion (entry);
			registered = true;

			GetComponent<Rigidbody> ().isKinematic = true;
			GetComponent<Rigidbody> ().velocity = Vector3.zero;
		}
		else if (ballChainMovement == null && !registered){
			collisionCount++;
		}
	}