Пример #1
0
        private static void UpdateLoop()
        {
            while (true)
            {
                GameFiber.Yield();

                Vector3 playerPos = Game.LocalPlayer.Character.Position;
                for (int i = Stingers.Count - 1; i >= 0; i--)
                {
                    Stinger s = Stingers[i];
                    if (s.Exists())
                    {
                        if (Vector3.DistanceSquared(playerPos, s.Position) > 1000f * 1000f)
                        {
                            DeleteStinger(s);
                            continue;
                        }


                        s.Update();
                    }
                    else
                    {
                        Stingers.RemoveAt(i);
                        continue;
                    }
                }
            }
        }
Пример #2
0
        public static void CreateStingersFromPlayer(int num)
        {
            isCreatingStingersFromPlayer = true;

            if (Settings.EnableAnimations)
            {
                GameFiber.StartNew(() =>
                {
                    Vector3 playerPos            = Game.LocalPlayer.Character.Position;
                    Vector3 playerForwardVect    = Game.LocalPlayer.Character.ForwardVector;
                    float playerYaw              = Game.LocalPlayer.Character.Rotation.Yaw;
                    Stinger prevStinger          = null;
                    createStingersPlayerAnimTask = Game.LocalPlayer.Character.Tasks.PlayAnimation("mp_weapons_deal_sting", "crackhead_bag_loop", -1, 0.925f, 0.825f, 0.0f, AnimationFlags.Loop);
                    for (int i = 0; i < num; i++)
                    {
                        Stinger s = new Stinger(playerPos + playerForwardVect * (SeparationFromPlayer + (SeparationBetweenStingers * i)), playerYaw);
                        if (i != 0)
                        {
                            s.Position = new Vector3(s.Position.X, s.Position.Y, prevStinger.Position.Z + 0.5f);
                        }
                        Logger.LogDebug("CreateStingers(" + num + ")", "Created Stinger #" + Stingers.Count);
                        Stingers.Add(s);
                        DateTime timeout = DateTime.UtcNow.AddSeconds(15.0f);
                        while (s != null && s.Exists() && s.AnimState != Stinger.StingerAnimState.Deployed && DateTime.UtcNow < timeout)
                        {
                            GameFiber.Sleep(25);
                        }

                        if (s == null || !s.Exists())
                        {
                            break;
                        }
                        else
                        {
                            prevStinger = s;
                        }
                    }
                    Game.LocalPlayer.Character.Tasks.Clear();
                    createStingersPlayerAnimTask = null;
                    isCreatingStingersFromPlayer = false;
                    Logger.LogDebug("CreateStingers(" + num + ")", "Current Total Stingers " + Stingers.Count);
                });
            }
            else
            {
                Vector3 playerPos         = Game.LocalPlayer.Character.Position;
                Vector3 playerForwardVect = Game.LocalPlayer.Character.ForwardVector;
                float   playerYaw         = Game.LocalPlayer.Character.Rotation.Yaw;
                for (int i = 0; i < num; i++)
                {
                    Stinger s = new Stinger(playerPos + playerForwardVect * (SeparationFromPlayer + (SeparationBetweenStingers * i)), playerYaw);
                    Logger.LogDebug("CreateStingers(" + num + ")", "Created Stinger #" + Stingers.Count);
                    Stingers.Add(s);
                }
                Logger.LogDebug("CreateStingers(" + num + ")", "Current Total Stingers " + Stingers.Count);
                isCreatingStingersFromPlayer = false;
            }
        }
Пример #3
0
        public static void CreateStingerFromBehindVehicle(Vehicle veh)
        {
            Vector3 finalPos = veh.RearPosition + veh.ForwardVector * -0.725f;
            float   yaw      = veh.Rotation.Yaw + 90.0f;
            Stinger s        = new Stinger(finalPos, yaw);

            Logger.LogDebug("CreateStingerFromBehindVehicle()", "Created Stinger #" + Stingers.Count);
            Stingers.Add(s);
            Logger.LogDebug("CreateStingerFromBehindVehicle()", "Current Total Stingers " + Stingers.Count);
        }
Пример #4
0
 public static void DeleteStinger(Stinger stingerToRemove)
 {
     stingerToRemove.Delete();
     Stingers.Remove(stingerToRemove);
 }