Beispiel #1
0
        public void MakeSuspiciousOfTile(Vector2 Loc, int HowSuspicious)
        {
            Dictionary <Vector2, int> New = new Dictionary <Vector2, int>
            {
                { Loc, HowSuspicious }
            };

            CurrentSuspicions = StealthMethod.CombineSuspicionLists(CurrentSuspicions, New);
        }
Beispiel #2
0
        public void UpdateSuspicions(GameTime gameTime)
        {
            Dictionary <Vector2, int> NewSuspicions = new Dictionary <Vector2, int>();

            if (IsInRoom)
            {
                foreach (KeyValuePair <Vector2, int> I in StealthManager.Instance.RoomSuspiciousPointsThisPass[CurrentRoomIn])
                {
                    NewSuspicions.Add(I.Key, I.Value);
                }
                foreach (Room.EntryPoint E in mapRef.Rooms[CurrentRoomIn].EntryPoints)
                {
                    foreach (KeyValuePair <Vector2, int> S in StealthManager.Instance.PassageSuspiciousPointsThisPass[E.PassagewayUsing])
                    {
                        NewSuspicions.Add(S.Key, S.Value / 2);
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <Vector2, int> I in StealthManager.Instance.PassageSuspiciousPointsThisPass[CurrentPassagewayIn])
                {
                    NewSuspicions.Add(I.Key, I.Value);
                }
                //the room at one end of a passage
                foreach (KeyValuePair <Vector2, int> S in StealthManager.Instance.RoomSuspiciousPointsThisPass[mapRef.Passages[CurrentPassagewayIn].End1.EndPointID])
                {
                    NewSuspicions.Add(S.Key, (3 * S.Value) / 4);
                }
                foreach (KeyValuePair <Vector2, int> S in StealthManager.Instance.RoomSuspiciousPointsThisPass[mapRef.Passages[CurrentPassagewayIn].End2.EndPointID])
                {
                    NewSuspicions.Add(S.Key, (3 * S.Value) / 4);
                }
            }


            //Apply all Suspicious Activities and Noises in the room you are currently in to the suspicious points.

            //run L.O.S checks on these suspicious things to "thin down the herd"
            NewSuspicions = StealthMethod.MassCheckLineOfSight(mapRef, TilePosition, this.Direction, NewSuspicions);
            //now add the Noises by adding a few random tiles in the noise range to the suspicious points.
            NewSuspicions    = StealthMethod.TemperSuspicionsByDistance(NewSuspicions, TilePosition);
            RecentSuspicions = NewSuspicions;

            /*foreach (KeyValuePair<Rectangle, int> Noise in StealthManager.Instance.Noises)
             * {
             *  int NoiseX = mapRef.D.Next(Noise.Key.X, Noise.Key.Right);
             *  int NoiseY = mapRef.D.Next(Noise.Key.Y, Noise.Key.Bottom);
             *  StealthMethod.AddNewSuspiciousness(ref NewSuspicions, new Vector2(NoiseX, NoiseY), Noise.Value);
             * }
             */
            if (CurrentSuspicions.Count > 0 || NewSuspicions.Count > 0)
            {
                double elapsed_time_seconds = gameTime.ElapsedGameTime.TotalSeconds;
                Dictionary <Vector2, int> CommonSuspicions = StealthMethod.TallyAndDecaySuspicionInLists
                                                                 (NewSuspicions, CurrentSuspicions,
                                                                 out Dictionary <Vector2, int> OnlyOldSuspicions, AlertDecayHalfLife, elapsed_time_seconds);

                //Decrement points that haven't been topped up since last Update - carried out in above process.
                CurrentSuspicions = StealthMethod.CombineSuspicionLists(OnlyOldSuspicions, CommonSuspicions);
                //Calculate new Suspicion Level.
                AlertPoints = StealthMethod.TallyTotalSuspicion(CurrentSuspicions);
                AlertLevel  = AlertPoints / AlertPointsPerLevel;
                AlertPoints = AlertPoints % AlertPointsPerLevel;

                if (AlertLevel > 3)
                {
                    AlertPoints = AlertPointsPerLevel - 1;
                    AlertLevel  = 3;
                }
            }
        }