Esempio n. 1
0
        internal void resize(Vector2 resizeVect, bool fillWithGrid = false)
        {
            PendingRoomResize = delegate
            {

                worldWidth = (int)resizeVect.X;
                worldHeight = (int)resizeVect.Y;
                int newCellsX = worldWidth / gridsystemAffect.cellWidth;
                int gridHeight = fillWithGrid ? worldHeight : OrbIt.ScreenHeight;
                gridsystemAffect = new GridSystem(this, newCellsX, new Vector2(0, worldHeight - gridHeight), worldWidth, gridHeight);
                level = new Level(this, newCellsX, newCellsX, gridsystemAffect.cellWidth, gridsystemAffect.cellHeight);
                //roomRenderTarget = new RenderTarget2D(game.GraphicsDevice, worldWidth, worldHeight);
                collisionManager.gridsystemCollision = new GridSystem(this, newCellsX, new Vector2(0, worldHeight - gridHeight), worldWidth, gridHeight);
                fillWithGrid = false;

                camera.pos = new Vector2(worldWidth / 2, worldHeight / 2);
            };
        }
Esempio n. 2
0
        public Room(OrbIt game, int worldWidth, int worldHeight, bool Groups = true)
        {
            groups = new RoomGroups(this);
            AllActiveLinks = new ObservableHashSet<Link>();
            AllInactiveLinks = new ObservableHashSet<Link>();

            this.worldWidth = worldWidth;
            this.worldHeight = worldHeight;

            scheduler = new Scheduler();
            borderColor = Color.DarkGray;

            // grid System
            gridsystemAffect = new GridSystem(this, 40, new Vector2(0, worldHeight - OrbIt.ScreenHeight), worldWidth, OrbIt.ScreenHeight);
            collisionManager = new CollisionManager(this);
            //gridsystemAffect = new GridSystem(this, 40, new Vector2(0, worldHeight - OrbIt.Height), worldWidth, OrbIt.Height);
            level = new Level(this, 40, 40, gridsystemAffect.cellWidth, gridsystemAffect.cellHeight);
            roomRenderTarget = new RenderTarget2D(game.GraphicsDevice, OrbIt.ScreenWidth, OrbIt.ScreenHeight);
            //gridsystemCollision = new GridSystem(this, gridsystemAffect.cellsX, new Vector2(0, worldHeight - OrbIt.Height), worldWidth, OrbIt.Height);
            camera = new ThreadedCamera(this, 1f);
            DrawLinks = true;
            scheduler = new Scheduler();

            players = new HashSet<Player>();

            #region ///Default User props///
            Dictionary<dynamic, dynamic> userPr = new Dictionary<dynamic, dynamic>() {
                { nodeE.position, new Vector2(0, 0) },
                { nodeE.texture, textures.blackorb },
            };
            #endregion

            defaultNode = new Node(this, userPr);
            defaultNode.name = "master";
            //defaultNode.IsDefault = true;

            foreach(Component c in defaultNode.comps.Values)
            {
                c.AfterCloning();
            }

            Node firstdefault = new Node(this, ShapeType.Circle);
            //firstdefault.addComponent(comp.itempayload, true);
            Node.cloneNode(defaultNode, firstdefault);
            firstdefault.name = "[G0]0";
            //firstdefault.IsDefault = true;

            masterGroup = new Group(this, defaultNode, null, defaultNode.name, false);
            if (Groups)
            {
                new Group(this, defaultNode, masterGroup, "General Groups", false);
                new Group(this, defaultNode, masterGroup, "Preset Groups", false);
                new Group(this, defaultNode.CreateClone(this), masterGroup, "Player Group", true);
                new Group(this, defaultNode, masterGroup, "Item Group", false);
                new Group(this, defaultNode, masterGroup, "Link Groups", false);
                new Group(this, defaultNode.CreateClone(this), masterGroup, "Bullet Group", true);
                new Group(this, defaultNode, masterGroup, "Wall Group", true);
                new Group(this, firstdefault, groups.general, "Group1");
            }

            Dictionary<dynamic, dynamic> userPropsTarget = new Dictionary<dynamic, dynamic>() {
                    { typeof(ColorChanger), true },
                    { nodeE.texture, textures.ring }
            };

            targetNodeGraphic = new Node(this,userPropsTarget);

            targetNodeGraphic.name = "TargetNodeGraphic";

            //MakeWalls(WallWidth);

            MakePresetGroups();
            MakeItemGroups();
        }