Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Storage;
- using Microsoft.Xna.Framework.Input;
- namespace Flixel
- {
- /// <summary>
- /// This is a useful "generic" Flixel object. Both FlxObject and FlxGroup extend this class, as do the plugins.
- /// Has no size, position or graphical data.
- /// </summary>
- public class FlxBasic
- {
- /// <summary>
- /// IDs seem like they could be pretty useful, huh?
- /// They're not actually used for anything yet though.
- /// </summary>
- public int ID;
- /// <summary>
- /// Controls whether <see cref="Flixel.FlxBasic.Update"/> and <<see cref"Flixel.FlxBasic.Draw"/> are automatically called by FlxState/FlxGroup.
- /// </summary>
- public bool Exists;
- /// <summary>
- /// Controls whether <see cref="Flixel.FlxBasic.Update"/> is automatically called by FlxState/FlxGroup.
- /// </summary>
- public bool Active;
- /// <summary>
- /// Controls whether <see cref="Flixel.FlxBasic.Draw"/> is automatically called by FlxState/FlxGroup.
- /// </summary>
- public bool Visible;
- /// <summary>
- /// Useful state for many game objects - "dead" (!alive) vs alive.
- /// <see cref="Flixel.FlxBasic.Kill"/> and <see cref="Flixel.FlxBasic.Revive"/> both flip this switch (along with exists, but you can override that).
- /// </summary>
- public bool Alive;
- /// <summary>
- /// Setting this to true will prevent the object from appearing
- /// when the visual debug mode in the debugger overlay is toggled on.
- /// </summary>
- public bool IgnoreDrawDebug;
- // TODO: Add cameras array
- /// <summary>
- /// Instantiate the basic flixel object.
- /// </summary>
- public FlxBasic()
- {
- ID = -1;
- Exists = true;
- Active = true;
- Visible = true;
- Alive = true;
- IgnoreDrawDebug = false;
- }
- /// <summary>
- ///
- /// Override this function to null out variables or manually call
- /// <see cref="Flixel.FlxBasic.Destroy"/> on class members if necessary.
- /// Don't forget to call <see cref="base.Destroy"/> code!
- /// </summary>
- public virtual void Destroy() {}
- /// <summary>
- /// Pre-update is called right before <code>update()</code> on each object in the game loop.
- /// </summary>
- public virtual void PreUpdate()
- {
- // TODO: implement ACTIVECOUNT variable
- }
- /// <summary>
- /// Override this function to update your class's position and appearance.
- /// This is where most of your game rules and behavioral code will go.
- /// </summary>
- /// <param name='gameTime'>
- /// Provides a snapshot of timing values.
- /// </param>
- public virtual void Update(GameTime gameTime) {}
- /// <summary>
- /// Post-update is called right after <code>update()</code> on each object in the game loop.
- /// </summary>
- public virtual void PostUpdate() {}
- /// <summary>
- /// Override this function to control how the object is drawn.
- /// Overriding <see cref="Flixel.FlxBasic.Draw"/> is rarely necessary, but can be very useful.
- /// </summary>
- /// <param name='gameTime'>
- /// Provides a snapshot of timing values.
- /// </param>
- public virtual void Draw(GameTime gameTime)
- {
- // TODO: implement drawing code
- }
- /// <summary>
- /// Override this function to draw custom "debug mode" graphics to the
- /// specified camera while the debugger's visual mode is toggled on.
- /// </summary>
- public virtual void DrawDebug(/* TODO: place camera variable here */) {}
- /// <summary>
- /// Handy function for "killing" game objects.
- /// Default behavior is to flag them as nonexistent AND dead.
- /// However, if you want the "corpse" to remain in the game,
- /// like to animate an effect or whatever, you should override this,
- /// setting only alive to false, and leaving exists true.
- /// </summary>
- public void Kill()
- {
- Alive = false;
- Exists = false;
- }
- /// <summary>
- /// Handy function for bringing game objects "back to life". Just sets alive and exists back to true.
- /// In practice, this function is most often called by <see cref="Flixel.FlxObject.Reset"/>.
- /// </summary>
- public void Revive()
- {
- Alive = true;
- Exists = true;
- }
- /// <summary>
- /// Convert object to readable string name. Useful for debugging, save games, etc.
- /// </summary>
- /// <returns>
- /// A <see cref="System.String"/> that represents the current class name>.
- /// </returns>
- public string ToString()
- {
- // TODO: call getClassName() from FlxU here
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement