X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FTrigger.cs;h=e405aa9fb027ca6432e977d2abe497845d4c9eeb;hp=25cc11efa1ff0ead9f574de5231166729f1ac0a0;hb=60d05271b295d2ca94a0028059add525c1bbffb1;hpb=d167160264cd2c33de81a71039eddbb959c40bb2 diff --git a/CarFire/CarFire/CarFire/Trigger.cs b/CarFire/CarFire/CarFire/Trigger.cs index 25cc11e..e405aa9 100644 --- a/CarFire/CarFire/CarFire/Trigger.cs +++ b/CarFire/CarFire/CarFire/Trigger.cs @@ -17,6 +17,13 @@ namespace CarFire { #region Public Methods + /// + /// Construct a trigger entity. + /// + /// The entity identifier. + /// The position. + /// The key-value pairs. + /// The game reference. public Trigger(char identifier, Point position, Dictionary info, Game game) { mGame = game; @@ -38,7 +45,11 @@ namespace CarFire else throw new Exception("Triggers must define an event script."); } - public void Update(TimeSpan timeSpan) + /// + /// Check the trigger condition and execute the event if the + /// condition evaluates to true. + /// + public void Call() { Player player = mGame.GetPlayerAtCoordinates(mCoordinates); if (player != null) @@ -56,16 +67,31 @@ namespace CarFire } } - public void LoadContent(ContentManager contentManager) + + /// + /// Calls the trigger. + /// + /// Unused. + public virtual void Update(TimeSpan timeSpan) + { + Call(); + } + + public virtual void LoadContent(ContentManager contentManager) { // No implementation needed. } - public void Draw(SpriteBatch spriteBatch) + public virtual void Draw(SpriteBatch spriteBatch) { // No implementation needed. } + public bool IsCollidable + { + get { return false; } + } + public Vector2 Position { get { return Vector2.Zero; } @@ -73,7 +99,7 @@ namespace CarFire public Point Coordinates { - get { return new Point(-1, -1); } + get { return mCoordinates; } } #endregion