コード例 #1
0
        // Update is called once per frame
        void Update()
        {
            time += Time.deltaTime;

            if (flag) {
                StartCoroutine(Delay());
            }

            if (!speedUpFlag) {
                StartCoroutine(SpeedUpDelay());
            }

            if (!speedDownFlag) {
                StartCoroutine(SpeedDownDelay());
            }

            if (speedReturnFlag) {
                StartCoroutine(SpeedReturnDelay());
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if(cManager)
                {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(1,-1);
                cManager.Send (rk);
                }

            }

            if (Input.GetKeyDown(KeyCode.RightArrow))
            {

                if(cManager)
                {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(1,1);
                cManager.Send (rk);
                }

            }

            if (Input.GetKeyDown(KeyCode.Space))
            {

                if(cManager)
                {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(2,1);
                cManager.Send (rk);
                }

            }

            if (Input.GetKeyUp(KeyCode.LeftArrow) && cManager)
            {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(1,0);
                cManager.Send (rk);
            }

            if (Input.GetKeyUp(KeyCode.RightArrow) &&cManager)
            {

                RequestKeyboard rk = new RequestKeyboard();
                rk.send(1,0);
                cManager.Send (rk);

            }

            if (Input.GetKeyUp(KeyCode.Space) && cManager)
            {

                RequestKeyboard rk = new RequestKeyboard();
                rk.send(2,0);
                cManager.Send (rk);

            }
            if (!called) {
                mainObject.GetComponent<MessageQueue>().AddCallback(Constants.SMSG_RRENDGAME, ResponseRREndGame);
                //Debug.Log ("Running.cs :::::::::: Start");
                called = true;
            }
        }
コード例 #2
0
ファイル: Running.cs プロジェクト: pbroestl/unity-game-client
        // Update is called once per frame
        void Update()
        {
            time += Time.deltaTime;

            if (flag)
            {
                StartCoroutine(Delay());
            }

            if (!speedUpFlag)
            {
                StartCoroutine(SpeedUpDelay());
            }

            if (!speedDownFlag)
            {
                StartCoroutine(SpeedDownDelay());
            }

            if (speedReturnFlag)
            {
                StartCoroutine(SpeedReturnDelay());
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if (cManager)
                {
                    RequestKeyboard rk = new RequestKeyboard();
                    rk.send(1, -1);
                    cManager.Send(rk);
                }
            }

            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                if (cManager)
                {
                    RequestKeyboard rk = new RequestKeyboard();
                    rk.send(1, 1);
                    cManager.Send(rk);
                }
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (cManager)
                {
                    RequestKeyboard rk = new RequestKeyboard();
                    rk.send(2, 1);
                    cManager.Send(rk);
                }
            }

            if (Input.GetKeyUp(KeyCode.LeftArrow) && cManager)
            {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(1, 0);
                cManager.Send(rk);
            }

            if (Input.GetKeyUp(KeyCode.RightArrow) && cManager)
            {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(1, 0);
                cManager.Send(rk);
            }

            if (Input.GetKeyUp(KeyCode.Space) && cManager)
            {
                RequestKeyboard rk = new RequestKeyboard();
                rk.send(2, 0);
                cManager.Send(rk);
            }
            if (!called)
            {
                RRMessageQueue.getInstance().AddCallback(Constants.SMSG_RRENDGAME, ResponseRREndGame);
                called = true;
            }
        }