Made some functions that are a little easier to use for npc and farmer movement.

This commit is contained in:
JoshuaNavarro 2019-12-04 22:36:53 -08:00
parent 7c8d0bc6bd
commit f11ce9bb2f
2 changed files with 59 additions and 4 deletions

View File

@ -20,9 +20,9 @@ namespace Omegasis.HappyBirthday.Framework
conditions.Add(new FarmerBirthdayPrecondition());
conditions.Add(new LocationPrecondition(Game1.getLocationFromName("CommunityCenter")));
conditions.Add(new TimePrecondition(600, 2600));
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData(EventStartData.MusicToPlayType.Continue, 10, 10, new EventStartData.FarmerData(10, 10, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
e.setViewportPosition(10, 10);
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData(EventStartData.MusicToPlayType.Continue, 32, 22, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
e.globalFadeIn();
e.moveFarmerUp(6, EventHelper.FacingDirection.Up, false);
e.showMessage("Community center birthday here.");
e.end();

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Omegasis.HappyBirthday.Framework.Events.Preconditions;
using Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific;
@ -1190,6 +1188,63 @@ namespace Omegasis.HappyBirthday.Framework.Events
this.add(b);
}
public virtual void moveNPCUp(NPC npc, int TileAmount, FacingDirection FinishingFacingDirection,bool EventDoesntPause)
{
this.moveNPC(npc, 0, -TileAmount, FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveNPCDown(NPC npc, int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveNPC(npc, 0, TileAmount, FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveNPCLeft(NPC npc, int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveNPC(npc, TileAmount,0,FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveNPCRight(NPC npc, int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveNPC(npc,-TileAmount,0,FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveFarmer(int xOffset, int yOffset, FacingDirection Dir, bool Continue)
{
StringBuilder b = new StringBuilder();
b.Append("move ");
b.Append("farmer");
b.Append(" ");
b.Append(xOffset);
b.Append(" ");
b.Append(yOffset);
b.Append(" ");
b.Append(this.getFacingDirectionNumber(Dir));
b.Append(" ");
b.Append(Continue);
this.add(b);
}
public virtual void moveFarmerUp(int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveFarmer(0, -TileAmount, FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveFarmerDown(int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveFarmer(0, TileAmount, FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveFarmerLeft(int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveFarmer(-TileAmount,0,FinishingFacingDirection, EventDoesntPause);
}
public virtual void moveFarmerRight(int TileAmount, FacingDirection FinishingFacingDirection, bool EventDoesntPause)
{
this.moveFarmer(TileAmount, 0,FinishingFacingDirection, EventDoesntPause);
}
/// <summary>
/// Pause the game for the given number of milliseconds.
/// </summary>