public DimensionalManager(EnemyManager enemyManager)
        {
            numberOfActiveDimensions = 0;
            renderPlanes = new List<RenderPlane>();
            //RenderPlane startingRenderPlane = new RenderPlane(new Rectangle(0,0,350,700), 2, 1, new Position(0.0f, 0.0f, 0.0f), this, Color.Red);
            //RenderPlane secondRenderPlane = new RenderPlane(new Rectangle(350, 0, 350, 700), 0, 1, new Position(0.0f, 0.0f, 0.0f), this, Color.Maroon);
            //secondRenderPlane.SetRender2D(true);
            //renderPlanes.Add(startingRenderPlane);
            //renderPlanes.Add(secondRenderPlane);

            this.enemyManager = enemyManager;

            numberOfUnlockedDimensions = 0;

            dimensionalUpdateDrawer = new DimensionUnlockedAnimation(Game1.defaultFont14);
        }
Beispiel #2
0
        public void Render(EnemyManager enemyManager, Player player, SpriteBatch spriteBatch)
        {
            //Draw background square
              //  spriteBatch.Draw(Game1.square, renderTarget, bg);

            Position playerPos = player.getPosition();
            Vector2 pos = GetScaledPosition(getPlanarPosition(playerPos));

            renderPosition(spriteBatch, pos, Color.Aquamarine, 32);

            foreach (Enemy enemy in enemyManager.getEnemies())
            {

                Position enemyPosition = enemy.GetPosition();
                Vector2 planarPosition = getPlanarPosition(enemyPosition);

                //if we are rendering in 1D, the GetSize takes in to account the distance in the y axis
                float size = 2 * GetSize(enemy);

                if (IsInRenderFrame(planarPosition, size))
                {
                    Vector2 drawPosition = GetScaledPosition(planarPosition);

                    switch (enemy.GetEnemyType())
                    {
                        case EnemyType.StraightLine:
                            {
                                renderPosition(spriteBatch, drawPosition, Color.Red, size);
                                break;
                            }
                        default:
                            {
                                renderPosition(spriteBatch, drawPosition, Color.Black, size);
                                break;
                            }
                    }
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     player = new Player(new Position(1));
     enemyManager = new EnemyManager();
     gameState = GameState.fadeIn;
     fadeState = 0;
     oldState = Keyboard.GetState();
     base.Initialize();
 }