Beispiel #1
0
        public void OnPedestrianHit(Pedestrian ped, Vehicle vehicle)
        {
            vehicle.LastRunOverPedTime = GameEngine.TotalSeconds;
            if (ped.IsHit)
            {
                SoundCache.Play(SoundIds.PedSquelch, vehicle, true);
                return;
            }

            NbrDeadPeds++;
            ped.OnHit(vehicle);

            if (vehicle == PlayerVehicle)
            {
                int time = GeneralSettingsFile.Instance.TimePerPedKill[GameVars.SkillLevel];
                RaceTime.TimeRemaining += time;
                MessageRenderer.Instance.PostTimerMessage(time);
            }

            if (NbrDeadPeds == Peds.Count)
            {
                GameMode.Current = new RaceCompletedMode(CompletionType.Peds);
                RaceTime.IsOver  = true;
            }
        }
Beispiel #2
0
        public void Update()
        {
            Vector3 playerPos = Race.Current.PlayerVehicle.Position;

            for (int i = 0; i < _peds.Count; i++)
            {
                Pedestrian ped = _peds[i];
                if (ped.IsPowerup)
                {
                    // remove used powerups & mines
                    if (ped._stopUpdating)
                    {
                        _peds.Remove(ped);
                        i--;
                        continue;
                    }
                }
                ped.DistanceFromPlayer = Vector3.Distance(playerPos, ped.Position);
                if (ped.DistanceFromPlayer < 100)
                {
                    if (ped.DistanceFromPlayer < 25)
                    {
                        if (Race.Current.RaceTime.IsStarted)
                        {
                            ped.SetRunning(true);
                        }
                    }
                    ped.Update();
                }
            }
        }
Beispiel #3
0
        public void OnPedestrianHit(Pedestrian ped, Vehicle vehicle)
        {
            vehicle.LastRunOverPedTime = Engine.TotalSeconds;
            if (ped.IsHit)
            {
                SoundCache.Play(SoundIds.PedSquelch, vehicle, true);
                return;
            }

            NbrDeadPeds++;
            ped.OnHit(vehicle);

            if (vehicle == PlayerVehicle)
            {
                int time = GeneralSettingsFile.Instance.TimePerPedKill[GameVars.SkillLevel];
                RaceTime.TimeRemaining += time;
                MessageRenderer.Instance.PostTimerMessage(time);
            }

            if (NbrDeadPeds == Peds.Count)
            {
                GameMode.Current = new RaceCompletedMode(CompletionType.Peds);
                RaceTime.IsOver = true;
            }
        }