IEnumerator characterDeath() { Debug.Log("Reloading scene after a few seconds..."); UGen.normalSpeed(); yield return(new WaitForSeconds(5.0f)); SceneManager.LoadScene(0); }
public void controlInterface(ButtonPresses btns) { // move camera this.transform.position += UGen.getTop(player) - playerLastLoc; this.transform.RotateAround(UGen.getTop(player), player.transform.up, 10.0f * btns.camHori); this.transform.RotateAround(UGen.getTop(player), this.transform.right, 10.0f * btns.camVert); // story player's new location playerLastLoc = UGen.getTop(player); }
/// <summary> /// Start or continue interaction with an object. /// </summary> /// <param name="interact">True if interact button has been pressed.</param> public void Interact(bool interact) { if (interact) { GameObject obj; GameObject objDia; GameObject objInt; UGen.PseudoTransform charTrans = UGen.setPseudo(this.gameObject.transform); float score; if (!m_Interacting) { // get an object each of NPC and TOUCH_OBJECT type objDia = UChar.actOnLayer(this.gameObject, (int)UGen.eLayerMask.NPC, 45.0f, 3.0f); objInt = UChar.actOnLayer(this.gameObject, (int)UGen.eLayerMask.TOUCH_OBJECT, 45.0f, 1.0f); // compare to see which is the likely target if (objDia != null) { // if objDia is not null if (objInt != null) { // and objInt is not null, compare target scores score = UChar.aimCenterScore(charTrans, objDia.GetComponent <Collider>()); if (UChar.aimCenterScore(charTrans, objInt.GetComponent <Collider>()) > score) // if interaction object is higher, set it as the object { obj = objInt; } else // dialogue object had higher score; set it as the object { obj = objDia; } } else // no interactable object nearby. set NPC as the object { obj = objDia; } } else // objDia is null. set interactable object as the object { obj = objInt; } } else // already interacting with an object { obj = obj_Interact; } if (obj != null) { obj.SendMessage("handleInteraction", this.gameObject); } } }
private void Start() { // set up appropriate references ControlManager.cam = this; // pass reference to self over to Control Manager player = ControlManager.controls.gameObject; // get reference to player // initialize camera location this.transform.position = UGen.getTop(player) - new Vector3(2.0f, 0.0f); this.transform.LookAt(UGen.getTop(player)); // initialize player's last location playerLastLoc = UGen.getTop(player); }
public void PauseButton(ButtonPresses btns) { // pause or unpause if (btns.pause) { if (UGen.isPaused()) { UGen.resume(); } else { UGen.pause(); } } }
public void exitMenu() { HUD.hud.MenuBG.enabled = false; UGen.resume(); }
public void initMenu() { UGen.pause(); HUD.hud.MenuBG.enabled = true; }
// Get Input Information and Deal with Menus private void Update() { // Joysticks buttons.hori = Input.GetAxis("Horizontal"); buttons.vert = Input.GetAxis("Vertical"); buttons.camHori = Input.GetAxis("CamHori"); buttons.camVert = Input.GetAxis("CamVert"); // Buttons if (Input.GetButtonDown("Jump")) { buttons.jump = true; } if (Input.GetButtonDown("Crouch")) { buttons.crouch = true; } if (Input.GetButtonDown("Dodge")) { buttons.dodge = true; } if (Input.GetButtonDown("Interact")) { buttons.interact = true; } if (Input.GetButtonDown("AttackWeak")) { buttons.atkWeak = true; } if (Input.GetAxis("AttackStrong") > 0.5f) { buttons.atkStrong = true; } if (Input.GetAxis("Block") > 0.5f || Input.GetButton("Block")) { buttons.block = true; } else { buttons.block = false; } if (Input.GetAxis("Items13") < -0.5f) { buttons.item1 = true; buttons.item3 = false; } else if (Input.GetAxis("Items13") > 0.5f) { buttons.item1 = false; buttons.item3 = true; } if (Input.GetAxis("Items24") > 0.5f) { buttons.item2 = true; buttons.item4 = false; } else if (Input.GetAxis("Items24") < -0.5f) { buttons.item2 = false; buttons.item4 = true; } if (Input.GetButtonDown("QuickMenu")) { buttons.qMenu = true; } if (Input.GetButtonDown("LockOn")) { buttons.lockOn = true; } if (Input.GetButtonDown("Pause")) { buttons.pause = true; } if (Input.GetButtonDown("ShowMap")) { buttons.showMap = true; } if (Input.GetButtonDown("Walk")) { buttons.walk = true; } else { buttons.walk = false; } // Menus // If paused, run pause controls if (UGen.isPaused()) { pauseMenu.controlInterface(buttons); buttons.setPresses(false); } else // If not paused // If in quick menu, run quick menu controls { if (quickMenu.isOpen()) { quickMenu.controlInterface(buttons); buttons.setPresses(false); } else if (buttons.qMenu) // If not in quick menu, check the quick menu button { quickMenu.initMenu(); buttons.setPresses(false); } // If pause button has been pressed, pause the game if (buttons.pause) { pauseMenu.initMenu(); buttons.setPresses(false); } // Not in any menus, control camera cam.controlInterface(buttons); } }
public void exitMenu() { bInQuickMenu = false; UGen.setSpeed(prevSpeed); }
public void initMenu() { bInQuickMenu = true; prevSpeed = Time.timeScale; UGen.setSpeed(prevSpeed * qSpeed); }