Example #1
0
        /// <summary>
        /// Shoot a bullet directly at the specified target.
        /// </summary>
        /// <param name="targetPosition">The bullet's target</param>
        /// <param name="gameTime">The current time, used for firing rate</param>
        public void ShootAt(Character shooter, Vector2 targetPosition, GameTime gameTime)
        {
            if ((ammunition > 0 || ammunition == -1) && lastFired + cooldown < gameTime.TotalRealTime.TotalMilliseconds)
            {
                lastFired = gameTime.TotalRealTime.TotalMilliseconds;

                Engine.lua.CallOn(state, "ShootAt", shooter, targetPosition, gameTime);
                if ((ammunition > 0) && (!SnailsPace.cheatInfiniteAmmo)) ammunition--;

                if (shooter is Helix)
                {
                    Engine.sound.play(cue);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Starts up a game engine for the specified map
        /// </summary>
        /// <param name="mapName">The name given to the map in the file system</param>
        public Engine(String mapName)
        {
            if (instance != null)
            {
                #region Cleanup the old instance
                instance = null;
                map = null;
                bullets = null;
                explosions = null;
                lua = null;
                sound = null;
                player = null;
				boss = null;
                System.GC.Collect();
                #endregion
            }
            instance = this;
            sound = SnailsPace.soundManager;
            
            // Stuff needed by maps
            loadFonts();
            
            // Initialize Lua, the Player, and the Map
            lua = new GameLua(mapName);
            map = new Map(mapName);

            // Setup lists for objects that will be used later
            bullets = new List<Bullet>();
            explosions = new List<Explosion>();
            collidingObjects = new List<GameObject>();

            // Load the Fonts, Sprites, and some helper Game Objects that will be needed.
            loadHUD();
            setupPauseOverlay();
            setupMapBounds();

            // Initialize the Renderer
            setupGameRenderer();
        }
Example #3
0
 /// <summary>
 /// Called when a character is inside of a trigger.
 /// </summary>
 /// <param name="character">The character inside the trigger.</param>
 public void triggerIn(Character character)
 {
     inside = true;
     Engine.lua.CallOn(state, "triggerIn", character, Engine.gameTime);
 }
Example #4
0
 /// <summary>
 /// Called when a characer exits a trigger.
 /// </summary>
 /// <param name="character"></param>
 public void triggerOut(Character character)
 {
     inside = false;
     Engine.lua.CallOn(state, "triggerOut", character, Engine.gameTime);
 }
Example #5
0
 /// <summary>
 /// Trigger the trigger.
 /// </summary>
 /// <param name="character">The character that triggered the trigger.</param>
 public void trigger(Character character)
 {
     Engine.lua.CallOn(state, "trigger", character, Engine.gameTime);
 }