コード例 #1
0
ファイル: Props.cs プロジェクト: razzie/PocceMod
        public static async Task <int> SpawnBalloons(Vector3 coords)
        {
            var models = new string[] { "prop_beach_volball01", "prop_beach_volball02", "prop_beachball_02", "prop_bskball_01" };
            var root   = await SpawnAtCoords("prop_devin_rope_01", coords, Vector3.Zero, false);

            var balls = new List <int>();

            for (int i = 0; i < API.GetRandomIntInRange(3, 6); ++i)
            {
                var model  = models[API.GetRandomIntInRange(0, models.Length)];
                var offset = new Vector3(API.GetRandomFloatInRange(-0.25f, 0.25f), API.GetRandomFloatInRange(-0.25f, 0.25f), API.GetRandomFloatInRange(0f, 0.75f));
                var ball   = await SpawnAtCoords(model, coords + offset, Vector3.Zero, false);

                Ropes.Attach(root, ball, Vector3.Zero, Vector3.Zero);
                AntiGravity.Add(ball, 1.2f);
                balls.Add(ball);
            }

            foreach (var ball in balls)
            {
                int tmp_ball = ball;
                API.SetEntityAsNoLongerNeeded(ref tmp_ball);
            }

            return(root);
        }
コード例 #2
0
ファイル: Vehicles.cs プロジェクト: Trevsaster14/PocceMod
        private static async Task UpdateEffects()
        {
            await Delay(100);

            var vehicles = Get(Filter.None);

            if (vehicles.Count == 0)
            {
                return;
            }

            foreach (var vehicle in vehicles.Where(vehicle => GetLastState(vehicle, StateFlag.EMP)))
            {
                var engineHealth = API.GetVehicleEngineHealth(vehicle);
                if (engineHealth > 100f)
                {
                    SetState(vehicle, StateFlag.EMP, false);
                }
                else
                {
                    await Effects.AddEMPEffect(vehicle);
                }
            }

            foreach (var vehicle in vehicles.Where(vehicle => IsFeatureEnabled(vehicle, FeatureFlag.BackToTheFuture)))
            {
                await Effects.AddWheelFireEffect(vehicle);
            }

            foreach (var vehicle in vehicles.Where(vehicle => IsFeatureEnabled(vehicle, FeatureFlag.JesusMode)))
            {
                await Effects.AddJesusEffect(vehicle);
            }

            foreach (var vehicle in vehicles.Where(vehicle => IsFeatureEnabled(vehicle, FeatureFlag.MosesMode)))
            {
                await Effects.AddMosesEffect(vehicle);
            }

            foreach (var vehicle in vehicles)
            {
                if (IsFeatureEnabled(vehicle, FeatureFlag.AntiGravity))
                {
                    AntiGravity.Add(vehicle, 0.7f);
                }
                else
                {
                    AntiGravity.Remove(vehicle);
                }
            }
        }