コード例 #1
0
ファイル: LaserNetwork.cs プロジェクト: ssttv/GridDominance
        public LaserNetwork(World b2dworld, GDGameScreen scrn, GameWrapMode wrap)
        {
            _screen = scrn;
            _world  = b2dworld;

            _rayLength = scrn.Blueprint.LevelWidth + scrn.Blueprint.LevelHeight;
            _wrapMode  = wrap;
        }
コード例 #2
0
        public GDCellularBackground(GDGameScreen scrn, LevelBlueprint lvl) : base(scrn)
        {
            tileCountX = FloatMath.Ceiling(lvl.LevelWidth / 64f) + 2 * MAX_EXTENSION_X;
            tileCountY = FloatMath.Ceiling(lvl.LevelHeight / 64f) + 2 * MAX_EXTENSION_Y;
            wrapMode   = scrn.WrapMode;

            _grid = new GridCellMembership[tileCountX, tileCountY];

            Initialize();
        }
コード例 #3
0
        public LevelEditorConfigPanel(SCCMLevelData data) : base()
        {
            _data = data;

            _id       = _data.OnlineID;
            _name     = _data.Name;
            _size     = _data.Size;
            _view     = _data.View;
            _geometry = _data.Geometry;
            _music    = data.Music;
        }
コード例 #4
0
        private void ToggleGeometry(HUDTextButton sender, HUDButtonEventArgs e)
        {
            switch (_geometry)
            {
            case GameWrapMode.Death:   _geometry = GameWrapMode.Donut;   break;

            case GameWrapMode.Donut:   _geometry = GameWrapMode.Reflect; break;

            case GameWrapMode.Reflect: _geometry = GameWrapMode.Death;   break;

            default:                   _geometry = GameWrapMode.Donut;   break;
            }

            RefreshControls();
        }
コード例 #5
0
ファイル: GDGameScreen.cs プロジェクト: ssttv/GridDominance
        private void LoadLevelFromBlueprint()
        {
            Fraction[] fracList = { fractionNeutral, fractionPlayer, fractionComputer1, fractionComputer2, fractionComputer3 };

            //----------------------------------------------------------------

            MapFullBounds      = new FRectangle(0, 0, Blueprint.LevelWidth, Blueprint.LevelHeight);
            MapViewportCenterX = Blueprint.LevelViewX;
            MapViewportCenterY = Blueprint.LevelViewY;
            WrapMode           = (GameWrapMode)Blueprint.WrapMode;

            if (WrapMode == GameWrapMode.Donut || WrapMode == GameWrapMode.Reflect)
            {
                VAdapterGame.ChangeVirtualSize(GDConstants.VIEW_WIDTH + GDConstants.TILE_WIDTH, GDConstants.VIEW_HEIGHT + GDConstants.TILE_WIDTH);
                MapViewportCenterX = Blueprint.LevelViewX;
                MapViewportCenterY = Blueprint.LevelViewY;
            }

            if (MainGame.Inst.Profile.EffectsEnabled && WrapMode == GameWrapMode.Donut)
            {
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.NN));
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.EE));
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.SS));
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.WW));
            }

            if (MainGame.Inst.Profile.EffectsEnabled)
            {
                Background = new GDCellularBackground(this, Blueprint);
            }
            else
            {
                Background = new GDStaticGridBackground(this, WrapMode);
            }

            //----------------------------------------------------------------

            var cannonList   = new List <Cannon>();
            var portalList   = new List <Portal>();
            var fractionList = new List <Fraction>();
            var laserworld   = false;

            fractionList.Add(fractionNeutral);

            foreach (var bPrint in Blueprint.BlueprintCannons)
            {
                var e = new BulletCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintMinigun)
            {
                var e = new MinigunCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintRelayCannon)
            {
                var e = new RelayCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintTrishotCannon)
            {
                var e = new TrishotCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintVoidWalls)
            {
                var e = new VoidWall(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintVoidCircles)
            {
                var e = new VoidCircle(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintGlassBlocks)
            {
                var e = new GlassBlock(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintBlackHoles)
            {
                var e = new BlackHole(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintPortals)
            {
                var e = new Portal(this, bPrint);
                Entities.AddEntity(e);
                portalList.Add(e);
            }

            foreach (var bPrint in Blueprint.BlueprintLaserCannons)
            {
                var e = new LaserCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);
                laserworld = true;

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintShieldProjector)
            {
                var e = new ShieldProjectorCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);
                laserworld = true;

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintMirrorBlocks)
            {
                var e = new MirrorBlock(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintMirrorCircles)
            {
                var e = new MirrorCircle(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintBackgroundText)
            {
                var e = new BackgroundText(this, bPrint);
                Entities.AddEntity(e);
            }

            //----------------------------------------------------------------

            if (laserworld)
            {
                Entities.AddEntity(new LaserRenderer(this, LaserNetwork, Blueprint));
            }

            AddEdgeMarker();

            //----------------------------------------------------------------

            foreach (var cannon in cannonList)
            {
                cannon.OnAfterLevelLoad();
            }


            foreach (var portal in portalList)
            {
                portal.OnAfterLevelLoad(portalList);
            }

            CannonMap = cannonList.ToDictionary(p => p.BlueprintCannonID, p => p);

            foreach (var f in fracList)
            {
                if (!fractionList.Contains(f))
                {
                    fractionList.Add(f);
                }
            }
            fractionIDList = fractionList.ToArray();

            //----------------------------------------------------------------

            if (!IsPreview && (Blueprint.LevelWidth > GDConstants.VIEW_WIDTH || Blueprint.LevelHeight > GDConstants.VIEW_HEIGHT))
            {
                AddAgent(new GameDragAgent(this));
            }
        }
コード例 #6
0
 public GDEmptyGridBackground(GDGameScreen scrn, GameWrapMode mode) : base(scrn)
 {
     _wrapMode = mode;
     _gdowner  = scrn;
 }