public override void Init(bool scriptStart)
        {
            // Entities
            Location   location   = LocationManager.GetNoteLocation(SaveManager.NoteIndex);
            CameraData cameraData = CameraManager.GetNoteCamera(SaveManager.NoteIndex);

            _note          = World.CreateProp("xm_prop_x17_note_paper_01a", location.Position, false, false);
            _note.Heading  = location.Heading;
            _note.Rotation = location.Rotation;

            if (SaveManager.HasFlag(TreasureFlags.RevealedNote))
            {
                _blip = CreateBlip(location.Position);
            }

            _camPos = cameraData.Position;
            _camRot = cameraData.Rotation;
            _camFov = cameraData.FOV;

            // Areas
            _revealArea              = new Sphere(location.Position, 75.0f);
            _revealArea.PlayerEnter += EnterRevealArea;
            _revealArea.PlayerLeave += LeaveRevealArea;

            _interactArea              = new Sphere(cameraData.Position - new Vector3(0.0f, 0.0f, 1.0f), 1.5f);
            _interactArea.PlayerLeave += LeaveInteractionArea;

            AreaLibrary.Track(_revealArea);
            AreaLibrary.Track(_interactArea);
        }
        public override void Init(bool scriptStart)
        {
            Function.Call(Hash.REQUEST_ANIM_DICT, AnimDict);

            // Closed chest
            Location chestLocation = LocationManager.GetFinalChestLocation(SaveManager.ChestIndex);

            _chest          = World.CreateProp("xm_prop_x17_chest_closed", chestLocation.Position, false, false);
            _chest.Heading  = chestLocation.Heading;
            _chest.Rotation = chestLocation.Rotation;

            _blip        = World.CreateBlip(chestLocation.Position);
            _blip.Sprite = BlipSprite.Treasure;
            _blip.Color  = BlipColor.Yellow2;

            Function.Call(Hash.SET_BLIP_NAME_FROM_TEXT_FILE, _blip.Handle, "TREA1B_BLIP");
            Function.Call(Hash.SET_BLIP_PRIORITY, _blip.Handle, 11);

            // Corpses
            var corpseLocations = LocationManager.GetCorpseLocations(SaveManager.ChestIndex);

            _props.Add(Util.CreatePropNoOffset("xm_prop_x17_corpse_01", corpseLocations.Item1.Position, corpseLocations.Item1.Rotation, corpseLocations.Item1.Heading));
            _props.Add(Util.CreatePropNoOffset("xm_prop_x17_corpse_02", corpseLocations.Item2.Position, corpseLocations.Item2.Rotation, corpseLocations.Item2.Heading));

            // Shovel
            Location shovelLocation = LocationManager.GetShovelLocation(SaveManager.ChestIndex);

            Prop shovel = World.CreateProp("xm_prop_x17_shovel_01a", shovelLocation.Position, false, false);

            shovel.Heading  = shovelLocation.Heading;
            shovel.Rotation = shovelLocation.Rotation;
            _props.Add(shovel);

            // Pistols
            var pistolLocations = LocationManager.GetPistolLocations(SaveManager.ChestIndex);

            _props.Add(Util.CreatePropNoOffset("w_pi_pistol", pistolLocations.Item1.Position, pistolLocations.Item1.Rotation, pistolLocations.Item1.Heading));
            _props.Add(Util.CreatePropNoOffset("w_pi_pistol", pistolLocations.Item2.Position, pistolLocations.Item2.Rotation, pistolLocations.Item2.Heading));

            // Areas
            _audioArea              = new Sphere(chestLocation.Position, 75.0f);
            _audioArea.PlayerEnter += EnterAudioArea;
            _audioArea.PlayerLeave += LeaveAudioArea;

            _interactArea              = new Sphere(_chest.GetOffsetInWorldCoords(new Vector3(0.0f, -0.85f, 0.0f)), 1.5f);
            _interactArea.PlayerLeave += LeaveInteractionArea;

            AreaLibrary.Track(_audioArea);
            AreaLibrary.Track(_interactArea);

            // Display help text & flash blip
            if (!scriptStart)
            {
                _helpTextHideAt = Game.GameTime + HelpTextTime;

                Function.Call(Hash.SET_BLIP_FLASHES, _blip.Handle, true);
                Function.Call(Hash.SET_BLIP_FLASH_TIMER, _blip.Handle, BlipFlashTime);
            }
        }
        public override void Init(bool scriptStart)
        {
            Vector3 areaOffset = new Vector3(0.0f, 0.0f, 0.5f);

            for (int i = 0; i < MaxClues; i++)
            {
                if (SaveManager.HasFlag(ClueFlags[i]))
                {
                    continue;
                }

                // Prop
                Location location = LocationManager.GetClueLocation(i);
                _props[i]          = World.CreateProp(ClueModels[i], location.Position, false, false);
                _props[i].Heading  = location.Heading;
                _props[i].Rotation = location.Rotation;

                // Blips
                Vector3 visualClueCenter = location.Position.Around(AreaDistance);
                _areaBlips[i]     = CreateAreaBlip(visualClueCenter, AreaRange);
                _areaClueBlips[i] = CreateClueBlip(visualClueCenter);

                // Areas
                _audioAreas[i]              = new Sphere(location.Position, 75.0f);
                _audioAreas[i].PlayerEnter += EnterAudioClueArea;
                _audioAreas[i].PlayerLeave += LeaveAudioClueArea;

                _clueAreas[i] = new Sphere(visualClueCenter, AreaRange);
                _clueAreas[i].SetData("thMod_BlipIndex", i);
                _clueAreas[i].PlayerEnter += EnterVisualClueArea;
                _clueAreas[i].PlayerLeave += LeaveVisualClueArea;

                _interactionAreas[i] = new Sphere(CameraManager.GetClueCamera(i).Position - areaOffset, 1.5f);
                _interactionAreas[i].SetData("thMod_AddsFlag", ClueFlags[i]);
                _interactionAreas[i].PlayerEnter += EnterInteractionArea;
                _interactionAreas[i].PlayerLeave += LeaveInteractionArea;

                AreaLibrary.Track(_audioAreas[i]);
                AreaLibrary.Track(_clueAreas[i]);
                AreaLibrary.Track(_interactionAreas[i]);
            }

            // Display help text
            if (!scriptStart)
            {
                _helpTextHideAt = Game.GameTime + HelpTextTime;

                for (int i = 0; i < MaxClues; i++)
                {
                    if (_areaClueBlips[i] != null)
                    {
                        Function.Call(Hash.SET_BLIP_FLASHES, _areaClueBlips[i].Handle, true);
                        Function.Call(Hash.SET_BLIP_FLASH_TIMER, _areaClueBlips[i].Handle, BlipFlashTime);
                    }
                }
            }
        }
Esempio n. 4
0
        public void CreateEntities()
        {
            if (_bench == null)
            {
                _bench = World.CreateProp("gr_prop_gr_bench_04b", Position, Rotation, false, false);

                // Ammo containers
                Prop container1 = World.CreateProp("gr_prop_gunlocker_ammo_01a", Position, false, false);
                container1.AttachTo(_bench, 0, new Vector3(0.47f, -0.07f, 0.94f), new Vector3(0.0f, 0.0f, -20.0f));

                Prop container2 = World.CreateProp("gr_prop_gr_bulletscrate_01a", Position, false, false);
                container2.AttachTo(_bench, 0, new Vector3(-0.63f, -0.08f, 0.8f), new Vector3(0.0f, 0.0f, 100.0f));

                Prop container3 = World.CreateProp("prop_box_ammo07b", Position, false, false);
                container3.AttachTo(_bench, 0, new Vector3(-0.14f, 0.04f, 0.8f), new Vector3(0.0f, 0.0f, 65.0f));

                _ammoContainers.AddRange(new Prop[] { container1, container2, container3 });
            }

            if (_blip == null)
            {
                _blip              = World.CreateBlip(Position);
                _blip.Sprite       = BlipSprite.WeaponSupplies;
                _blip.Scale        = 0.85f;
                _blip.IsShortRange = true;
                _blip.Name         = "Reloading Bench";
            }

            if (Area == null)
            {
                Area = new Sphere(_bench.GetOffsetInWorldCoords(new Vector3(0.0f, -1.0f, 0.0f)), 1.25f);
                Area.SetData("rbMod_Id", Id);

                AreaLibrary.Track(Area);
            }
        }