void ghostCreated(Ghost ghost) { GhostControl ghostControl = new GhostControl(); ghostControl.DataContext = ghost; positionLayer.AddChild(ghostControl, ghost.Position); }
void AddNewGhost() { // Randomize location at X meters from player GeoCoordinate ghostPosition = new GeoCoordinate(); ghostPosition.Latitude = CoordinateWithinBounds(Player.Position.Latitude, GhostSpawnMaxCoordDiff, GhostSpawnMinCoordDiff); ghostPosition.Longitude = CoordinateWithinBounds(Player.Position.Longitude, GhostSpawnMaxCoordDiff, GhostSpawnMinCoordDiff); Ghost newGhost = new Ghost(ghostPosition); switch (Difficulty) { case Difficulty.Easy: newGhost.SetSpeed(Ghost.DefaultSpeed); break; case Difficulty.Medium: newGhost.SetSpeed(Ghost.DefaultSpeed * 2.0); break; case Difficulty.Hard: newGhost.SetSpeed(Ghost.DefaultSpeed * 3.0); break; } Ghosts.Add(newGhost); if (ghostCreated != null) { ghostCreated(newGhost); } }