public void RemoveLocation(LocationToCheck location)
 {
     if (Locations.Contains(location))
     {
         Locations.Remove(location);
     }
 }
Example #2
0
        private void SetAsVisible()
        {
            if (State == 2)
            {
                return;
            }

            if (State == 1 || State == 0)
            {
                ViewModel.AddToBar();
            }
            if (FirstlyVisible)
            {
                if (Model.PositionsDisplayAfterDisplay != null)
                {
                    MapService.AddNotStops(Model.PositionsDisplayAfterDisplay as List <MapPosition>);
                }

                if (Model.DisplayObjectsHints != null)
                {
                    foreach (DisplayObjectStopDisplayAfterDisplay displayObject in Model.DisplayObjectsHints)
                    {
                        ViewModel.AddDisplayObject(displayObject.DisplayObject, (int)displayObject.Position);
                    }
                }

                if (Model.Passwords != null)
                {
                    foreach (PasswordGameRequirement password in Model.Passwords)
                    {
                        var passwordService = new PasswordService(this, password);
                        Passwords.Add(passwordService);
                    }
                }

                FirstlyVisible = false;
            }

            if (Model.Position != null && PinOfTheStop == null)
            {
                PinOfTheStop = MapService.AddStop(Model.Position, 2, IsVisibleInState2);
            }
            else if (PinOfTheStop != null)
            {
                MapService.SetPinViewModelToState(PinOfTheStop, 2, IsVisibleInState2);
            }

            RequierementToUnlock = Model.Passwords.Count;
            RequierementValue    = 0;

            foreach (PasswordService password in Passwords)
            {
                password.AskForPassword();
                password.PasswordCompleted += OnPasswordRequierementDone;
            }

            if (Model.Position != null)
            {
                RequierementToUnlock++;
                var locationToCheck = new LocationToCheck(Model.Position.X, Model.Position.Y, Model.Position.Radius);
                locationToCheck.LocationReached += OnPositionRequierementDone;
                LocationChecker.AddLocation(locationToCheck);
            }
            else if (RequierementToUnlock == 0)
            {
                SetAsUnlocked();
                return;
            }

            State = 2;
        }
 public void AddLocation(LocationToCheck newLocation)
 {
     Locations.Add(newLocation);
 }