public static void Reset() { Spawner.Reset(); BlockManager.Clear(); BlockArea.Reset(); score = 0; }
void Update() { // Input mapping for object grabbing. if (Input.GetKeyDown("space")) { if (collidingObject) { GrabObject(); } if (collidingBlockControl) { if (collidingBlockControl.name == "BlockSpawnMoveForward") { blockmanager.SpawnMoveForward(1); } else if (collidingBlockControl.name == "BlockSpawnTurnRight") { blockmanager.SpawnTurnRight(90); } else if (collidingBlockControl.name == "BlockSpawnTurnLeft") { blockmanager.SpawnTurnLeft(90); } else if (collidingBlockControl.name == "BlockDelete") { blockmanager.Clear(); } collidingBlockControl = null; } collidingBlockControl = null; } if (Input.GetKeyUp("space")) { if (objectInHand) { ReleaseObject(); } } // Input mapping for block creation if (Input.GetKeyDown("1")) { //Debug.Log("Up"); if (collidingObject) { } else { //Create a move forward motion block. blockmanager.SpawnMoveForward(1); } } else if (Input.GetKeyDown(KeyCode.Backspace)) { //Debug.Log("Down"); if (collidingObject) { if (collidingObject.name != "Green Flag Block") { Destroy(collidingObject); } } } else if (Input.GetKeyDown("2")) { //Debug.Log("Right"); if (collidingObject) { collidingObject.GetComponent <BlockInfo>().increment(); } else { blockmanager.SpawnTurnRight(90); } } else if (Input.GetKeyDown("3")) { //Debug.Log("Left"); if (collidingObject) { collidingObject.GetComponent <BlockInfo>().decrement(); } else { blockmanager.SpawnTurnLeft(90); } } //Alternate inputs for increasing and decreasing parameter values: else if (Input.GetKeyDown("=")) { if (collidingObject) { collidingObject.GetComponent <BlockInfo>().increment(); } } else if (Input.GetKeyDown("-")) { if (collidingObject) { collidingObject.GetComponent <BlockInfo>().decrement(); } } }
// Update is called once per frame void Update() { // 1 if (Controller.GetHairTriggerDown()) { if (collidingObject) { GrabObject(); } if (collidingBlockControl) { if (collidingBlockControl.name == "BlockSpawnMoveForward") { blockmanager.SpawnMoveForward(1); } else if (collidingBlockControl.name == "BlockSpawnTurnRight") { blockmanager.SpawnTurnRight(90); } else if (collidingBlockControl.name == "BlockSpawnTurnLeft") { blockmanager.SpawnTurnLeft(90); } else if (collidingBlockControl.name == "BlockDelete") { blockmanager.Clear(); } collidingBlockControl = null; } collidingBlockControl = null; } // 2 if (Controller.GetHairTriggerUp()) { if (objectInHand) { ReleaseObject(); } } if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { //Spawns Blocks Vector2 touchpad = Controller.GetAxis(); if (touchpad.y > 0.6f) { Debug.Log("Up"); if (collidingObject) { } else { //blockmanager.SpawnMoveForward(1); } } else if (touchpad.y < -0.6f) { Debug.Log("Down"); if (collidingObject) { if (collidingObject.name != "Green Flag Block") { Destroy(collidingObject); } } } else if (touchpad.x > 0.6f) { Debug.Log("Right"); if (collidingObject) { collidingObject.GetComponent <BlockInfo>().increment(); } else { //blockmanager.SpawnTurnRight(90); } } else if (touchpad.x < -0.6f) { Debug.Log("Left"); if (collidingObject) { collidingObject.GetComponent <BlockInfo>().decrement(); } else { //blockmanager.SpawnTurnLeft(90); } } } }