public GameObject(ObjectType mObjectType, ContentManager content, SpriteState defaultState, Vector2 SpritePosition, Hostility hostility)
        {
            this.mDirection = Vector2.Zero;

            this.mObjectType = mObjectType;
            this.mRace = mRace;
            this.mSpriteState = defaultState;
            this.mSprite = new Sprite(content);
            this.hostility = hostility;

            mInPlayItemDropList = new JLinkedList();
            mProjectileAnimationList = new List<Animation>();
            mUnitAnimationList = new List<Animation>();
            this.mSprite.WorldPosition = SpritePosition;

            if (this is Hero)
            {
                mPotentialTargetListList.InsertLast(this);
            }

            if (this.hostility == Hostility.CASTLE || this is Hero)
            {
                mInPlayObjectList.InsertLast(this);
            }

            if (this.hostility == Hostility.PROJECTILE)
            {
                mInPlayProjectileList.InsertLast(this);
            }

            // I know what type of game object I am now, so populate
            // my list of available animations.
            PopulateLists();
            // Initialize the default animation.
            if (this.mSprite.AssetName == null && this.hostility != Hostility.PROJECTILE && this.hostility != Hostility.ITEMDROP)
            {
                this.mSprite.AssetName = mUnitAnimationList.ElementAt(0).mAnimationName;
            }
        }
        public void Draw()
        {
            //GameObject.GetSprite.Draw
            switch (gameState)
            {
                case GameState.MAIN_MENU:
                    UserInterfaceController.DrawMainMenu(spriteBatch);

                    UserInterfaceController.DrawMouse(spriteBatch);
                    break;

                case GameState.ACTIVE:

                    mInPlayObjectList = GameObject.mInPlayObjectList;
                    mDirtLevel.Draw(spriteBatch);

                    DrawInPlayObjects();

                    //spriteBatch.Draw(mRedBar, mCastleHealthBarRectangle, source, Color.White, MathHelper.ToRadians(180), new Vector2(source.Width/2,source.Height/2), SpriteEffects.None, 0);

                    spriteBatch.Draw(mRedBar, new Rectangle(1560, 280, 50, (int)(400 * (mCastle.CastleAttribute.CurrentHealthPoints / mCastle.CastleAttribute.MaxHealthPoints))), new Rectangle(1560, 280, 50, 400), Color.Red);

                    DrawInPlayProjectiles();
                    DrawInPlayItemDrops();
                    if (!mDirtLevel.PlayingMusic)
                        mDirtLevel.PlayLevelMusic();

                    UserInterfaceController.DrawUIActiveState(spriteBatch);
                    Notification.DrawDamageNumbers(spriteBatch);
                    Notification.DrawHealingNumbers(spriteBatch);
                    Notification.DrawLevelBanner(spriteBatch);
                    break;

                case GameState.PAUSE:
                    break;

                case GameState.ROUND_OVER:
                    UserInterfaceController.DrawWaveComplete(spriteBatch);
                    break;

                case GameState.GAME_OVER:
                    break;
            }

            DrawDebugInterface();
        }
        public void LoadGame()
        {
            //Load UserInterface.
            //Load Debugger.
            //PopulateLists
            //gameObject.GetSprite.LoadContent.
            //gameObject.PostSetSpriteFram().
            //Set Starting gamestate
            // pass gametime.

            PlayingField = new Rectangle(0, 25, 1380, 775);

            randomGenerator = new Random();

            // EnemyTimeToSpawn = randomGenerator.Next(7000, 15000);

            mRedTimeElapsed = 0f;
            mBlueTimeElapsed = 0f;
            mGreenTimeElapsed = 0f;
            mYellowTimeElapsed = 0f;
            mPurpleTimeElapsed = 0f;

            Graveyard = new JLinkedList();
            mInPlayItemDropList = new JLinkedList();
            mInPlayObjectList = new JLinkedList();
            mInPlayProjectileList = new JLinkedList();

            mDebugGridState = DebugGrid.GRID_DISABLED;
            Debug.EnableGrid = DisplayGrid;
            Debug.EnableGodModeFunction = EnableGodMode;
            LoadDebugger();

            PopulateLists();

            UserInterfaceController.mCastle = mCastle;
            UserInterfaceController.mHero = mHero;
            UserInterfaceController.LoadUserInterface(gameTime, content, spriteBatch);
            InitializeInPlayStructures(ref  InPlayStructures);
            InitializeStructurePool(ref StructurePool);
            InitializeFriendlyPool(ref FriendlyPool);

            // Create Castle
            mCastle.Sprite.LoadContent();
            mCastle.PostSetSpriteFrame();
            //mCastleHealthBarTexture = content.Load<Texture2D>("Sprites/Castle/HealthBar");
            mRedBar = content.Load<Texture2D>("Sprites/PixelTextures/solidred");
            source = new Rectangle(1565, 450, 50, 300);
            mCastleHealthBarRectangle = new Rectangle(1565, 450, 50, 300);
            // Populate Enemies Menus, and Levels.
            mHero.Sprite.LoadContent();

            // Create HERO
            mHero.PostSetSpriteFrame();
            mHero.PlayingField = PlayingField;

            // Create Level
            mDirtLevel = new Level(new Rectangle(0, 0, screenWidth, screenHeight), mLevelTexture, "Audio/Songs/Battle Music", content);
            WaveController.Castle = mCastle;
            WaveController.Content = content;
            WaveController.InitializeWaveController();

            PassGameTime();

            Notification.LoadNotificationFont(content);
            Notification.LoadLevelUpRibbon(content);

            ChangeGameState(GameState.LOAD);
        }
        public void Update()
        {
            PassGameTime();
            UpdateDebugger();
            //gameObject.Update
            //gameObject.GetSprite.Update

            switch (gameState)
            {
                case GameState.MAIN_MENU:

                    UserInterfaceController.UpdateMainMenu(gameTime);
                    UserInterfaceController.UpdateMouse(gameTime);
                    break;

                case GameState.ACTIVE:

                    GameObject.FromSaveGameState = FromSaveGameState;
                    UserInterfaceController.mInPlayObjectList = mInPlayObjectList;
                    RoundTimer += gameTime.ElapsedGameTime.Milliseconds;
                    mInPlayObjectList = GameObject.mInPlayObjectList;
                    mInPlayProjectileList = GameObject.mInPlayProjectileList;
                    UpdateStructures();
                    UpdateInPlayObjects();

                    UpdateProjectiles();
                    UpdateInPlayItemDrops();
                    CheckItemDropCollision();
                    Notification.UpdateDamageNumbers(gameTime);
                    Notification.UpdateHealingNumbers(gameTime);
                    Notification.UpdateLevelBanner(gameTime);
                    UserInterfaceController.UpdateUIActiveState(gameTime);

                    if (mGodMode == GodMode.ACTIVATED)
                    {
                        mHero.HeroAttribute.MaxHealthPoints = 9999;
                        mHero.HeroAttribute.MaxMana = 9999;
                        mHero.HeroAttribute.Gold = 999999;
                        mHero.HeroAttribute.Level = 98;
                        mHero.HeroAttribute.OwnedArmories = 5;
                        mHero.HeroAttribute.OwnedBarracks = 5;
                        mHero.HeroAttribute.OwnedBonePit = 5;
                        mHero.HeroAttribute.OwnedDragonCaves = 5;
                        mHero.HeroAttribute.OwnedFireTemple = 5;
                        mHero.HeroAttribute.OwnedLibraries = 5;
                        mHero.HeroAttribute.OwnedWolfPens = 5;
                        mHero.HeroAttribute.OwnedAbbey = 5;
                        mHero.HeroAttribute.LevelUp();
                        WaveController.WaveNumber = 60;
                    }

                    SpawnEnemy();

                    break;

                case GameState.PAUSE:
                    break;

                case GameState.ROUND_OVER:
                    UserInterfaceController.UpdateWaveComplete(gameTime);
                    break;

                case GameState.GAME_OVER:

                    break;
            }
        }
Exemple #5
0
 public JTargetQueue()
 {
     mTargetList = new JLinkedList();
     mCount = 0;
     mCurrent = null;
 }