Exemplo n.º 1
0
        void GetInput()                 //gets input to be used in the manageInput function, subject to be removed once a input manager is implemeted
        {
            float horzInput = Input.GetAxis("Horizontal");


            if (Mathf.Abs(horzInput) > 0.15f)
            {
                if (horzInput > 0)
                {
                    playerDirection = 1f;
                    if (lastDir != 1f)
                    {
                        transform.rotation = Quaternion.Euler(new Vector3(0, transform.rotation.eulerAngles.y * -1, 0));
                    }
                    lastDir = 1f;
                }
                if (horzInput < 0)
                {
                    playerDirection = -1f;
                    if (lastDir != -1f)
                    {
                        transform.rotation = Quaternion.Euler(new Vector3(0, transform.rotation.eulerAngles.y * -1, 0));
                    }
                    lastDir = -1f;
                }
            }
            else
            {
                playerDirection = 0f;
            }


            //if ((Input.GetKeyDown(KeyCode.Space))
            if (Input.GetButtonDown("Fire1"))
            {
                _movement.JumpPlayer(playerDirection);
                jumping = true;
            }
            else
            {
                jumping = false;
            }

            //if (Input.GetKeyDown (KeyCode.LeftShift)) {
            if (Input.GetButtonDown("Fire2"))
            {
                dashing = true;
                _movement.DashPlayer();
            }
            else
            {
                dashing = false;
            }

            if (Input.GetButtonDown("Fire3"))
            {
                _slash.SlashAttack(lastDir);
            }
        }
Exemplo n.º 2
0
        void GetInput() //gets input to be used in the manageInput function, subject to be removed once a input manager is implemeted
        {
            float horzInput = Input.GetAxis("Horizontal");


            if (Mathf.Abs(horzInput) > 0.15f)
            {
                if (horzInput > 0)
                {
                    playerDirection = 1f;
                    lastDir         = 1f;
                }
                if (horzInput < 0)
                {
                    playerDirection = -1f;
                    lastDir         = -1f;
                }
            }
            else
            {
                playerDirection = 0f;
            }


            //if ((Input.GetKeyDown(KeyCode.Space))
            if (Input.GetButtonDown("Fire1"))
            {
                _movement.JumpPlayer(playerDirection);
            }

            //if (Input.GetKeyDown (KeyCode.LeftShift)) {
            if (Input.GetButtonDown("Fire2"))
            {
                _movement.DashPlayer();
            }

            if (Input.GetButtonDown("Fire3"))
            {
                _slash.SlashAttack(lastDir);
            }

            if (hitPoints <= 0)
            {
                Application.LoadLevel(Application.loadedLevel);
            }
        }