コード例 #1
0
ファイル: World.cs プロジェクト: RaymondEllis/ViralCubers
		private void dropForth(Cuber cuber, Quaternion rotation, Vector3 position)
		{
			Fourth f = fourths.Pull();
			f.transform.position = cuber.transform.position + position;
			f.transform.rotation = cuber.transform.rotation * rotation;
			//f.Rigidbody.AddForceAtPosition(Vector3.up * 2f, cuber.transform.position, ForceMode.Impulse);

			f.Init();
			//if (cuber.Infected)
			//	f.Init(Color.white);
			//else
			//	f.Init(cuber.Mesh.material.color);
		}
コード例 #2
0
ファイル: World.cs プロジェクト: RaymondEllis/ViralCubers
		// kill a cuber and spawn fourths
		public void Kill(Cuber cuber)
		{
			cuber.gameObject.SetActive(false);

			if (!cuber.Infected)
			{
				// bottom
				dropForth(cuber, Quaternion.Euler(0, 0, 0), new Vector3(0f, 0f, 0f));
				dropForth(cuber, Quaternion.Euler(0, 180, 0), new Vector3(0f, 0f, 0f));
			}

			// top
			dropForth(cuber, Quaternion.Euler(180, 0, 0), new Vector3(0f, 1f, 0f));
			dropForth(cuber, Quaternion.Euler(180, 180, 0), new Vector3(0f, 1f, 0f));

			// drop any fourths cuber was carrying.
			if (cuber.Fourths > 0)
				dropForth(cuber, Quaternion.Euler(0, 0, 0), new Vector3(0f, 2f, 0f));
			if (cuber.Fourths > 1)
				dropForth(cuber, Quaternion.Euler(0, 180, 0), new Vector3(0f, 2f, 0f));
			if (cuber.Fourths > 2)
				dropForth(cuber, Quaternion.Euler(180, 0, 0), new Vector3(0f, 3f, 0f));
			if (cuber.Fourths > 3)
				dropForth(cuber, Quaternion.Euler(180, 180, 0), new Vector3(0f, 3f, 0f));

		}