// Update is called once per frame void Update() { int fps = (int)(1.0f / Time.deltaTime); PrintFloat("FPS: ", fps); if (drawGizmos) { space.Draw(); } GameObject player = (GameObject)GameObject.FindGameObjectWithTag("Player"); if (player != null && cameraBoid != null) { //player.transform.position = cameraBoid.transform.position + Vector3.up * 5; //player.transform.forward = cameraBoid.transform.forward; } }
// Update is called once per frame void Update() { if (Input.GetButtonDown("X Button")) { Params.drawDebugLines = !Params.drawDebugLines; } if (Input.GetButtonDown("A Button")) { Params.camMode = (Params.camMode + 1) % 3; } if (Input.GetButtonDown("B Button")) { Params.cellSpacePartitioning = !Params.cellSpacePartitioning; } if (Input.GetButtonDown("Y Button")) { timeModIndex = (timeModIndex + 1) % timeModifiers.Length; } Params.timeModifier = timeModifiers[timeModIndex]; PrintMessage("Press F1 to toggle camera mode"); PrintMessage("Press F2 to adjust speed"); PrintMessage("Press F4 to toggle messages"); PrintMessage("Press F5 to toggle vector drawing"); PrintMessage("Press F6 to toggle debug drawing"); PrintMessage("Press F7 to level camera"); PrintMessage("Press F8 to toggle cell space partitioning"); PrintMessage("Press F9 to toggle non-penetration constraint"); PrintMessage("Press F10 to toggle Rift"); PrintMessage("Press F11 to toggle force drawing"); int fps = (int)(1.0f / Time.deltaTime); PrintFloat("FPS: ", fps); PrintMessage("Current scenario: " + currentScenario.Description()); for (int i = 0; i < scenarios.Count; i++) { PrintMessage("Press " + i + " for " + scenarios[i].Description()); } switch (Params.camMode) { case ((int)Params.camModes.following): currentScenario.leader.GetComponentInChildren <Renderer>().enabled = true; monoCamera.transform.position = camFighter.transform.position; if (!Params.riftEnabled) { monoCamera.transform.rotation = camFighter.transform.rotation; } break; case ((int)Params.camModes.boid): currentScenario.leader.GetComponentInChildren <Renderer>().enabled = false; monoCamera.transform.position = currentScenario.leader.transform.position; if (!Params.riftEnabled) { monoCamera.transform.rotation = currentScenario.leader.transform.rotation; } break; case ((int)Params.camModes.fps): currentScenario.leader.GetComponentInChildren <Renderer>().enabled = true; break; } if (Params.cellSpacePartitioning) { PrintMessage("Cell space partitioning on"); } else { PrintMessage("Cell space partitioning off"); } if (Params.enforceNonPenetrationConstraint) { PrintMessage("Enforce non penetration constraint on"); } else { PrintMessage("Enforce non penetration constraint off"); } if (Params.drawDebugLines && Params.cellSpacePartitioning) { space.Draw(); } currentScenario.Update(); }