public Ucam()
        {
            CamOn =false;
            DefaultCam = GTA.Game.CurrentCamera;

            Interval = 0;
            this.Tick += new EventHandler(this.Radio_Tick);
        }
 public Ovserve()
 {
     cam = new Camera();
     rnd = new Random();
     Interval = 100;
     this.Tick += new EventHandler(this.Nikita_Tick);
     inputChecker.AddCheckKeys(new Keys[] { Keys.O, Keys.V, Keys.S});
     KeyDown += new GTA.KeyEventHandler(key_KeyDown);
 }
        public FLARE()
        {
            S = 0;
            T = 0;
            ActiveFlag = false;
            rnd = new Random();
            cam = new Camera();
            cam.Deactivate();
            A = new Ped[4];
            sFont = new GTA.Font(0.09F, FontScaling.ScreenUnits);

            Interval = 10;
             inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.F, Keys.L, Keys.A, Keys.R,Keys.E });
            this.Tick += new EventHandler(this.MOD_Tick);
            KeyDown += new GTA.KeyEventHandler(MOD_KeyDown);
            this.PerFrameDrawing += new GraphicsEventHandler(this.MOD_PerFrameDrawing);
        }
        public Parupunte()
        {
            screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits);
            miniFont = new GTA.Font(0.03F, FontScaling.ScreenUnits);
            cam = GTA.Game.CurrentCamera;
            InitFlag = false;
            ChoseFlag = false;
            ActiveFlag = false;
            EndFlag = true;
            StopFlag = false;
            PlayerModel = Player.Model;
            skin = Player.Skin;
            FLAG_1 = false;
            Timer = 0;
            MaxTimer = -1;
            Number = -1;
            rnd = new Random();
            inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.R, Keys.N, Keys.T });
            inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.S, Keys.N,Keys.T});
            inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.A, Keys.S, Keys.N, Keys.T });
            Interval = 100;
            this.Tick += new EventHandler(this.MOD_Tick);
            KeyDown += new GTA.KeyEventHandler(MOD_KeyDown);
            this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing);

            switch (Game.CurrentEpisode)
            {
                case GameEpisode.GTAIV:
                    PlayerName = "ニコ";
                    break;

                case GameEpisode.TBOGT:
                    PlayerName = "ルイス";
                    break;
                case GameEpisode.TLAD:
                    PlayerName = "ジョニー";
                    break;
            }
        }
Exemple #5
0
 protected override void Start()
 {
     NpcCamera = World.CreateCamera(Game.Player.Character.Position, Game.Player.Character.Rotation, GameplayCamera.FieldOfView);
 }
Exemple #6
0
        public cameraScript()
        {
            keyArray[0] = new keyStruct(Keys.W, "forwardKey");
            keyArray[1] = new keyStruct(Keys.S, "backKey");
            keyArray[2] = new keyStruct(Keys.D, "rightKey");
            keyArray[3] = new keyStruct(Keys.A, "leftKey");
            keyArray[4] = new keyStruct(Keys.Up, "strafeUpKey");
            keyArray[5] = new keyStruct(Keys.Down, "strafeDownKey");
            keyArray[6] = new keyStruct(Keys.Left, "strafeLeftKey");
            keyArray[7] = new keyStruct(Keys.Right, "strafeRightKey");
            keyArray[8] = new keyStruct(Keys.E, "upwardKey");
            keyArray[9] = new keyStruct(Keys.Q, "downwardKey");
            keyArray[10] = new keyStruct(Keys.ShiftKey, "sprintKey");
            keyArray[11] = new keyStruct(Keys.F5, "incFov");
            keyArray[12] = new keyStruct(Keys.F6, "decFov");
            keyArray[13] = new keyStruct(Keys.F7, "incRoll");
            keyArray[14] = new keyStruct(Keys.F8, "decRoll");
            keyArray[15] = new keyStruct(Keys.X, "yForwardKey");
            keyArray[16] = new keyStruct(Keys.Z, "yBackwardKey");
            keyArray[17] = new keyStruct(Keys.F3, "carCam_positionKey");

            numOfKeys = 18;

            oldVehPos = new Vector3();
            startPoint = new Vector3();
            customCam = new GTA.Camera();
            customCarCam = new GTA.Camera();
            customCamIdle = new GTA.Camera();
            customCarCam_aimCoord = new Vector3(0, 3f, 0f);
            customCarCam_directionDiff = new Vector3();
            defaultCarCamPos = new Vector3(-1.3f, 0f, 0f);
            customCarCam_offsPos = defaultCarCamPos;
            Interval = 0;

            this.KeyDown += new GTA.KeyEventHandler(bombScript_KeyDown);
            this.KeyUp += new GTA.KeyEventHandler(cameraScript_KeyUp);
            this.Tick += new EventHandler(bombScript_Tick);

            BindConsoleCommand("camcontrol_reloadsettings", new ConsoleCommandDelegate(console_reloadSettings), "- Reload the Cam-Control settings.");
            loadSettings();
        }
        public ExtendedView(Settings settings,
            GameState gameState,
			ITobiiTracker tobiiTracker,
            Aiming aiming,
            DebugOutput debugOutput
            )
        {
            _settings = settings;
            _gameState = gameState;
            _aiming = aiming;
            _debugOutput = debugOutput;
            _tobiiTracker = tobiiTracker;

            _aimTransitionState = 1;

            _extendedViewCamera = World.CreateCamera(new Vector3(), Vector3.Zero, 60f);
            _forwardCamera = World.CreateCamera(new Vector3(), Vector3.Zero, 60f);
        }
Exemple #8
0
        public static void DrawBriefing(CustomMission currentMission)
        {
            UI.ShowSubtitle("Choose an entry point.", 10);
            if (currentMission.EntryPoints.Length - 1 < SelectedEntry)
                SelectedEntry = 0;
            Function.Call(Hash._SHOW_CURSOR_THIS_FRAME);
            DisEnableControls(false, true);
            currentMission.DrawBriefingMap();
            Game.Player.Character.Position = currentMission.CameraPosition + new Vector3(0, 0, 10f);
            Function.Call(Hash.FREEZE_ENTITY_POSITION, Game.Player.Character.Handle, true);
            if (_mainCamera == null || (_mainCamera.Position != currentMission.CameraPosition))
            {
                World.DestroyAllCameras();
                _mainCamera = World.CreateCamera(currentMission.CameraPosition, new Vector3(0, 0, 0), 60f);
            }
            _mainCamera.PointAt(currentMission.CameraPosition - new Vector3(0,0, 30f));
            World.RenderingCamera = _mainCamera;
            SizeF res = UIMenu.GetScreenResolutionMantainRatio();

            for (int i = 0; i < currentMission.EntryPoints.Length; i++)
            {
                Vector3 entryPoint = currentMission.EntryPoints[i];

                var xPointer = new OutputArgument();
                var yPointer = new OutputArgument();
                bool successful = Function.Call<bool>(Hash._WORLD3D_TO_SCREEN2D, entryPoint.X, entryPoint.Y, entryPoint.Z, xPointer,
                    yPointer);
                var x = xPointer.GetResult<float>()*res.Width;
                var y = yPointer.GetResult<float>()*res.Height;

                if (!successful)
                {
                    x = 64f;
                    y = res.Height - 64f - 64*i;
                }

                bool hovering = UIMenu.IsMouseInBounds(new Point(Convert.ToInt32(x) - 32, Convert.ToInt32(y) - 32),
                    new Size(64, 64));

                new Sprite("trafficcam", SelectedEntry == i ? "traffic_junction_box" : "cursor",
                    new Point(Convert.ToInt32(x) - 32, Convert.ToInt32(y) - 32), new Size(64, 64), 0f, SelectedEntry == i ? Color.DarkGreen : Color.DarkRed)
                    .Draw();

                if (Game.IsControlPressed(0, GTA.Control.Attack) && hovering)
                    SelectedEntry = i;
                new UIResText(currentMission.EntryNames[i], new Point(Convert.ToInt32(x) + 32, Convert.ToInt32(y) - 32), 1f, Color.White, Font.Monospace,
                    UIResText.Alignment.Left).Draw();
            }
            new UIResText(currentMission.MissionName, new Point(Convert.ToInt32(res.Width), 20), 3f, Color.White,
                GTA.Font.Pricedown, UIResText.Alignment.Right).Draw();

            DrawScaleform();
            Function.Call(Hash.FREEZE_ENTITY_POSITION, Game.Player.Character.Handle, false);
        }
        public void ToggleBombBayView()
        {
            if (bombCam == null)
            {
                ControlMonitor.DisableControl(Control.VehicleFlyAttack);
                ControlMonitor.DisableControl(Control.VehicleFlyAttack2);
                int boneIndex = Function.Call<int>(Hash._GET_ENTITY_BONE_INDEX, vehicle.Handle, "chassis_dummy");
                var boneCoord = Function.Call<Vector3>(Hash._GET_ENTITY_BONE_COORDS, vehicle.Handle, boneIndex);
                bombCam = new Camera(Function.Call<int>(Hash.CREATE_CAMERA_WITH_PARAMS, 0x19286a9, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 65.0f, 0, 2));
                bombCam.AttachTo(vehicle, new Vector3(0f, 1.3324f, -0.9f));
                bombCam.PointAt(vehicle, vehicle.GetOffsetFromWorldCoords(boneCoord - new Vector3(0, 0, 1.3f)));
                bombCam.Shake(CameraShake.RoadVibration, 0.4f);
                bombCam.FieldOfView = 65.0f;
                bombCam.IsActive = true;
                Function.Call(Hash.RENDER_SCRIPT_CAMS, 1, 0, 3000, 1, 0, 0);
                Function.Call(Hash.DISPLAY_RADAR, 0);
                Function.Call(Hash.DISPLAY_HUD, 0);
                SetAutopilot(true);
            }

            else
            {
                World.RenderingCamera = null;
                bombCam.IsActive = false;
                bombCam.Destroy();
                bombCam = null;
                Function.Call(Hash.DISPLAY_RADAR, 1);
                Function.Call(Hash.DISPLAY_HUD, 1);
                ControlMonitor.EnableControl(Control.VehicleFlyAttack);
                ControlMonitor.EnableControl(Control.VehicleFlyAttack2);
                SetAutopilot(false);
            }
        }
 public InterpolatingCamera(Vector3 position)
 {
     mainCamera = World.CreateCamera(position, new Vector3(), 50f);
     mainCamera.Position = position;
 }
 public void Reset()
 {
     if (camera == null) createCamera();
     camera.Deactivate();
     camera = null;
 }
 private void createCamera()
 {
     if (camera != null && camera.Exists())
     {
         camera.Deactivate();
     }
     camera = new Camera();
     camera.Position = Game.CurrentCamera.Position;
     camera.Direction = Game.CurrentCamera.Direction;
     camera.Rotation = Game.CurrentCamera.Rotation;
     camera.Activate();
 }
        private void Nikita_Tick(object sender, EventArgs e)
        {
            if (Active)
            {
                if (Exists(rck))
                {
                    if (BombTimer == 0)
                    {
                        rck.Velocity = speed * GTA.Game.CurrentCamera.Direction;
                        cam.Activate();
                        cam.Position = rck.Position;
                        cam.Rotation = new Vector3(0, 0, GTA.Game.CurrentCamera.Rotation.Z);

                    }
                    BombTimer++;

                    if (speed < 80)
                    {
                        speed+=2;
                    }

                    GTA.Native.Pointer LX = typeof(int);
                    GTA.Native.Pointer LY = typeof(int);
                    GTA.Native.Pointer RX = typeof(int);
                    GTA.Native.Pointer RY = typeof(int);
                    GTA.Native.Function.Call("GET_POSITION_OF_ANALOGUE_STICKS", 0, LX, LY, RX, RY);

                    if (Math.Abs(RX) > 3 || Math.Abs(RY) > 3)
                    {
                        speed = 10;
                    }

                    cam.Position = rck.Position;
                    cam.Rotation = cam.Rotation + new Vector3(-10.0f*RY/126f,0,-10.0f*RX/126.0f);
                    Vec = cam.Direction;
                    rck.Velocity = speed*Vec;

                    if (GTA.Native.Function.Call<bool>("HAS_OBJECT_COLLIDED_WITH_ANYTHING", rck) || Game.isGameKeyPressed(GameKey.Sprint) || Player.Character.Position.DistanceTo(rck.Position)>150.0f || BombTimer>=150 || !Player.Character.isAlive)
                    {
                        if (rck.Position.DistanceTo(Player.Character.Position) < 10.0f)
                        {
                            GTA.World.AddExplosion(rck.Position, ExplosionType.Molotov, 1.0f);
                        }
                        else
                        {
                            GTA.World.AddExplosion(rck.Position, ExplosionType.Rocket, 1000.0f, true,false, 1.0f);
                        }
                        rck.Delete();
                        Active = false;
                        cam.Deactivate();
                        cam.Delete();
                    }
                }
                else
                {
                    Active = false;
                    cam.Deactivate();
                    cam.Delete();
                }
            }
            else
            {
                if (Player.Character.isAlive && Player.Character.Weapons == Weapon.Unarmed && Player.CanControlCharacter && !Player.Character.isInVehicle() && Player.Character.Velocity.Length() < 2.0)
                {
                    if (Game.isGameKeyPressed(GameKey.Attack) && Game.isGameKeyPressed(GameKey.Reload) && !Active)
                    {
                        Active = true;
                        speed = 30;
                        cam = new Camera();
                        rck = createObj(0xE20794ED, Player.Character.Position + new Vector3(0,0,1.0f));
                        GTA.Native.Function.Call("SET_ACTIVATE_OBJECT_PHYSICS_AS_SOON_AS_IT_IS_UNFROZEN",rck,true);
                        rck.Collision = true;
                        GTA.Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", rck, true);
                        BombTimer = 0;
                    }
                }
            }
        }
Exemple #14
0
		public static void DrawSettings(Race settingsForRace, Vehicle previewVehicle)
		{
			if(!IsInMenu) return;

			// CAMERA
			if (MainCamera == null || MainCamera.Position != settingsForRace.Trigger + new Vector3(3f, 3f, 3f))
			{
				World.DestroyAllCameras();
				MainCamera = World.CreateCamera(settingsForRace.Trigger + new Vector3(3f, 3f, 3f), new Vector3(), 60f);
				MainCamera.PointAt(settingsForRace.Trigger);
			}
			World.RenderingCamera = MainCamera;

			// UI DRAWING
			var safe = UIMenu.GetSafezoneBounds();
			var res = UIMenu.GetScreenResolutionMantainRatio();

			new UIResText(settingsForRace.Name, new Point(safe.X, safe.Y), 0.8f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Left) { Outline = true}.Draw();
			new UIResText(settingsForRace.Description, new Point(safe.X, 50 + safe.Y), 0.4f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Left) {WordWrap = new Size(Convert.ToInt32(res.Width) - (safe.X*2),0), Outline = true}.Draw();

			new UIResRectangle(new Point(safe.X + 435, safe.Y + 107), new Size(1200, 37), Color.Black).Draw();
			new UIResText("VEHICLE", new Point(safe.X + 1000, safe.Y + 110), 0.35f, Color.White, Font.ChaletLondon, UIResText.Alignment.Centered).Draw();

			string vehClass = "";
			switch (Function.Call<int>(Hash.GET_VEHICLE_CLASS, previewVehicle.Handle))
			{
				case 0:
					vehClass = "Compacts";
					break;
				case 1:
					vehClass = "Sedans";
					break;
				case 2:
					vehClass = "SUVs";
					break;
				case 3:
					vehClass = "Coupes";
					break;
				case 4:
					vehClass = "Muscle";
					break;
				case 5:
					vehClass = "Sports Classics";
					break;
				case 6:
					vehClass = "Sports";
					break;
				case 7:
					vehClass = "Super";
					break;
				case 8:
					vehClass = "Motorcycle";
					break;
				case 9:
					vehClass = "Offroad";
					break;
				case 10:
					vehClass = "Industrial";
					break;
				case 11:
					vehClass = "Utility";
					break;
				case 12:
					vehClass = "Vans";
					break;
				case 13:
					vehClass = "Bicycle";
					break;
				case 14:
					vehClass = "Boats";
					break;
				case 15:
					vehClass = "Helicopter";
					break;
				case 16:
					vehClass = "Airplane";
					break;
				case 17:
					vehClass = "Service";
					break;
				case 18:
					vehClass = "Emergency";
					break;
				case 19:
					vehClass = "Military";
					break;
				case 20:
					vehClass = "Commercial";
					break;
			}

			new UIResText(vehClass, new Point(Convert.ToInt32(res.Width) - 430 - safe.X, 800 - safe.Y), 1.5f, Color.White, Font.ChaletComprimeCologne, UIResText.Alignment.Left) {DropShadow = true}.Draw();
			new UIResText(previewVehicle.FriendlyName, new Point(Convert.ToInt32(res.Width) - 400 - safe.X, 840 - safe.Y), 1.5f, Color.DodgerBlue, Font.HouseScript, UIResText.Alignment.Left) {DropShadow = true}.Draw();

			// MENU CORRECTIONS
			MainMenu.Subtitle.Position = new Point(safe.X + 200, MainMenu.Subtitle.Position.Y);
			MainMenu.Subtitle.TextAlignment = UIResText.Alignment.Centered;
			
		}
        //対象物が画面のどこらへんにあるかを割り出す処理
        //返り値はVector3(x,y,z)
        // x:0.0~1.0
        // y:0.0~1.0
        // z:距離を線形変換。フォントサイズの算出等に使える。
        public Vector3 Analysis(Camera cam, Vector3 TargetPos)
        {
            float x, y, z;
            x = -cam.Rotation.X * (float)Math.PI / 180.0f;
            y = -cam.Rotation.Y * (float)Math.PI / 180.0f;
            z = -cam.Rotation.Z * (float)Math.PI / 180.0f;
            Vector3 Output = TargetPos - cam.Position;  //平行移動
            Vector3 temp;

            //z軸回りに回転
            temp.X = (float)Math.Cos(z) * Output.X - (float)Math.Sin(z) * Output.Y;
            temp.Y = (float)Math.Sin(z) * Output.X + (float)Math.Cos(z) * Output.Y;
            temp.Z = Output.Z;
            Output = temp;

            //y軸回りに回転
            temp.X = (float)Math.Cos(y) * Output.X - (float)Math.Sin(y) * Output.Z;
            temp.Y = Output.Y;
            temp.Z = (float)Math.Sin(y) * Output.X + (float)Math.Cos(y) * Output.Z;
            Output = temp;

            //x軸回りに回転
            temp.X = Output.X;
            temp.Y = (float)Math.Cos(x) * Output.Y - (float)Math.Sin(x)*Output.Z;
            temp.Z = (float)Math.Sin(x) * Output.Y + (float)Math.Cos(x)*Output.Z;
            Output = temp;

            //ベクトルの角度を取得
            Vector2 theta;
            theta.X = (float)Math.Atan2(Output.X*10.0f,10*Output.Y);
            theta.Y = (float)Math.Atan2(10 * Output.Z, 10 * Output.Y);

            //角度より位置を割り出す
            if (Output.Y >= 0.0)
            {
                temp.X = (float)Math.Sin(-theta.X) + 0.5f;
                temp.Y = (float)Math.Sin(-theta.Y) + 0.5f;
            }
            else
            {
                temp.X = -1.0f;
                temp.Y = -1.0f;
            }

            //線形変換
            temp.Z = a * TargetPos.DistanceTo(cam.Position) + b;

            Output = temp;

            return Output;
        }
 public void onUpdate()
 {
     if (inCameraMode)
     {
         if (!cameraActivated)
         {
             camera = new Camera();
             camera.Activate();
             currentPosition = Player.Character.Position;
             Player.CanControlCharacter = false;
             cameraActivated = true;
         }
         float z = World.GetGroundZ(currentPosition, GroundType.Highest);
         camera.Position = currentPosition + new Vector3(0, -300 * (getPercentageZoom() - 0.05f * 3.0f), zoom + z);
         camera.LookAt(new Vector3(currentPosition.X, currentPosition.Y, z));
     }
     else
     {
         if (cameraActivated)
         {
             camera.Deactivate();
             //Game.DefaultCamera.Activate();
             Player.CanControlCharacter = true;
             cameraActivated = false;
         }
     }
 }
 public BombingVehicle(int handle)
     : base(handle)
 {
     this.bombCam = null;
     this.vehicle = new Vehicle(handle);
 }
        public void OnTick(object sender, EventArgs e)
        {
            var veh = FindNearbyPoliceVehicle(VehicleType.Car);
            if (veh?.Handle != 0 && !notifyVehicle && World.RenderingCamera.Handle != mainCamera?.Handle)
            {
                UI.Notify("Vehicle Cam Available.");
                notifyVehicle = true;
            }

            else if (veh == null || veh.Handle == 0)
                notifyVehicle = false;

            veh = FindNearbyPoliceVehicle(VehicleType.Helicopter);

            if (veh?.Handle != 0 && !notifyHeli && World.RenderingCamera.Handle != mainCamera?.Handle)
            {
                UI.Notify("Helicopter Cam Available.");
                notifyHeli = true;
            }

            else if (veh == null || veh.Handle == 0)
                notifyHeli = false;

            if (Game.Player.Character.IsOnFoot && Function.Call<int>(Hash.GET_FOLLOW_PED_CAM_VIEW_MODE) == 2 || Game.Player.Character.IsInVehicle() && Function.Call<int>(Hash.GET_FOLLOW_VEHICLE_CAM_VIEW_MODE) == 2)
            {
                Function.Call(Hash.DISABLE_CONTROL_ACTION, 0, 0, true);

                if (Function.Call<bool>(Hash.IS_DISABLED_CONTROL_JUST_PRESSED, 0, 0))
                {
                    var player = Game.Player.Character;

                    switch (mViewModeCounter)
                    {
                        case 0:
                            var policeVeh = FindNearbyPoliceVehicle(VehicleType.Car);
                            if (policeVeh != null && policeVeh.Handle != 0)
                            {
                                var boneIndex = Function.Call<int>(Hash._GET_ENTITY_BONE_INDEX, policeVeh.Handle, "windscreen");
                                var bonePos = Function.Call<Vector3>(Hash._GET_ENTITY_BONE_COORDS, policeVeh.Handle, boneIndex);
                                var camPos = Function.Call<Vector3>(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, policeVeh.Handle, bonePos.X, bonePos.Y, bonePos.Z);
                                mainCamera = World.CreateCamera(camPos, policeVeh.Rotation, 40f);
                                mainCamera.AttachTo(policeVeh, new Vector3(camPos.X, camPos.Y - 0.3f, camPos.Z - 0.02f));
                                mainCamera.PointAt(player);
                                World.RenderingCamera = mainCamera;
                                mViewModeCounter++;

                            }
                            else
                            {
                                mViewModeCounter++;
                                goto case1;
                            }
                            break;
                        case 1:
                        case1:
                            var policeHeli = FindNearbyPoliceVehicle(VehicleType.Helicopter);
                            if (policeHeli != null && policeHeli.Handle != 0)
                            {
                                mainCamera = World.CreateCamera(policeHeli.Position, policeHeli.Rotation, 50f);
                                mainCamera.AttachTo(policeHeli, new Vector3(0, 0, -1.4f));
                                mainCamera.PointAt(player);
                                World.RenderingCamera = mainCamera;
                                mViewModeCounter++;
                            }

                            else
                            {
                                ExitCustomCameraView();
                                mViewModeCounter = 0;
                            }
                            break;

                        default:
                            ExitCustomCameraView();
                            mViewModeCounter = 0;
                            break;
                    }
                }
            }
        }
Exemple #19
0
        private void Init()
        {
            Game.FadeScreenOut(1000);
            Wait(1000);

            _shownMotives = false;
            _shownGender = false;
            _shownClass = false;

            RPGMethods.CleanupObjects();

            if (RPG.UIHandler != null && RPG.UIHandler.View != null)
                RPG.UIHandler.View.CloseAllMenus();

            Function.Call(Hash.DISPLAY_HUD, 0);
            Function.Call(Hash.DISPLAY_RADAR, 0);

            LoadingCharCreate = true;

            Game.FadeScreenIn(100);

            PlayerName = "Player";
            CarPlate = "PLAYER01";

            if(Camera != null) Camera.Destroy();
            Game.Player.Character.Position = new Vector3(_playerPosition.X - 20, _playerPosition.Y, _playerPosition.Z);
            Wait(10000);
            State = CharCreationState.PickMotives;

            LoadingCharCreate = false;

            Game.FadeScreenIn(1000);
            Camera = World.CreateCamera(_camPosition, new Vector3(0,0,30), GameplayCamera.FieldOfView);
            Camera.MotionBlurStrength = 0.4f;
            World.RenderingCamera = Camera;
            RPG.GameHandler.InitiateNpcs = false;
            Initialised = true;
        }
Exemple #20
0
        private void SetCam(Vector3 pos, bool lookAtPlayer = false)
        {
            if(Camera != null) Camera.Destroy();

            Camera = World.CreateCamera(pos, Vector3.Zero, GameplayCamera.FieldOfView);
            if(lookAtPlayer)
            {
                Camera.PointAt(Game.Player.Character);
            }
            World.RenderingCamera = Camera;
        }
        private void ApplyCameraPosition(Camera camera, Vector3 extraOffset, bool isRelative)
        {
            var pitch = Mathf.Deg2Rad * camera.Rotation.X;
            var yaw = Mathf.Deg2Rad * camera.Rotation.Z;

            var delta = new Vector3(extraOffset.X, (float) (_distanceToCharacter*-Math.Cos(pitch)),
                (float) (_distanceToCharacter*-Math.Sin(pitch)));
            delta.Z = Math.Max(delta.Z, -1f) + extraOffset.Z;

            var extendedViewCameraOffset = delta;
            extendedViewCameraOffset.X = (float) (Math.Cos(yaw)*delta.X - Math.Sin(yaw)*delta.Y);
            extendedViewCameraOffset.Y = (float) (Math.Sin(yaw)*delta.X + Math.Cos(yaw)*delta.Y);

            ScriptHookExtensions.AttachCamToEntity(camera, Game.Player.Character, extendedViewCameraOffset, isRelative);
        }
Exemple #22
-1
        protected override void Start()
        {
            RPGSettings.AudioVolume = RPG.Settings.GetValue("Options", "AudioVolume", 35);
            RPGSettings.PlayKillstreaks = RPG.Settings.GetValue("Options", "PlayKillAnnouncements", true);
            RPGSettings.ShowKillstreaks = RPG.Settings.GetValue("Options", "ShowKillAnnouncements", true);
            RPGSettings.ShowPrerequisiteWarning = RPG.Settings.GetValue("Options", "ShowPrerequisiteWarning", true);
            RPGSettings.ShowPressYToStart = RPG.Settings.GetValue("Options", "ShowPressYToStart", true);
            RPGSettings.EnableAutoSave = RPG.Settings.GetValue("Options", "EnableAutoSave", true);
            RPGSettings.AutosaveInterval = RPG.Settings.GetValue("Options", "AutosaveIntervalSeconds", 30);
            RPGSettings.AutostartRPGMode = RPG.Settings.GetValue("Options", "AutostartRPGMode", true);
            RPGSettings.ShowQuestTracker = RPG.Settings.GetValue("Options", "ShowQuestTracker", true);
            RPGSettings.ShowSkillBar = RPG.Settings.GetValue("Options", "ShowSkillBar", true);
            RPGSettings.SafeArea = RPG.Settings.GetValue("Options", "SafeArea", 10);

            NpcCamera = World.CreateCamera(Game.Player.Character.Position, Game.Player.Character.Rotation, GameplayCamera.FieldOfView);
            OptionsMenu = new RPGMenu("Options", new GTASprite("CommonMenu", "interaction_bgd", Color.ForestGreen), new IMenuItem[] {
                        new MenuButton("Save Game", "").WithActivate(() => { RPG.SaveAllData(); RPG.Subtitle("Saved");}),
                        new MenuButton("New Game", "").WithActivate(NewGame),
                        new MenuNumericScroller("AudioVolume","",0,100,10,RPGSettings.AudioVolume/10).WithNumericActions(ChangeAudioVolume,d => { }),
                        new MenuNumericScroller("SafeArea Setting","",0,10,1,RPGSettings.SafeArea).WithNumericActions(ChangeSafeArea,d => { }),
                        new MenuToggle("Toggle Skill Bar", "",RPGSettings.ShowSkillBar).WithToggles(ToggleSkillBar, ToggleSkillBar),
                        new MenuToggle("Toggle Quest Tracker", "",RPGSettings.ShowQuestTracker).WithToggles(ToggleQuestTracker, ToggleQuestTracker),

                        new MenuToggle("Play Kill Announcer Sounds", "",RPGSettings.PlayKillstreaks).WithToggles(ToggleKillAnnounceSounds, ToggleKillAnnounceSounds),
                        new MenuToggle("Show Killstreak Text", "",RPGSettings.ShowKillstreaks).WithToggles(ToggleShowKillAnnounce, ToggleShowKillAnnounce),
                        new MenuToggle("Show Prerequisite Warning", "",RPGSettings.ShowPrerequisiteWarning).WithToggles(ToggleWarning, ToggleWarning),
                        new MenuToggle("Show Press Y To Start", "",RPGSettings.ShowPressYToStart).WithToggles(ToggleShowPressY, ToggleShowPressY),
                        new MenuToggle("Enable Auto Save", "",RPGSettings.EnableAutoSave).WithToggles(ToggleAutoSave, ToggleAutoSave),
                        new MenuNumericScroller("Autosave Interval (s)","",0,120,10,RPGSettings.AutosaveInterval/10).WithNumericActions(ChangeAutosaveInterval,d => { }),
                        new MenuToggle("Autostart RPG Mode", "",RPGSettings.AutostartRPGMode).WithToggles(ToggleAutostartRPG, ToggleAutostartRPG),

                        new MenuButton("Mod Version: " + RPG.Version, ""),
                        new MenuButton("Back", "").WithActivate(() => View.PopMenu())
                    });
            RPGUI.FormatMenu(OptionsMenu);
        }