Ejemplo n.º 1
0
    void SendInput()
    {
        if (characterData.isLocalPlayer)
        {
            #region Left right

            if (Input.GetKeyDown(KeyCode.A))
            {
                if (NetWorkManager.gameStarted)
                {
                    io.Emit("Input", NetWorkManager.Input("LD"));
                }
            }

            if (Input.GetKeyDown(KeyCode.D))
            {
                if (NetWorkManager.gameStarted)
                {
                    io.Emit("Input", NetWorkManager.Input("RD"));
                }
            }

            if (Input.GetKeyUp(KeyCode.A))
            {
                if (NetWorkManager.gameStarted)
                {
                    io.Emit("Input", NetWorkManager.Input("LU"));
                }
            }

            if (Input.GetKeyUp(KeyCode.D))
            {
                if (NetWorkManager.gameStarted)
                {
                    io.Emit("Input", NetWorkManager.Input("RU"));
                }
            }

            #endregion

            #region jump

            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (NetWorkManager.gameStarted)
                {
                    io.Emit("Input", NetWorkManager.Input("SpaceD"));
                }
            }

            if (Input.GetKeyUp(KeyCode.Space))
            {
                if (NetWorkManager.gameStarted)
                {
                    io.Emit("Input", NetWorkManager.Input("SpaceU"));
                }
            }

            #endregion
        }
    }