コード例 #1
0
    bool isPaperHeld = false; // if true, locks the input to put it down on next L click

    public void OnStart()
    {
        Input.SetMouseVisible(false);
        Input.SetMouseLock(true);

        playerScript           = GetScript <FirstPersonPlayer>(Common.GetStealthPlayer());
        rcCarScript            = GetScript <RCCar>(Common.GetRCCarJoystick());
        cameraCam              = Common.GetSurveillancePlayerStaticCameraCam();
        camScript              = GetScript <CameraCam>(cameraCam);
        ocuCam                 = Common.GetSurveillancePlayerCam();
        prevPickedInteractable = null;
        pickedInteractable     = null;
        prevPickedObject       = null;
        pickedObject           = null;

        camInMapIndex = 0;
        camInMap      = Common.GetCamsInMap();

        mCurrMouseMovement       = new Vector2(0.0f, 0.0f);
        mMousePositionFromOcuCam = new Vector3(0.0f, 0.0f, 1.3f);
        // Set the mouse cursor position to center of oculus screen
        gameObject.transform.SetPosition(ocuCam.transform.position +
                                         (Vector3)ocuCam.transform.GetForwardVector() * mMousePositionFromOcuCam.Z);

        // Calculate the limits for the mouse on the ocuScreen
        CCamera ocuCameraComp = ocuCam.RequireComponent <CCamera>();

        mMouseLimits   = new Vector2();
        mMouseLimits.X = mMousePositionFromOcuCam.Z / ocuCameraComp.GetNearZ() * ocuCameraComp.GetNearWindowWidth() * 0.5f;
        mMouseLimits.Y = mMousePositionFromOcuCam.Z / ocuCameraComp.GetNearZ() * ocuCameraComp.GetNearWindowHeight() * 0.5f;

        ocuCameraScreen = Common.GetCameraScreen().RequireComponent <CCamera>();
    }
コード例 #2
0
    public void OnStart()
    {
        Input.SetMouseVisible(false);
        Input.SetMouseLock(true);

        playerScript = GetScript<FirstPersonPlayer>(Common.GetStealthPlayer());
        rcCarScript = GetScript<RCCar>(Common.GetRCCarJoystick());
        cameraCam = Common.GetSurveillancePlayerStaticCameraCam();
        camScript = GetScript<CameraCam>(cameraCam);
        ocuCam = Common.GetSurveillancePlayerCam();
        prevPickedInteractable = null;
        pickedInteractable = null;
        prevPickedObject = null;
        pickedObject = null;

        camInMapIndex = 0;
        camInMap = Common.GetCamsInMap();

        mCurrMouseMovement = new Vector2(0.0f, 0.0f);
        mMousePositionFromOcuCam = new Vector3(0.0f, 0.0f, 1.3f);
        // Set the mouse cursor position to center of oculus screen
        gameObject.transform.SetPosition(ocuCam.transform.position +
            (Vector3)ocuCam.transform.GetForwardVector() * mMousePositionFromOcuCam.Z);

        // Calculate the limits for the mouse on the ocuScreen
        CCamera ocuCameraComp = ocuCam.RequireComponent<CCamera>();
        mMouseLimits = new Vector2();
        mMouseLimits.X = mMousePositionFromOcuCam.Z / ocuCameraComp.GetNearZ() * ocuCameraComp.GetNearWindowWidth() * 0.5f;
        mMouseLimits.Y = mMousePositionFromOcuCam.Z / ocuCameraComp.GetNearZ() * ocuCameraComp.GetNearWindowHeight() * 0.5f;

        ocuCameraScreen = Common.GetCameraScreen().RequireComponent<CCamera>();
    }
コード例 #3
0
 public RCControlBolt(float xval, float yval, RCCar c)
     : base(xval, yval)
 {
     this._control = c;
     this.graphic  = new Sprite("rcBolt");
     this.center   = new Vec2(8f, 8f);
     this.scale    = new Vec2(0.3f, 0.3f);
     this.alpha    = 1f;
 }
コード例 #4
0
 public RCController(float xval, float yval, RCCar car)
     : base(xval, yval)
 {
     this.ammo               = 99;
     this._ammoType          = (AmmoType) new ATLaser();
     this._ammoType.range    = 170f;
     this._ammoType.accuracy = 0.8f;
     this._type              = "gun";
     this._sprite            = new SpriteMap("rcController", 32, 32);
     this.graphic            = (Sprite)this._sprite;
     this.center             = new Vec2(16f, 16f);
     this.collisionOffset    = new Vec2(-6f, -4f);
     this.collisionSize      = new Vec2(12f, 9f);
     this._barrelOffsetTL    = new Vec2(26f, 14f);
     this._fireSound         = "smg";
     this._fullAuto          = true;
     this._fireWait          = 1f;
     this._kickForce         = 1f;
     this.flammable          = 0.8f;
     this._car               = car;
 }
コード例 #5
0
 public override void Update()
 {
     if (this._car == null && !(Level.current is Editor) && this.isServerForObject)
     {
         this._car = new RCCar(this.x, this.y);
         Level.Add((Thing)this._car);
     }
     ++this._inc;
     if (this._inc > 14 && this._car != null)
     {
         this._inc = 0;
         if (this._car.receivingSignal && !this._car.destroyed)
         {
             Level.Add((Thing) new RCControlBolt(this.x, this.y, this._car));
         }
     }
     if (this.isServerForObject)
     {
         if (this._burning && (double)this._burnLife > 0.0)
         {
             this._burnWait -= 0.01f;
             if ((double)this._burnWait < 0.0)
             {
                 Level.Add((Thing)SmallFire.New(8f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), canMultiply: false, firedFrom: ((Thing)this)));
                 this._burnWait = 1f;
             }
             this._burnLife -= 1f / 500f;
             if ((double)this._burnLife <= 0.0)
             {
                 this._sprite.frame = 1;
             }
         }
         if (this.owner is Duck owner)
         {
             if (this._pressed && this._car != null)
             {
                 if (this._car.owner == null)
                 {
                     this.Fondle((Thing)this._car);
                 }
                 this._car.moveLeft  = owner.inputProfile.Down("LEFT");
                 this._car.moveRight = owner.inputProfile.Down("RIGHT");
                 this._car.jump      = owner.inputProfile.Pressed("JUMP");
                 if (owner.inputProfile.Pressed("GRAB"))
                 {
                     this.Fondle((Thing)this._car);
                     this._car.Destroy();
                 }
             }
             else
             {
                 this._car.moveLeft = this._car.moveRight = this._car.jump = false;
             }
         }
         if (this._car != null && this._car.destroyed)
         {
             this.ammo = 0;
         }
     }
     base.Update();
 }