/// <summary>
        /// Adds the new police to the list.
        /// </summary>
        public void AddNewPoliceToList()
        {
            if (level > 8) return;
            int newPosition = rand.Next(labyrinth.policeSpawnPoints.Count);
            Tile tile = labyrinth.GetTile(labyrinth.policeSpawnPoints[newPosition].Key,
                labyrinth.policeSpawnPoints[newPosition].Value);

            foreach (Police police in policeList)
            {
                if (police.actualTile == tile)
                {
                    AddNewPoliceToList();
                    return;
                }
            }

            Police newPolice = new Police
                (
                Content.Load<Texture2D>(GameGraphics.POLICE),
                new Vector2(tile.GetPosition().X, tile.GetPosition().Y), tile, Gru);

            policeList.Add(newPolice);
        }
 /// <summary>
 /// Respawns a police.
 /// </summary>
 /// <param name="policeToRespawn">The police to respawn.</param>
 void RespawnPolice(Police policeToRespawn)
 {
     int newPosition = rand.Next(labyrinth.policeSpawnPoints.Count);
     policeToRespawn.actualTile = labyrinth.GetTile(labyrinth.policeSpawnPoints[newPosition].Key, labyrinth.policeSpawnPoints[newPosition].Value);
     policeToRespawn.Position = new Vector2(policeToRespawn.actualTile.GetPosition().X, policeToRespawn.actualTile.GetPosition().Y);
     policeToRespawn.ResetMovement();
 }
 /// <summary>
 /// Checks if there is a collision with a police.
 /// </summary>
 /// <param name="police">The police.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool CheckCollisionWithPolice(Police police)
 {
     return actualTile == police.actualTile;
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChasingState"/> class.
 /// </summary>
 /// <param name="police">The police.</param>
 public ChasingState(Police police)
 {
     this.police = police;
 }
Exemple #5
0
 public UrgeToArrestState(Police police)
 {
     this.police = police;
     r = new Random();
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScaredState"/> class.
 /// </summary>
 /// <param name="police">The police.</param>
 public ScaredState(Police police)
 {
     this.police = police;
     r = new Random();
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NormalState"/> class.
 /// </summary>
 /// <param name="police">The police.</param>
 public NormalState(Police police)
 {
     this.police = police;
     r = new Random();
 }