public void GenerateApple(bool[,] forbidden, Apple apple) { if (apple.IsSet) { return; } if (apple.IsSpecial) { GenerateSpecialAppleIfNecessary(forbidden, apple); } else { FindPositionAndSetApple(forbidden, apple); } }
private void ThrowEventForSpecialApple(Apple apple) { if (apple.Speciality.Type.ToLower() == AppleSpeciality.SpeedingType) { OnChangedSpeed(new SnakeEventArgs(apple.Speciality.Value, apple.Speciality.Time)); } else if (apple.Speciality.Type.ToLower() == AppleSpeciality.ShrinkingType) { OnShrinkingEvent(new SnakeEventArgs(apple.Speciality.Value, 0)); } else if (apple.Speciality.Type.ToLower() == AppleSpeciality.InverseType) { OnInverseEvent(new SnakeEventArgs(0, apple.Speciality.Time)); } else if (apple.Speciality.Type.ToLower() == AppleSpeciality.WinType) { OnHighScore(new EventArgs()); } }
public override void UnhideApple(Apple specialApple_DC) { SLApple specialApple = specialApple_DC as SLApple; specialApple.AppleImage.Visibility = Visibility.Visible; }
public override void HideApple(Apple specialApple_DC) { SLApple specialApple = specialApple_DC as SLApple; specialApple.AppleImage.Visibility = Visibility.Collapsed; }
public virtual void UnhideApple(Apple specialApple) { //Hook method to show apple in display ; }
public virtual void HideApple(Apple specialApple) { //Hook method to hide apple in display ; }
private void FindPositionAndSetApple(bool[,] forbidden, Apple apple) { Position freePosition = FindNextFreePosition(forbidden); SetApple(freePosition.X, freePosition.Y, apple); }
protected override void ReadAppleTag(Level creationLevel_DC, XmlReader reader, Apple apple_DC) { SLLevel creationLevel = creationLevel_DC as SLLevel; SLApple apple = apple_DC as SLApple; base.ReadAppleTag(creationLevel, reader, apple); reader.MoveToAttribute("img"); string appleFilename = reader.Value; reader.MoveToAttribute("offsetY"); apple.AppleOffsetY = Double.Parse(reader.Value); apple.AppleImage = SnakeUtils.LoadImage(appleFilename); creationLevel.LevelCanvas.Children.Add(apple.AppleImage); }