Example #1
0
        // Update is called once per frame
        void Update()
        {
            Tekst.text = persistentScript.PlayerHealth.ToString();
            CalcHealth();
            followMouse();

            if (rg2d.velocity != Vector2.zero)
            {
                rg2d.velocity = Vector2.zero;
            }
            if ((Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) && !DisableW)
            {
                moveUp();
            }
            else if ((Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) && DisableW)
            {
                DialogueManager.DialogueTalk(1, 0);
            }


            if ((Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) && !DisableS)
            {
                moveDown();
            }
            else if ((Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) && DisableS)
            {
                DialogueManager.DialogueTalk(2, 0);
            }


            if ((Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) && !DisableA)
            {
                moveLeft();
            }
            else if ((Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) && DisableA)
            {
                DialogueManager.DialogueTalk(3, 0);
            }



            if ((Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) && !DisableD)
            {
                moveRight();
            }
            else if ((Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) && DisableD)
            {
                DialogueManager.DialogueTalk(4, 0);
            }

            if (Input.GetKeyDown(KeyCode.E))
            {
                ChangeWeapon();
            }
        }