Пример #1
0
    void Update()
    {
        bool isLeft = Input.GetKey(KeyCode.Mouse0);
        bool rKey   = Input.GetKeyDown(KeyCode.R);
        bool gKey   = Input.GetKeyDown(KeyCode.G);

        bool isB        = WiiMote.wiimote_getButtonB(Configuration.pointerWiiMote);
        bool isA        = WiiMote.wiimote_getButtonA(Configuration.pointerWiiMote);
        bool isBtnLeft  = WiiMote.wiimote_getButtonLeft(Configuration.pointerWiiMote);
        bool isBtnRight = WiiMote.wiimote_getButtonRight(Configuration.pointerWiiMote);

        oldPos = this.transform.position;
        Vector3 newPos = originalPos + receivedPos;

        if (newPos.x > 13 || newPos.x < -11f)
        {
            newPos.x = oldPos.x;
        }

        newPos.y += 1;

        if (newPos.y < 0.5f)
        {
            newPos.y += 0.5f - newPos.y;
        }

        if (newPos.z > 82 || newPos.z < 42)
        {
            newPos.z = oldPos.z;
        }

        this.transform.position = newPos;

        if (imageEffectActive)
        {
            checkCameraDistort();
        }

        if (isLeft || isB)
        {
            weapon.shoot();
        }

        if (rKey || isA)
        {
            reloadWeapon();
        }

        if (gKey || isBtnLeft || isBtnRight)
        {
            cambioArma();
        }
    }