/// <summary> /// Stores the points of entry for the level whose name you pass as a parameter. /// </summary> /// <param name="levelName">Level name.</param> /// <param name="entryIndex">Entry index.</param> /// <param name="exitIndex">Exit index.</param> public virtual void StorePointsOfEntry(string levelName, int entryIndex, CharacterStates.FacingDirections facingDirection) { if (PointsOfEntry.Count > 0) { foreach (PointsOfEntryStorage point in PointsOfEntry) { if (point.LevelName == levelName) { point.PointOfEntryIndex = entryIndex; return; } } } PointsOfEntry.Add(new PointsOfEntryStorage(levelName, entryIndex, facingDirection)); }
/// <summary> /// Forces the character to face right or left /// </summary> /// <param name="facingDirection">Facing direction.</param> public virtual void Face(CharacterStates.FacingDirections facingDirection) { // Flips the character horizontally if (facingDirection == CharacterStates.FacingDirections.Right) { if (!IsFacingRight) { Flip(true); } } else { if (IsFacingRight) { Flip(true); } } }
public PointsOfEntryStorage(string levelName, int pointOfEntryIndex, CharacterStates.FacingDirections facingDirection) { LevelName = levelName; FacingDirection = facingDirection; PointOfEntryIndex = pointOfEntryIndex; }