Example #1
0
        public MapView()
        {
            layerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.Ground);

            ViewGroupId = new HashSet <int>();
            Enabled     = true;
        }
        public WaypointConnectionView()
        {
            lineLayerDepth = SortingOrder.GetLayerDepth(-5, SortingLayer.WayPoints);
            pixel          = new Texture2D(Game1.Graphics, 1, 1);
            pixel.SetData(new Color[] { Color.White });

            Enabled = true;
        }
Example #3
0
        public WaypointView(WaypointSelector pointSelector)
        {
            this.pointSelector = pointSelector;

            selectedWaypointHightLight = Circle.GetTexture(Game1.Graphics, (int)(WaypointManager.DefaultWaypointRadius * 2 * 1.3f));
            waypointLayerDepth         = SortingOrder.GetLayerDepth(0, SortingLayer.WayPoints);

            Enabled = true;
        }
Example #4
0
        private void Load()
        {
            // Load Maps.
            MapManager.LoadAllMaps();
            for (int i = 0; i < MapManager.TotalLoadedMaps; i++)
            {
                AssetManager.AddTexture($"Thumbnail{i}", AssetManager.LoadTexture2D(Game1.Graphics, MapManager.Maps[i].ThumbnailPath));
            }

            // Load Textures.
            Texture2D tileSheet;

            AssetManager.AddTexture("TileSheet", tileSheet = Game1.ContentManager.Load <Texture2D>("tileSheet"));
            Texture2D pixel = new Texture2D(Game1.Graphics, 1, 1);

            pixel.SetData(new Color[] { Color.White });
            AssetManager.AddTexture("Pixel", pixel);

            // Load Fonts.
            AssetManager.AddFont("BaseFont", Game1.ContentManager.Load <SpriteFont>("BaseFont"));

            // Load Sprites.
            AssetManager.AddSprite("TowerBase1", new Sprite(tileSheet, new Rectangle(1216, 448, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("TowerBase2", new Sprite(tileSheet, new Rectangle(1280, 448, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("TowerBase3", new Sprite(tileSheet, new Rectangle(1344, 448, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("TowerBase4", new Sprite(tileSheet, new Rectangle(1408, 448, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("Tower1", new Sprite(tileSheet, new Rectangle(1216, 640, 64, 64), new Vector2(20, 33)));
            AssetManager.AddSprite("Tower2", new Sprite(tileSheet, new Rectangle(1088, 704, 64, 64), new Vector2(37, 33)));
            AssetManager.AddSprite("PlaneShadow1", new Sprite(tileSheet, new Rectangle(1088, 768, 64, 64), new Vector2(37, 33)));
            AssetManager.AddSprite("Enemy1", new Sprite(tileSheet, new Rectangle(960, 640, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("Enemy2", new Sprite(tileSheet, new Rectangle(1024, 640, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("Enemy3", new Sprite(tileSheet, new Rectangle(1088, 640, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("Enemy4", new Sprite(tileSheet, new Rectangle(1152, 640, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("Bullet1", new Sprite(tileSheet, new Rectangle(1216, 704, 64, 64), new Vector2(32, 32)));
            AssetManager.AddSprite("Bullet2", new Sprite(tileSheet, new Rectangle(1344, 640, 64, 64), new Vector2(42, 30)));
            AssetManager.AddSprite("Fire1", new Sprite(tileSheet, new Rectangle(1216, 768, 64, 64), new Vector2(20, 29)));

            // Create Enemy prefabs.
            float enemyLayerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.Enemies);

            EnemyFactory.Add("Enemy1", new Enemy(null, AssetManager.GetSprite("Enemy1"), hitboxRadius: 15f, scale: 1f, speed: 280f, health: 100f, armor: 10f, damage: 5f, enemyLayerDepth + 0.000f));
            EnemyFactory.Add("Enemy2", new Enemy(null, AssetManager.GetSprite("Enemy2"), 15f, 1.1f, 450f, 300f, 20f, 10f, enemyLayerDepth + 0.001f));
            EnemyFactory.Add("Enemy3", new Enemy(null, AssetManager.GetSprite("Enemy3"), 20f, 1.5f, 270f, 1000f, 110f, 24f, enemyLayerDepth + 0.002f));
            EnemyFactory.Add("Enemy4", new Enemy(null, AssetManager.GetSprite("Enemy4"), 30f, 3f, 100f, 1500f, 110f, 50f, enemyLayerDepth + 0.003f));

            // Create Bullet prefabs.
            float bulletLayerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.Bullets);

            BulletFactory.Add("Bullet1", new Bullet(AssetManager.GetSprite("Bullet1"), 400f, 1100f, 100, bulletLayerDepth + 0.000f));
            BulletFactory.Add("Bullet2", new Bullet(AssetManager.GetSprite("Bullet2"), 400f, 1100f, 280f, bulletLayerDepth + 0.000f));
        }
Example #5
0
        public TestTower(BulletManager bulletManager, EnemyManager enemyManager, ParticleManager particleManager)
            : base(AssetManager.GetSprite("TowerBase2"), AssetManager.GetSprite("Tower1"), 26f, 250f)
        {
            BulletManager        = bulletManager;
            EnemyManager         = enemyManager;
            this.particleManager = particleManager;

            BaseLayerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.TowerBase) + extraDepth;
            TopLayerDepth  = SortingOrder.GetLayerDepth(0, SortingLayer.TowerTop) + extraDepth;

            barrelLength    = 38f;
            ShootRate       = 0.2f;
            shootBullet     = BulletFactory.GetBullet("Bullet2");
            SearchAlgorithm = new FirstEnemySearch();
        }
Example #6
0
        public EnemyManager()
        {
            float gridWidth  = 140;
            Point mapSize    = MapManager.LoadedMap.GroundTexture.Bounds.Size;
            Point totalGrids = new Point((int)Math.Ceiling(mapSize.X / gridWidth), (int)Math.Ceiling(mapSize.Y / gridWidth));
            Point gridSize   = new Point((int)Math.Ceiling(mapSize.X / (float)totalGrids.X), (int)Math.Ceiling(mapSize.Y / (float)totalGrids.Y));

            spacePartitioner = new SpacePartitioner(totalGrids, gridSize);

            font       = AssetManager.GetFont("BaseFont");
            layerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.Ui);

            DebugWorldDivider = false;
            ControllerGroupId = new HashSet <int>();
            ViewGroupId       = new HashSet <int>();
            Enabled           = true;
        }
Example #7
0
        public MachineGunPlaneTower(BulletManager bulletManager, EnemyManager enemyManager, ParticleManager particleManager)
            : base(AssetManager.GetSprite("TowerBase1"), AssetManager.GetSprite("Tower2"), 26f, 150f)
        {
            BulletManager        = bulletManager;
            EnemyManager         = enemyManager;
            this.particleManager = particleManager;

            BaseLayerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.TowerBase) + extraDepth;
            TopLayerDepth  = SortingOrder.GetLayerDepth(0, SortingLayer.Flying) + extraDepth;

            barrelLength    = 10f;
            ShootRate       = 0.1f;
            shootBullet     = BulletFactory.GetBullet("Bullet1");
            SearchAlgorithm = new FirstEnemySearch();

            shadowSprite = AssetManager.GetSprite("PlaneShadow1");

            rotationRadius     = 150f;
            planeRotationSpeed = (float)Math.PI * 0.004f;
        }