Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (delayedStart)
        {
            DelayedStart();
            delayedStart = false;
        }

        Engine.ClearDelayedRotateSprites();

        GlobalMembers.anyKeyDown = Input.anyKeyDown;

        if (Input.GetKey(KeyCode.LeftShift))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_LeftShift)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_LeftShift)] = false;
        }


        if (Input.GetKeyDown(KeyCode.Escape))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_Escape)] = true;
        }
        else if (Input.GetKeyUp(KeyCode.Escape))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_Escape)] = false;
        }

        if (Input.GetKey(KeyCode.Return))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_Return)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_Return)] = false;
        }

        if (Input.GetKey(KeyCode.LeftBracket))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_OpenBracket)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_OpenBracket)] = false;
        }

        if (Input.GetKey(KeyCode.RightBracket))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_CloseBracket)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_CloseBracket)] = false;
        }

        if (Input.GetKey(KeyCode.UpArrow))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_UpArrow)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_UpArrow)] = false;
        }

        if (Input.GetKey(KeyCode.DownArrow))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_DownArrow)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_DownArrow)] = false;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_LeftArrow)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_LeftArrow)] = false;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_RightArrow)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_RightArrow)] = false;
        }

        if (Input.GetKey(KeyCode.Space))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_Space)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_Space)] = false;
        }


        if (Input.GetKey(KeyCode.C))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_C)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_C)] = false;
        }

        if (Input.GetKey(KeyCode.LeftControl))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_LeftControl)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_LeftControl)] = false;
        }

        if (Input.GetKey(KeyCode.E))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_E)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_E)] = false;
        }

        if (Input.GetKey(KeyCode.R))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_R)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_R)] = false;
        }

        if (Input.GetKey(KeyCode.T))
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_T)] = true;
        }
        else
        {
            GlobalMembers.KB_KeyDown[(DefineConstants.sc_T)] = false;
        }

        for (int i = 0; i <= 9; i++)
        {
            if (Input.GetKey(KeyCode.Alpha0 + i))
            {
                GlobalMembers.KB_KeyDown[(DefineConstants.sc_0 + i)] = true;
            }
            else
            {
                GlobalMembers.KB_KeyDown[(DefineConstants.sc_0 + i)] = false;
            }
        }


        if (GlobalMembers.totalclock == 0)
        {
            dukeClock = 1.0f;
            GlobalMembers.totalclock = 1;
        }
        else
        {
            dukeClock += Time.deltaTime;
            GlobalMembers.totalclock = (int)(dukeClock * 120.0f);
        }

        GlobalMembers.RunState();

        GlobalMembers.faketimerhandler();

        if (Engine.board != null && Engine.board.render3D != null)
        {
            Engine.board.render3D.DisplayRoom(Engine.board.globalcursectnum);
        }


        // IntPtr pointer = handle.AddrOfPinnedObject();
        // _texture.LoadRawTextureData(pointer, Engine._device._screenbuffer._width * Engine._device._screenbuffer._height * 4);
        // _texture.Apply();

        //  Array.Clear(Engine._device._screenbuffer.Pixels, 0, Engine._device._screenbuffer.Pixels.Length);
    }