Advertisement
ZeronSix

Untitled

Jan 5th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.49 KB | None | 0 0
  1. using System;
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. using Microsoft.Xna.Framework.Storage;
  5. using Microsoft.Xna.Framework.Input;
  6.  
  7. namespace Flixel
  8. {
  9.     /// <summary>
  10.     /// This is a useful "generic" Flixel object. Both FlxObject and FlxGroup extend this class, as do the plugins.
  11.     /// Has no size, position or graphical data.
  12.     /// </summary>
  13.     public class FlxBasic
  14.     {
  15.         /// <summary>
  16.         /// IDs seem like they could be pretty useful, huh?
  17.         /// They're not actually used for anything yet though.
  18.         /// </summary>
  19.         public int ID;
  20.         /// <summary>
  21.         /// Controls whether  <see cref="Flixel.FlxBasic.Update"/> and <<see cref"Flixel.FlxBasic.Draw"/> are automatically called by FlxState/FlxGroup.
  22.         /// </summary>
  23.         public bool Exists;
  24.         /// <summary>
  25.         /// Controls whether <see cref="Flixel.FlxBasic.Update"/> is automatically called by FlxState/FlxGroup.
  26.         /// </summary>
  27.         public bool Active;
  28.         /// <summary>
  29.         /// Controls whether <see cref="Flixel.FlxBasic.Draw"/> is automatically called by FlxState/FlxGroup.
  30.         /// </summary>
  31.         public bool Visible;
  32.         /// <summary>
  33.         /// Useful state for many game objects - "dead" (!alive) vs alive.
  34.         /// <see cref="Flixel.FlxBasic.Kill"/> and <see cref="Flixel.FlxBasic.Revive"/> both flip this switch (along with exists, but you can override that).
  35.         /// </summary>
  36.         public bool Alive;
  37.         /// <summary>
  38.         /// Setting this to true will prevent the object from appearing
  39.         /// when the visual debug mode in the debugger overlay is toggled on.
  40.         /// </summary>
  41.         public bool IgnoreDrawDebug;
  42.  
  43.         // TODO: Add cameras array
  44.  
  45.         /// <summary>
  46.         /// Instantiate the basic flixel object.
  47.         /// </summary>
  48.         public FlxBasic()
  49.         {
  50.             ID = -1;
  51.             Exists = true;
  52.             Active = true;
  53.             Visible = true;
  54.             Alive = true;
  55.             IgnoreDrawDebug = false;
  56.         }
  57.  
  58.         /// <summary>
  59.         ///
  60.         /// Override this function to null out variables or manually call
  61.         /// <see cref="Flixel.FlxBasic.Destroy"/> on class members if necessary.
  62.         /// Don't forget to call <see cref="base.Destroy"/> code!
  63.         /// </summary>
  64.         public virtual void Destroy() {}
  65.  
  66.         /// <summary>
  67.         /// Pre-update is called right before <code>update()</code> on each object in the game loop.
  68.         /// </summary>
  69.         public virtual void PreUpdate()
  70.         {
  71.             // TODO: implement ACTIVECOUNT variable
  72.         }
  73.  
  74.         /// <summary>
  75.         /// Override this function to update your class's position and appearance.
  76.         /// This is where most of your game rules and behavioral code will go.
  77.         /// </summary>
  78.         /// <param name='gameTime'>
  79.         /// Provides a snapshot of timing values.
  80.         /// </param>
  81.         public virtual void Update(GameTime gameTime) {}
  82.  
  83.         /// <summary>
  84.         /// Post-update is called right after <code>update()</code> on each object in the game loop.
  85.         /// </summary>
  86.         public virtual void PostUpdate() {}
  87.  
  88.         /// <summary>
  89.         /// Override this function to control how the object is drawn.
  90.         /// Overriding <see cref="Flixel.FlxBasic.Draw"/> is rarely necessary, but can be very useful.
  91.         /// </summary>
  92.         /// <param name='gameTime'>
  93.         /// Provides a snapshot of timing values.
  94.         /// </param>
  95.         public virtual void Draw(GameTime gameTime)
  96.         {
  97.             // TODO: implement drawing code
  98.         }
  99.  
  100.         /// <summary>
  101.         /// Override this function to draw custom "debug mode" graphics to the
  102.         /// specified camera while the debugger's visual mode is toggled on.
  103.         /// </summary>
  104.         public virtual void DrawDebug(/* TODO: place camera variable here */) {}
  105.  
  106.         /// <summary>
  107.         /// Handy function for "killing" game objects.
  108.         /// Default behavior is to flag them as nonexistent AND dead.
  109.         /// However, if you want the "corpse" to remain in the game,
  110.         /// like to animate an effect or whatever, you should override this,
  111.         /// setting only alive to false, and leaving exists true.
  112.         /// </summary>
  113.         public void Kill()
  114.         {
  115.             Alive = false;
  116.             Exists = false;
  117.         }
  118.  
  119.         /// <summary>
  120.         /// Handy function for bringing game objects "back to life". Just sets alive and exists back to true.
  121.         /// In practice, this function is most often called by <see cref="Flixel.FlxObject.Reset"/>.
  122.         /// </summary>
  123.         public void Revive()
  124.         {
  125.             Alive = true;
  126.             Exists = true;
  127.         }
  128.  
  129.         /// <summary>
  130.         /// Convert object to readable string name. Useful for debugging, save games, etc.
  131.         /// </summary>
  132.         /// <returns>
  133.         /// A <see cref="System.String"/> that represents the current class name>.
  134.         /// </returns>
  135.         public string ToString()
  136.         {
  137.             // TODO: call getClassName() from FlxU here
  138.             return null;
  139.         }
  140.     }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement