public static void performSustainedMorph(GameLocation location, int x, int y, Tile tile) { Location loc = new Location(x, y); bool morphPresent = false; TileMorph thisMorph = null; foreach (TileMorph morph in currentMorphs) { if (morph.Equals(loc)) { morphPresent = true; thisMorph = morph; morph.timeRemaining = Math.Max(1, morph.timeRemaining); break; } } if (!morphPresent) { thisMorph = new TileMorph(tile, location, loc); currentMorphs.Add(thisMorph); } if (thisMorph == null) { return; } tile.Layer.Tiles[x, y] = thisMorph.tileMorph; }
public override bool Equals(object value) { if (value is Location) { Location otherLoc = (Location)value; return(tileLocation.X == otherLoc.X && tileLocation.Y == otherLoc.Y); } if (value is TileMorph) { TileMorph otherMorph = (TileMorph)value; return(tileLocation.X == otherMorph.tileLocation.X && tileLocation.Y == otherMorph.tileLocation.Y); } return(false); }