Beispiel #1
0
// Start is called before the first frame update
    void Start()
    {
        if (badGuy != null)
        {
            BadGuys.Add(badGuy);
        }

        GenerateObjects(stone1Prefab);
        GenerateObjects(stone2Prefab);
        GenerateObjects(grassPrefab);
        GenerateObjects(bushPrefab);
        GenerateWear(hat);
        GenerateWear(coat);
        GenerateWear(scarf);
        GenerateWear(pants);
        GenerateWear(blouse);
        GenerateBadGuys();

        if (!BeginingGame)
        {
            _texts[0].text = "Уровень " + level;
            _texts[1].text = "Найдено " + WearCount + "/" + AllWear.Count;
            _texts[2].text = "Уровень " + level;
            _texts[3].text = "Нажмите любую клавишу для старта";
        }
    }
Beispiel #2
0
    void GenerateBadGuys()
    {
        for (var i = 0; i < 10 * level; ++i)
        {
            float x = RandX(), y = RandY();
            while (!CheckGoodGuyDistance(x, y, 10))
            {
                x = RandX();
                y = RandY();
            }

            BadGuys.Add(Instantiate(badGuy, new Vector2(x, y), Quaternion.identity));
        }
    }
Beispiel #3
0
        public void StartEntry(int entryPoint, Ped[] team)
        {
            switch (entryPoint)
            {
            case 0:     // Rappel
                Vector3[] helipads = new[]
                {
                    new Vector3(311.313f, -1466f, 46.9f),
                    new Vector3(299.75f, -1453f, 46.9f),
                };
                for (int i = 0; i < Convert.ToInt32(team.Length / 2); i++)
                {
                    var rappel = new RappelEntry(helipads[i], new Vector3(-92.5652f, -2362.343f, 31.9f));
                    var team2  = team.Reverse().ToList();
                    for (int d = 0 + (2 * i); d < 2 + (2 * i); d++)
                    {
                        Ped t = team2[d];
                        rappel.AddPassenger(t);
                    }
                    rappelUpdates.Add(rappel);
                }
                break;

            case 1:     //boat
                BadGuys[BadGuys.Count - 1].Character.Delete();
                BadGuys.RemoveAt(BadGuys.Count - 1);

                var boatModel = new Model(VehicleHash.Dinghy2);
                int counter   = 0;
                do
                {
                    boatModel.Request();
                    Script.Yield();
                    counter++;
                } while (!boatModel.IsLoaded && counter < 2000);

                var boat = World.CreateVehicle(boatModel, new Vector3(-253.971f, -2367.186f, -0.89f), 185.44f);
                boat.MarkAsNoLongerNeeded();
                CleanupBag.Add(boat);

                foreach (Ped t in team)
                {
                    t.Position = new Vector3(-249.4635f, -2366.84f, 9.319f);
                    t.Heading  = -180f;
                }
                EntryComplete = true;
                break;
            }
        }
Beispiel #4
0
 public void OnStartMission()
 {
     if (Function.Call <bool>(Hash.IS_IPL_ACTIVE, "sunkcargoship"))
     {
         Function.Call(Hash.REMOVE_IPL, "sunkcargoship");
     }
     Function.Call(Hash.REQUEST_IPL, "cargoship");
     for (int i = 0; i < _positions.Length; i++)
     {
         var tmp = new Enemy(_positions[i].Item1, _positions[i].Item2);
         tmp.Character.Task.GuardCurrentPosition();
         BadGuys.Add(tmp);
         CleanupBag.Add(tmp.Character);
     }
 }
Beispiel #5
0
        public void OnStartMission()
        {
            Function.Call(Hash.REMOVE_IPL, "CS1_02_cf_offmission");
            Function.Call(Hash.REQUEST_IPL, "CS1_02_cf_onmission1");
            Function.Call(Hash.REQUEST_IPL, "CS1_02_cf_onmission2");
            Function.Call(Hash.REQUEST_IPL, "CS1_02_cf_onmission3");
            Function.Call(Hash.REQUEST_IPL, "CS1_02_cf_onmission4");

            for (int i = 0; i < _positions.Length; i++)
            {
                var tmp = new Enemy(_positions[i].Item1, _positions[i].Item2);

                tmp.Character.Task.GuardCurrentPosition();
                BadGuys.Add(tmp);
                CleanupBag.Add(tmp.Character);
            }
        }
Beispiel #6
0
 public void OnStartMission()
 {
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_Bar");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_Bedrm");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_Bridge");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_DistantLights");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_enginrm");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_LODLights");
     Function.Call(Hash.REQUEST_IPL, "hei_yacht_heist_Lounge");
     for (int i = 0; i < _positions.Length; i++)
     {
         var tmp = new Enemy(_positions[i].Item1, _positions[i].Item2);
         tmp.Character.Task.GuardCurrentPosition();
         BadGuys.Add(tmp);
         CleanupBag.Add(tmp.Character);
     }
 }
Beispiel #7
0
        public void StartEntry(int entryPoint, Ped[] team)
        {
            switch (entryPoint)
            {
            case 0:     //boat
                BadGuys[BadGuys.Count - 1].Character.Delete();
                BadGuys.RemoveAt(BadGuys.Count - 1);

                var boatModel = new Model(VehicleHash.Dinghy2);
                int counter   = 0;
                do
                {
                    boatModel.Request();
                    //Script.Yield();
                    counter++;
                } while (!boatModel.IsLoaded && counter < 2000);

                var boat = World.CreateVehicle(boatModel, new Vector3(-2015.075f, -1040.253f, 0.5699487f), 341.2882f);
                boat.MarkAsNoLongerNeeded();
                boat.FreezePosition = true;
                CleanupBag.Add(boat);
                foreach (Ped t in team)
                {
                    t.Position = new Vector3(-2015.249f, -1041.006f, 2.072449f);
                    t.Heading  = 63.90365f;
                }
                EntryComplete = true;
                break;

            case 1:     // Rappel
                for (int i = 0; i < Convert.ToInt32(team.Length / 2); i++)
                {
                    var rappel = new RappelEntry(new Vector3(-1492.215f, -1230.166f, 2.87f).Around(20f), new Vector3(-2109.796f, -1009.942f, 22.83442f));
                    var team2  = team.Reverse().ToList();
                    for (int d = 0 + (2 * i); d < 2 + (2 * i); d++)
                    {
                        Ped t = team2[d];
                        rappel.AddPassenger(t);
                    }
                    rappelUpdates.Add(rappel);
                }
                break;
            }
        }
Beispiel #8
0
        public void OnStartMission()
        {
            Function.Call(Hash.REQUEST_IPL, "hei_carrier");
            Function.Call(Hash.REQUEST_IPL, "hei_carrier_DistantLights");
            Function.Call(Hash.REQUEST_IPL, "hei_Carrier_int1");
            Function.Call(Hash.REQUEST_IPL, "hei_Carrier_int2");
            Function.Call(Hash.REQUEST_IPL, "hei_Carrier_int3");
            Function.Call(Hash.REQUEST_IPL, "hei_Carrier_int4");
            Function.Call(Hash.REQUEST_IPL, "hei_Carrier_int5");
            Function.Call(Hash.REQUEST_IPL, "hei_Carrier_int6");
            Function.Call(Hash.REQUEST_IPL, "hei_carrier_LODLights");


            for (int i = 0; i < _positions.Length; i++)
            {
                var tmp = new Enemy(_positions[i].Item1, _positions[i].Item2);

                tmp.Character.Task.GuardCurrentPosition();
                BadGuys.Add(tmp);
                CleanupBag.Add(tmp.Character);
            }
        }
Beispiel #9
0
        public void OnStartMission()
        {
            for (int i = 0; i < _positions.Length; i++)
            {
                var tmp = new Enemy(_positions[i].Item1, _positions[i].Item2);

                tmp.Character.Task.GuardCurrentPosition();
                BadGuys.Add(tmp);
                CleanupBag.Add(tmp.Character);
            }
            var polmodel = new Model(VehicleHash.Police2);

            polmodel.Request(10);

            var polcar1 = World.CreateVehicle(polmodel, new Vector3(-1769f, -1157.036f, 12.633f), 68.7f);

            polcar1.SirenActive = true;
            var polcar2 = World.CreateVehicle(polmodel, new Vector3(-1774.87f, -1153.445f, 12.633f), 202.47f);

            polcar2.SirenActive = true;
            CleanupBag.Add(polcar1);
            CleanupBag.Add(polcar2);
        }
Beispiel #10
0
        public void OnStartMission(Gamemodes gamemode)
        {
            Gamemode = gamemode;
            LoadIPL();
            foreach (var veh in _decorativeVehicles.Where(x => x.EntryPoint == -1))
            {
                var tmpMod  = new Model(veh.Model);
                int counter = 0;
                do
                {
                    tmpMod.Request();
                    counter++;
                    Script.Yield();
                } while (!tmpMod.IsLoaded && counter < 10000);
                if (counter >= 10000)
                {
                    continue;
                }

                Vehicle tmpVeh = new Vehicle(Function.Call <int>(Hash.CREATE_VEHICLE, tmpMod.Hash, veh.Position.X, veh.Position.Y, veh.Position.Z, veh.Heading, false, false));
                tmpVeh.SirenActive = veh.SirenActive;
                foreach (VehicleDoor door in veh.OpenDoors)
                {
                    tmpVeh.OpenDoor(door, false, false);
                }
                CleanupBag.Add(tmpVeh);
            }
            var tmpposs = new List <Tuple <Vector3, float> >(_positions);
            var tmpMax  = _maxEnemies;

            if (_maxEnemies == -1)
            {
                tmpMax = Enemy.Dice.Next(_positions.Count / 2, _positions.Count);
            }
            MaxEnemies = tmpMax;
            for (int i = 0; i < tmpMax; i++)
            {
                Enemy tmp;
                int   ourPick = Enemy.Dice.Next(tmpposs.Count);
                Tuple <Vector3, float> ourTuple = tmpposs[ourPick];
                tmp = new Enemy(ourTuple.Item1, ourTuple.Item2);
                tmpposs.RemoveAt(ourPick);

                tmp.Character.Task.GuardCurrentPosition();
                BadGuys.Add(tmp);
                CleanupBag.Add(tmp.Character);
            }
            if (Gamemode == Gamemodes.BombDefusal)
            {
                BombDefused       = false;
                _defusePercentage = 0;
                _defuseStart      = null;
                IsDefusingBomb    = false;

                var ourPick = _bombLocations[Enemy.Dice.Next(_bombLocations.Count)];
                CurrentBomb = new Tuple <Vector3, float>(ourPick.Item1, ourPick.Item2);
                int counter = 0;
                var barrelM = new Model(1298403575);
                do
                {
                    barrelM.Request();
                    counter++;
                    Script.Yield();
                } while (!barrelM.IsLoaded && counter < 2000);
                var barrel = World.CreateProp(barrelM, CurrentBomb.Item1 - new Vector3(0f, 0f, 1f), new Vector3(0f, 0f, CurrentBomb.Item2), false, false);
                barrel.FreezePosition = true;
                counter = 0;
                var bombM = new Model(929047740);
                do
                {
                    bombM.Request();
                    counter++;
                    Script.Yield();
                } while (!bombM.IsLoaded && counter < 2000);
                var bomb = World.CreateProp(bombM, CurrentBomb.Item1 - new Vector3(0f, 0f, 0.2f), new Vector3(-90f, 0f, CurrentBomb.Item2), false, false);
                bomb.FreezePosition = true;
                CleanupBag.Add(barrel);
                CleanupBag.Add(bomb);
            }
        }