Esempio n. 1
0
 // 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;
             }
         }
     }
 }
Esempio n. 2
0
 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");
 }
Esempio n. 3
0
    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);
                }
            }
        }
    }
Esempio n. 4
0
 // 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);
         }
     }
 }
Esempio n. 5
0
 public void BUTTON_Defaults()
 {
     BindableInput.LoadDefaultBinds();
 }
Esempio n. 6
0
    // 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;
                }
            }
        }
    }
Esempio n. 7
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();
                }
            }
        }
    }
Esempio n. 8
0
 void Awake()
 {
     instance = this;
     LoadBinds();
 }
Esempio n. 9
0
 void RefreshDisplay()
 {
     primaryBind.GetComponentInChildren <Text>().text = BindableInput.GetBindString(nameText.text);
     altBind.GetComponentInChildren <Text>().text     = BindableInput.GetAltBindString(nameText.text);
 }
Esempio n. 10
0
    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());
        }
    }