// Update is called once per frame void Update() { if (BindableInput.BindDown("Close Menus")) { if (!isPaused) { CloseAllMenus(); } } if (BindableInput.BindDown("Pause")) { if (activeMenus.Count > 0) { CloseAllMenus(); } else { if (!isPaused) { openedPauseMenu = Instantiate(pauseMenu); Time.timeScale = 0; isPaused = true; } else { Destroy(openedPauseMenu.gameObject); Time.timeScale = 1; isPaused = false; } } } }
public void UpdateBindText() { spell1Bind.text = BindableInput.GetBindString("Spell 1"); spell2Bind.text = BindableInput.GetBindString("Spell 2"); spell3Bind.text = BindableInput.GetBindString("Spell 3"); spell4Bind.text = BindableInput.GetBindString("Spell 4"); spell5Bind.text = BindableInput.GetBindString("Spell 5"); }
void Update() { if (BindableInput.BindDown("Force Stop")) { isMoving = false; forceStop = true; } if (BindableInput.BindUp("Force Stop")) { forceStop = false; } if (!eventSystem.IsPointerOverGameObject()) { if (Input.GetKeyDown(KeyCode.Mouse0)) { RaycastHit hit; Ray ray = playerCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, int.MaxValue, enemyMask)) { inCombatMove = true; targettedEnemy = hit.collider.gameObject; timeClickedOnEnemy = Time.time; Vector3 look = hit.point; look.y = transform.position.y; transform.rotation = Quaternion.LookRotation(look - transform.position); } else if (Physics.Raycast(ray, out hit, int.MaxValue, environmentMask)) { isMoving = true; inCombatMove = false; targettedEnemy = null; timeClickedOnEnemy = 0; ParticleSystem newClickEffect = Instantiate(clickEffect); newClickEffect.transform.position = hit.point; Destroy(newClickEffect.gameObject, newClickEffect.main.duration * 5); } } if (!inCombatMove && Input.GetKey(KeyCode.Mouse0)) { RaycastHit hit; Ray ray = playerCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, int.MaxValue, environmentMask)) { Vector3 nextMove = hit.point; nextMove.y += halfHeight; moveToPosition = nextMove; Vector3 look = moveToPosition; look.y = transform.position.y; transform.rotation = Quaternion.LookRotation(look - transform.position); } } } }
// Update is called once per frame void Update() { if (isReady) { GetComponent <Canvas>().enabled = true; ShowStats(); if (stats.CanReset()) { resetObject.SetActive(true); } else { resetObject.SetActive(false); } if (BindableInput.BindDown("Character")) { Destroy(this.gameObject); } } }
public void BUTTON_Defaults() { BindableInput.LoadDefaultBinds(); }
// Update is called once per frame void Update() { if (!GameVariables.isPaused) { if (Input.GetButton("Mouse PlayerMove") && playerController.ForceStop) { CastSpell(PlayerSpells.SpellSlots.LMB); } else if (playerController.inCombatMove && playerController.targettedEnemy) { Spell leftMouseSpell = playerController.spells.GetSelectedSpell(PlayerSpells.SpellSlots.LMB); Vector3 enemyLocation = playerController.targettedEnemy.transform.position; if ((gameObject.transform.position - enemyLocation).magnitude <= leftMouseSpell.range) { CastSpell(PlayerSpells.SpellSlots.LMB); } else { playerController.MovePlayer(playerController.targettedEnemy.transform.position); } } else if (playerController.inCombatMove) { playerController.targettedEnemy = null; } if (BindableInput.BindDown("Spell 1")) { TurnToKeybindPush(); CastSpell(PlayerSpells.SpellSlots.Slot1); } else if (BindableInput.BindDown("Spell 2")) { TurnToKeybindPush(); CastSpell(PlayerSpells.SpellSlots.Slot2); } else if (BindableInput.BindDown("Spell 3")) { TurnToKeybindPush(); CastSpell(PlayerSpells.SpellSlots.Slot3); } else if (BindableInput.BindDown("Spell 4")) { TurnToKeybindPush(); CastSpell(PlayerSpells.SpellSlots.Slot4); } else if (BindableInput.BindDown("Spell 5")) { TurnToKeybindPush(); CastSpell(PlayerSpells.SpellSlots.Slot5); } else if (Input.GetMouseButton(1)) { TurnToKeybindPush(); CastSpell(PlayerSpells.SpellSlots.RMB); } if (currentGCD != 0) { currentGCD -= Time.deltaTime; if (currentGCD < 0) { currentGCD = 0; } } } }
void Update() { if (!GameVariables.isPaused) { if (BindableInput.BindDown("Spell 1", true)) { spell1.image.color = spell1.colors.pressedColor; } else { spell1.image.color = spell1.colors.normalColor; } if (BindableInput.BindDown("Spell 2", true)) { spell2.image.color = spell2.colors.pressedColor; } else { spell2.image.color = spell2.colors.normalColor; } if (BindableInput.BindDown("Spell 3", true)) { spell3.image.color = spell3.colors.pressedColor; } else { spell3.image.color = spell3.colors.normalColor; } if (BindableInput.BindDown("Spell 4", true)) { spell4.image.color = spell4.colors.pressedColor; } else { spell4.image.color = spell4.colors.normalColor; } if (BindableInput.BindDown("Spell 5", true)) { spell5.image.color = spell5.colors.pressedColor; } else { spell5.image.color = spell5.colors.normalColor; } if (Input.GetButton("Mouse PlayerMove") && playerController.ForceStop || playerController.targettedEnemy) { spellL.image.color = spellL.colors.pressedColor; } else { spellL.image.color = spellL.colors.normalColor; } if (Input.GetMouseButton(1)) { spellR.image.color = spellR.colors.pressedColor; } else { spellR.image.color = spellR.colors.normalColor; } if (BindableInput.BindDown("Character")) { Canvas createdCanvas = FindObjectOfType <GameVariables>().CreateMenu(GameVariables.MENU_TYPES.Character); if (createdCanvas) { createdCanvas.GetComponent <CharScreenStats>().Begin(player); } } if (Time.deltaTime > 0) { fpsArray.Enqueue((int)(1 / Time.deltaTime)); if (fpsArray.Count == 100) { int avgFPS = 0; foreach (int fps in fpsArray) { avgFPS += fps; } avgFPS /= 100; FPS.text = "FPS: " + avgFPS.ToString(); fpsArray.Clear(); } } } }
void Awake() { instance = this; LoadBinds(); }
void RefreshDisplay() { primaryBind.GetComponentInChildren <Text>().text = BindableInput.GetBindString(nameText.text); altBind.GetComponentInChildren <Text>().text = BindableInput.GetAltBindString(nameText.text); }
IEnumerator SetKeybind(bool isAltBind) { FindObjectOfType <KeybindWarningScript>().ToggleText(); bool isDone = false; while (true) { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKey(vKey)) { FindObjectOfType <KeybindWarningScript>().ToggleText(); if (BindableInput.KeyAlreadyBound(vKey, nameText.text)) { KeyAlreadyBound_Script.STATUS status; Canvas menu = FindObjectOfType <GameVariables>().CreateMenu(GameVariables.MENU_TYPES.KeyAlreadyBound); menu.GetComponent <KeyAlreadyBound_Script>().Bind = BindableInput.GetBindName(vKey); do { status = menu.GetComponent <KeyAlreadyBound_Script>().GetCurrentStatus(); if (status == KeyAlreadyBound_Script.STATUS.Waiting) { yield return(new WaitForEndOfFrame()); } } while (status == KeyAlreadyBound_Script.STATUS.Waiting); if (status == KeyAlreadyBound_Script.STATUS.Break) { isDone = true; break; } } isDone = true; if (vKey == KeyCode.Escape || vKey == KeyCode.Mouse0 || vKey == KeyCode.Mouse1) { break; } if (!isAltBind) { if (vKey == KeyCode.Backspace) { BindableInput.UpdatePrimaryBind(nameText.text, KeyCode.None); } else { BindableInput.UpdatePrimaryBind(nameText.text, vKey); } } else { if (vKey == KeyCode.Backspace) { BindableInput.UpdateAltBind(nameText.text, KeyCode.None); } else { BindableInput.UpdateAltBind(nameText.text, vKey); } } isDone = true; break; } } if (isDone) { break; } yield return(new WaitForEndOfFrame()); } }