private void SetAsUnlockedWithoutActions() { if (State == 3) { return; } if (FirstlyUnlocked) { if (Model.PositionsDisplayAfterUnlock != null) { MapService.AddNotStops(Model.PositionsDisplayAfterUnlock as List <MapPosition>); } if (Model.DisplayObjectsRewards != null) { foreach (DisplayObjectStopDisplayAfterUnlock displayObject in Model.DisplayObjectsRewards) { ViewModel.AddDisplayObject(displayObject.DisplayObject, (int)displayObject.Position); } } FirstlyUnlocked = false; } if (Model.Position != null && PinOfTheStop == null) { PinOfTheStop = MapService.AddStop(Model.Position, 3, IsVisibleInState2); } else if (PinOfTheStop != null) { MapService.SetPinViewModelToState(PinOfTheStop, 3, IsVisibleInState2); } if (State == 2) { foreach (PasswordService password in Passwords) { password.Unshow(); } } State = 3; if ((bool)Model.IsFinal) { GameService.End(); } }
private void SetAsUnvisible() { if (State == 1) { return; } if (State == 2 || State == 3) { ViewModel.RemoveFromBar(); } if (PinOfTheStop != null) { MapService.SetPinViewModelToState(PinOfTheStop, 1, IsVisibleInState2); } State = 1; }
private void SetAsUnlocked() { if (State == 3) { return; } if (FirstlyUnlocked) { if (Model.PositionsDisplayAfterUnlock != null) { MapService.AddNotStops(Model.PositionsDisplayAfterUnlock as List <MapPosition>); } if (Model.DisplayObjectsRewards != null) { foreach (DisplayObjectStopDisplayAfterUnlock displayObject in Model.DisplayObjectsRewards) { ViewModel.AddDisplayObject(displayObject.DisplayObject, (int)displayObject.Position); } } FirstlyUnlocked = false; } if (Model.Position != null && PinOfTheStop == null) { PinOfTheStop = MapService.AddStop(Model.Position, 3, IsVisibleInState2); } else if (PinOfTheStop != null) { MapService.SetPinViewModelToState(PinOfTheStop, 3, IsVisibleInState2); } if (Model.Opens != null) { foreach (StopStop opening in Model.Opens) { opening.Opens.Service.ProcessChange(opening.IfUnvisible, opening.IfVisible, opening.IfUnlocked, (int)opening.Value); } } if (Model.Questions != null) { foreach (Question question in Model.Questions) { question.Service.Ask(); } } if (State == 2) { foreach (PasswordService password in Passwords) { password.Unshow(); } } State = 3; if ((bool)Model.IsFinal) { GameService.End(); } }
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; }