public void PopState() { if (Overworld.CurrentOverworldState == this) { Overworld.PopState(); } }
public void PushState(OverworldState state) { if (Overworld.CurrentOverworldState == this) { Overworld.PushState(state); } }
public void ChangeState(OverworldState state) { if (Overworld.CurrentOverworldState == this) { Overworld.ChangeState(state); } }
protected OverworldState(Overworld overworld) { if (overworld == null) { throw new Exception("Overworld cannot be null"); } Overworld = overworld; }
public static NpcMover Create(OverworldMovementType movementType, Party party, Party playerParty, Overworld overworld) { switch (movementType) { case OverworldMovementType.Wander: return new Wander(party, overworld); case OverworldMovementType.Follow: return new Follow(party, playerParty, overworld); case OverworldMovementType.Run: return new Run(party, playerParty, overworld); default: return null; } }
public void Update(Delta delta) { if (Target != null) { Position = new Vector2((float)Math.Round(Target.Position.X), (float)Math.Round(Target.Position.Y)); TargetPosition = Position; } Overworld overworld = Scene.Current as Overworld; if (overworld != null) { Rectangle boundingBox = GetBoundingBox(); Vector2 newPosition = Position; if (boundingBox.Left < 0) { newPosition.X -= boundingBox.Left; } if (boundingBox.Top < 0) { newPosition.Y -= boundingBox.Top; } if (boundingBox.Right > overworld.Map.Width) { newPosition.X -= boundingBox.Right - overworld.Map.Width; } if (boundingBox.Bottom > overworld.Map.Height) { newPosition.Y -= boundingBox.Bottom - overworld.Map.Height; } Position = newPosition; TargetPosition = Position; } Position = updateVectorToTarget(Position, TargetPosition, delta); Scale = updateVectorToTarget(Scale, TargetScale, delta); updateScreenShake(delta); }
protected OverworldState(Overworld overworld) { if (overworld == null) throw new Exception("Overworld cannot be null"); Overworld = overworld; }
public static NpcMover Create(OverworldMovementType movementType, Party party, Party playerParty, Overworld overworld) { switch (movementType) { case OverworldMovementType.Wander: return(new Wander(party, overworld)); case OverworldMovementType.Follow: return(new Follow(party, playerParty, overworld)); case OverworldMovementType.Run: return(new Run(party, playerParty, overworld)); default: return(null); } }
public NpcMover(Party party, Overworld overworld) { this.party = party; this.overworld = overworld; }