Beispiel #1
0
        public ObjectDefinitionView(AssetViewContext context, ObjectDefinition objectDefinition)
            : base(context)
        {
            var gameObjects = new GameObjectCollection(context.Game.ContentManager);

            _gameObject = gameObjects.Add(objectDefinition, context.Game.CivilianPlayer);

            _modelConditionStates = _gameObject.ModelConditionStates.ToList();
            _selectedIndex        = 0;

            context.Game.Scene3D = new Scene3D(
                context.Game,
                new ArcballCameraController(Vector3.Zero, 200),
                null,
                null,
                Array.Empty <Terrain.WaterArea>(),
                Array.Empty <Terrain.Road>(),
                Array.Empty <Terrain.Bridge>(),
                null,
                gameObjects,
                new WaypointCollection(),
                new WaypointPathCollection(),
                WorldLighting.CreateDefault(),
                Array.Empty <Player>(),
                Array.Empty <Team>());
        }
Beispiel #2
0
        public static GameObject[] ResolveTargets(GameObject source, IEnumerable<string> TargetIds, GameObjectCollection parent, GameConsole console, bool DeepProcess)
        {
            // If it passed, find all targets and activate them
            List<GameObject> foundTargets = new List<GameObject>(5);

            foreach (var item in parent)
            {
                if (item.Value != source && TargetIds.Contains(item.Value.GetSetting("id")))
                    foundTargets.Add(item.Value);
            }

            // Process all known collections
            if (DeepProcess)
            {
                for (int i = 0; i < console.LayeredTextSurface.LayerCount; i++)
                {
                    var objects = console.GetObjectCollection(i);
                    if (objects != parent)
                    {
                        foreach (var item in objects)
                        {
                            if (item.Value != source && TargetIds.Contains(item.Value.GetSetting("id")))
                                foundTargets.Add(item.Value);
                        }
                    }
                }
            }

            return foundTargets.ToArray();
        }
Beispiel #3
0
        private void UndoPower(PowerUpEffect power)
        {
            switch (power.PowerUpEffectAction)
            {
            case PowerUpEffectAction.Grow:
                ResetSize();
                break;

            case PowerUpEffectAction.DecreaseSpeed:
                Speed *= 2;
                break;

            case PowerUpEffectAction.IncreaseSpeed:
                Speed /= 2;
                break;

            case PowerUpEffectAction.Ball_Split:
                GameObjectCollection.GetActive <Ball>(x => !x.IsMainBall).ForEach(x => x.IsActive = false);
                break;

            case PowerUpEffectAction.Ball_MultiBrickBreak:
                MultiBrickBreak = false;

                break;
            }
            this.PowerUpEffects.Remove(power);
            GameObjectCollection.ActivePowerUps.Remove(power.ToString());
        }
Beispiel #4
0
        private void Split()
        {
            //todo use the ObjectInitializer to create these instead.
            var miniBallOne = new Ball()
            {
                IsActive   = true,
                IsMainBall = false,
                Speed      = this.Speed,
                Sprite     = new Sprite()
                {
                    DrawMap = new List <Pixel>()
                },
                CurrentDirection = this.CurrentDirection != Direction.UpRight ? Direction.UpRight : Direction.DownRight
            };

            var miniBallTwo = new Ball()
            {
                IsActive   = true,
                IsMainBall = false,
                Speed      = this.Speed,
                Sprite     = new Sprite()
                {
                    DrawMap = new List <Pixel>()
                },
                CurrentDirection = this.CurrentDirection != Direction.UpLeft ? Direction.UpLeft : Direction.DownLeft
            };

            foreach (var pixel in this.Sprite.DrawMap)
            {
                miniBallOne.Sprite.DrawMap.Add(Pixel.From(pixel, color: ConsoleColor.Red));
                miniBallTwo.Sprite.DrawMap.Add(Pixel.From(pixel, color: ConsoleColor.Red));
            }
            GameObjectCollection.Inject(miniBallOne);
            GameObjectCollection.Inject(miniBallTwo);
        }
Beispiel #5
0
        private void CreateTowers(
            ContentManager contentManager,
            GameObjectCollection gameObjects,
            GameObject gameObject,
            MapObject mapObject)
        {
            var towers = new List <GameObject>();

            void CreateTower(string objectName, float x, float y)
            {
                var tower = AddDisposable(contentManager.InstantiateObject(objectName));

                var offset            = new Vector3(x, y, 0);
                var transformedOffset = Vector3.Transform(offset, gameObject.Transform.Rotation);

                tower.Transform.Translation = gameObject.Transform.Translation + transformedOffset;
                tower.Transform.Rotation    = gameObject.Transform.Rotation;

                gameObjects.Add(tower);
            }

            var landmarkBridgeTemplate = GetBridgeTemplate(contentManager, mapObject);

            var halfLength = gameObject.Definition.Geometry.MinorRadius;
            var halfWidth  = gameObject.Definition.Geometry.MajorRadius;

            CreateTower(landmarkBridgeTemplate.TowerObjectNameFromLeft, -halfWidth, -halfLength);
            CreateTower(landmarkBridgeTemplate.TowerObjectNameFromRight, halfWidth, -halfLength);
            CreateTower(landmarkBridgeTemplate.TowerObjectNameToLeft, -halfWidth, halfLength);
            CreateTower(landmarkBridgeTemplate.TowerObjectNameToRight, halfWidth, halfLength);
        }
Beispiel #6
0
        internal static BridgeTowers CreateForLandmarkBridge(
            AssetStore assetStore,
            GameObjectCollection gameObjects,
            GameObject gameObject,
            MapObject mapObject)
        {
            var worldMatrix =
                Matrix4x4.CreateFromQuaternion(gameObject.Transform.Rotation)
                * Matrix4x4.CreateTranslation(gameObject.Transform.Translation);

            var landmarkBridgeTemplate = assetStore.BridgeTemplates.GetByName(mapObject.TypeName);

            var halfLength = gameObject.Definition.Geometry.MinorRadius;
            var halfWidth  = gameObject.Definition.Geometry.MajorRadius;

            return(new BridgeTowers(
                       landmarkBridgeTemplate,
                       gameObjects,
                       worldMatrix,
                       -halfWidth,
                       -halfLength,
                       halfWidth,
                       halfLength,
                       gameObject.Transform.Rotation));
        }
Beispiel #7
0
        private Scene3D(Game game, Func <Viewport> getViewport, InputMessageBuffer inputMessageBuffer, int randomSeed, bool isDiagnosticScene, MapFile mapFile, string mapPath)
        {
            Game = game;

            PlayerManager = new PlayerManager();

            Camera = new Camera(getViewport);

            SelectionGui = new SelectionGui();

            DebugOverlay = new DebugOverlay(this, game.ContentManager);

            Random = new Random(randomSeed);

            if (mapFile != null)
            {
                MapFile    = mapFile;
                Terrain    = AddDisposable(new Terrain.Terrain(mapFile, game.AssetStore.LoadContext));
                WaterAreas = AddDisposable(new WaterAreaCollection(mapFile.PolygonTriggers, mapFile.StandingWaterAreas, mapFile.StandingWaveAreas, game.AssetStore.LoadContext));
                Navigation = new Navigation.Navigation(mapFile.BlendTileData, Terrain.HeightMap);
            }

            RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer);

            if (!isDiagnosticScene)
            {
                RegisterInputHandler(new SelectionMessageHandler(game.Selection), inputMessageBuffer);
                RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer);
                RegisterInputHandler(_debugMessageHandler        = new DebugMessageHandler(DebugOverlay), inputMessageBuffer);
            }

            ParticleSystemManager = AddDisposable(new ParticleSystemManager(game.AssetStore.LoadContext));

            Radar = new Radar(this, game.AssetStore, mapPath);

            if (mapFile != null)
            {
                var borderWidth = mapFile.HeightMapData.BorderWidth * HeightMap.HorizontalScale;
                var width       = mapFile.HeightMapData.Width * HeightMap.HorizontalScale;
                var height      = mapFile.HeightMapData.Height * HeightMap.HorizontalScale;
                Quadtree = new Quadtree <GameObject>(new RectangleF(-borderWidth, -borderWidth, width, height));
            }

            GameContext = new GameContext(
                game.AssetStore.LoadContext,
                game.Audio,
                ParticleSystemManager,
                new ObjectCreationListManager(),
                Terrain,
                Navigation,
                Radar,
                Quadtree,
                this);

            GameObjects = AddDisposable(new GameObjectCollection(GameContext));

            GameContext.GameObjects = GameObjects;

            _orderGeneratorSystem = game.OrderGenerator;
        }
Beispiel #8
0
        internal Scene3D(
            Game game,
            InputMessageBuffer inputMessageBuffer,
            Func <Viewport> getViewport,
            ICameraController cameraController,
            GameObjectCollection gameObjects,
            WorldLighting lighting,
            bool isDiagnosticScene = false)
            : this(game, getViewport, inputMessageBuffer, isDiagnosticScene)
        {
            _players = new List <Player>();
            _teams   = new List <Team>();

            // TODO: This is completely wrong.
            LocalPlayer = _players.FirstOrDefault();

            WaterAreas = AddDisposable(new WaterAreaCollection());
            Lighting   = lighting;

            Roads         = AddDisposable(new RoadCollection());
            Bridges       = Array.Empty <Bridge>();
            GameObjects   = gameObjects;
            Waypoints     = new WaypointCollection();
            WaypointPaths = new WaypointPathCollection();

            CameraController = cameraController;
        }
        public bool LoadLayer(string file)
        {
            if (System.IO.File.Exists(file))
            {
                var surface = SadConsole.TextSurface.Load(file);

                if (surface.Width != EditorConsoleManager.Instance.SelectedEditor.Surface.Width || surface.Height != EditorConsoleManager.Instance.SelectedEditor.Height)
                {
                    var newLayer = EditorConsoleManager.Instance.SelectedEditor.Surface.AddLayer("Loaded");
                    surface.Copy(newLayer.CellData);
                }
                else
                {
                    EditorConsoleManager.Instance.SelectedEditor.Surface.AddLayer(surface);
                }

                string objectFileName = file.Replace(System.IO.Path.GetExtension(file), ".object");
                if (System.IO.File.Exists(objectFileName))
                {
                    GameObjects.Add(GameObjectCollection.Load(objectFileName));
                }
                else
                {
                    GameObjects.Add(new GameObjectCollection());
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #10
0
 public void LoadContent(ContentManager Content)
 {
     font          = Content.Load <SpriteFont>("Font1");
     objects       = ObjectFactory.MakeCollection("Content/CRecycle", "recycle", Content);
     Temiztextures = TextureLoader.TextureList("Content/recycle/TRecycle");
     Kirlitextures = TextureLoader.TextureList("Content/recycle/KRecycle");
     foreach (string item in Kirlitextures)
     {
         if (item.Contains("sise"))
         {
             trashType = Trash.TrashType.glass;
         }
         else if (item.Contains("cips") || item.Contains("kagit"))
         {
             trashType = Trash.TrashType.paper;
         }
         else if (item.Contains("konserve") || item.Contains("kova"))
         {
             trashType = Trash.TrashType.metal;
         }
         else
         {
             trashType = Trash.TrashType.rubbish;
         }
         trashes.Add(new Trash(new GameObject(new Vector2(r.Next(0, 600), r.Next(100, 350)), item, "recycle", Content), trashType, Temiztextures));
         trashType = Trash.TrashType.rubbish;
     }
 }
Beispiel #11
0
        public Scene3D(
            Game game,
            ICameraController cameraController,
            MapFile mapFile,
            Terrain.Terrain terrain,
            MapScriptCollection scripts,
            GameObjectCollection gameObjects,
            WaypointCollection waypoints,
            WaypointPathCollection waypointPaths,
            WorldLighting lighting)
        {
            Camera           = new CameraComponent(game);
            CameraController = cameraController;

            MapFile       = mapFile;
            Terrain       = terrain;
            Scripts       = scripts;
            GameObjects   = AddDisposable(gameObjects);
            Waypoints     = waypoints;
            WaypointPaths = waypointPaths;
            Lighting      = lighting;

            _cameraInputMessageHandler = new CameraInputMessageHandler();
            game.InputMessageBuffer.Handlers.Add(_cameraInputMessageHandler);
            AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_cameraInputMessageHandler));

            _particleSystemManager = AddDisposable(new ParticleSystemManager(game, this));

            _players = new List <Player>();
        }
Beispiel #12
0
        public BridgeTowers(
            BridgeTemplate template,
            GameObjectCollection gameObjects,
            Matrix4x4 worldMatrix,
            float startX,
            float startY,
            float endX,
            float endY,
            Quaternion rotation)
        {
            void CreateTower(ObjectDefinition objectDefinition, float x, float y)
            {
                var tower = gameObjects.Add(objectDefinition);

                tower.Transform.Translation = Vector3.Transform(
                    new Vector3(x, y, 0),
                    worldMatrix);

                tower.Transform.Rotation = rotation;
            }

            CreateTower(template.TowerObjectNameFromLeft.Value, startX, startY);
            CreateTower(template.TowerObjectNameFromRight.Value, endX, startY);
            CreateTower(template.TowerObjectNameToLeft.Value, startX, endY);
            CreateTower(template.TowerObjectNameToRight.Value, endX, endY);
        }
Beispiel #13
0
        private void ShootGun()
        {
            var bullet = hasMegaGuns ?
                         CurrentGame.GameObjectInitializer.GetMegaBullet(Sprite.Left.Point.X, Sprite.Right.Point.X, Sprite.Top.Point.Y) :
                         CurrentGame.GameObjectInitializer.GetBullet(Sprite.Left.Point.X, Sprite.Right.Point.X, Sprite.Top.Point.Y);

            GameObjectCollection.Inject(bullet);
        }
Beispiel #14
0
 /// <summary>
 /// Creates a new Scene from an existing <see cref="LayeredTextSurface"/>.
 /// </summary>
 /// <param name="surface">The surface for the scene.</param>
 public Scene(LayeredTextSurface surface)
 {
     baseConsole = new Console(surface);
     backgroundSurface = surface;
     Objects = new GameObjectCollection();
     Zones = new List<Zone>();
     Hotspots = new List<Hotspot>();
 }
Beispiel #15
0
 public void LoadContent(ContentManager Content)
 {
     objects = ObjectFactory.MakeCollection("Content/CNumbers", "numbers/images", Content);
     for (int i = 0; i <= 9; i++)
     {
         sesler.Add(Content.Load <Song>("numbers/sound/" + i.ToString()));
     }
 }
Beispiel #16
0
 public XonixCore(Game game)
 {
     Requires.NotNull(game, "game");
     _game = game;
     _camera = new Camera2D(this);
     _gameObjects = new GameObjectCollection(this);
     _random = new Random();
 }
Beispiel #17
0
 public void LoadContent(ContentManager Content)
 {
     objects = ObjectFactory.MakeCollection("Content/CLetters", "letters/images", Content);
     foreach (string key in objects.Items.Keys)
     {
         LetterList.Add(key);
         Sounds.Add(key, Content.Load <Song>("letters/sounds/" + key));
     }
 }
Beispiel #18
0
 public void LoadContent(ContentManager Content)
 {
     objects  = ObjectFactory.MakeCollection("Content/CIller", "iller", Content);
     debugger = new DebugHelper(objects, Content, false, false);
     font     = Content.Load <SpriteFont>("Font1");
     foreach (string key in objects.Items.Keys)
     {
         Liste.Add(key.Split(new char[] { '-' })[1].ToUpperInvariant());
     }
     NewCity();
 }
Beispiel #19
0
        public void Seed(GameObjectCollection scene)
        {
            var prov = new CameraProvider();

            prov.Camera.Fov          = MathUtil.DegreesToRadians(90);
            prov.Camera.DrawDistance = 100;
            prov.Camera.NearDistance = 0.001f;
            prov.Camera.Position     = new Vector3(0, 0, -20);
            prov.Camera.Rotation     = Quaternion.RotationLookAtLH(Vector3.ForwardLH, Vector3.Up);

            //var tmp = MeshLoader.LoadScene(@"Volkswagen.fbx");

            //var go = GameObjectFactory.Create(new FbxObjectCreator(@"3_cubes (3).fbx"));
            //var go = GameObjectFactory.Create(new FbxObjectCreator(@"ZF_YUP.fbx"));

            //var go = new GameObject();

            /*var tmp = MeshLoader.LoadScene(@"personfbx_-Y_Z.fbx");
             *
             * go.Children.Add(new GameObject());
             * go.Children.Add(new GameObject());
             * go.Children.Add(new GameObject());
             *
             * go.Children[0].AddComponent<MeshRenderer>().Initialize(tmp[0].NodeMeshes[0], "vx1", "px1");
             * go.Children[1].AddComponent<MeshRenderer>().Initialize(tmp[1].NodeMeshes[0], "vx1", "px1");
             * go.Children[2].AddComponent<MeshRenderer>().Initialize(tmp[2].NodeMeshes[0], "vx1", "px1");
             *
             * go.Children[0].Position = tmp[0].Position;
             * go.Children[0].Rotation = tmp[0].Rotation;
             * go.Children[0].Scale = tmp[0].Scale;
             *
             * go.Children[1].Position = tmp[1].Position;
             * go.Children[1].Rotation = tmp[1].Rotation;
             * go.Children[1].Scale = tmp[1].Scale;
             *
             * go.Children[2].Position = tmp[2].Position;
             * go.Children[2].Rotation = tmp[2].Rotation;
             * go.Children[2].Scale = tmp[2].Scale;*/
            //personfbx_-Y_Z.fbx
            var light = new GameObject();
            var dir   = light.AddComponent <DirectionLight>();

            dir.Color     = Color3.White;
            dir.Direction = Vector3.ForwardLH;
            scene.Add(light);

            var go = GameObjectFactory.CreateAndRegister(new FbxObjectCreator(@"virt_ice_scene.fbx"));

            //go.Scale = new Vector3(0.1f);
            go.AddScript <TestScript>();

            //var meshRend = go.Children["Стол"].GetComponent<MeshRenderer>();
            //go.GetComponent<Rigidbody>().TriggerEnter += (o, x) => System.Console.WriteLine("trigger");
        }
Beispiel #20
0
 public override void Update(GameTime gameTime)
 {
     if (BrickLevel <= 0)
     {
         this.IsActive = false;
         if (GameObjectCollection.CountActive <Brick>() == 0)
         {
             this.OnGameEnd?.Invoke(this, new GameEndEvent(GameEndReason.AllBricksBroken));
         }
     }
 }
        public void Reset()
        {
            ControlPanels = new CustomPanel[] { EditorConsoleManager.Instance.ToolPane.FilesPanel, EditorConsoleManager.Instance.ToolPane.LayersPanel, EditorConsoleManager.Instance.ToolPane.ToolsPanel };

            if (_consoleLayers != null)
            {
                _consoleLayers.MouseMove  -= _mouseMoveHandler;
                _consoleLayers.MouseEnter -= _mouseEnterHandler;
                _consoleLayers.MouseExit  -= _mouseExitHandler;
            }

            _objectsSurface      = new SadConsole.Consoles.Console(25, 10);
            _objectsSurface.Font = SadConsoleEditor.Settings.Config.ScreenFont;
            _objectsSurface.Data.DefaultForeground = Color.White;
            _objectsSurface.Data.DefaultBackground = Color.Transparent;
            _objectsSurface.Data.Clear();
            _objectsSurface.BeforeRenderHandler = (cr) => cr.Batch.Draw(SadConsole.Engine.BackgroundCell, cr.RenderBox, null, new Color(0, 0, 0, 0.5f));

            _consoleLayers                                  = new LayeredConsole(1, 25, 10);
            _consoleLayers.Font                             = SadConsoleEditor.Settings.Config.ScreenFont;
            _consoleLayers.CanUseMouse                      = true;
            _consoleLayers.CanUseKeyboard                   = true;
            _consoleLayers.GetLayerMetadata(0).Name         = "Root";
            _consoleLayers.GetLayerMetadata(0).IsRemoveable = false;
            _consoleLayers.GetLayerMetadata(0).IsMoveable   = false;

            _width  = 25;
            _height = 10;

            SelectedGameObjects = new GameObjectCollection();
            GameObjects         = new List <GameObjectCollection>();
            GameObjects.Add(SelectedGameObjects);

            _mouseMoveHandler = (o, e) => { if (this.MouseMove != null)
                                            {
                                                this.MouseMove(_consoleLayers.ActiveLayer, e);
                                            }
                                            EditorConsoleManager.Instance.ToolPane.SelectedTool.MouseMoveSurface(e.OriginalMouseInfo, _consoleLayers.ActiveLayer); };
            _mouseEnterHandler = (o, e) => { if (this.MouseEnter != null)
                                             {
                                                 this.MouseEnter(_consoleLayers.ActiveLayer, e);
                                             }
                                             EditorConsoleManager.Instance.ToolPane.SelectedTool.MouseEnterSurface(e.OriginalMouseInfo, _consoleLayers.ActiveLayer); };
            _mouseExitHandler = (o, e) => { if (this.MouseExit != null)
                                            {
                                                this.MouseExit(_consoleLayers.ActiveLayer, e);
                                            }
                                            EditorConsoleManager.Instance.ToolPane.SelectedTool.MouseExitSurface(e.OriginalMouseInfo, _consoleLayers.ActiveLayer); };

            _consoleLayers.MouseMove  += _mouseMoveHandler;
            _consoleLayers.MouseEnter += _mouseEnterHandler;
            _consoleLayers.MouseExit  += _mouseExitHandler;
        }
Beispiel #22
0
        private static void LoadObjects(
            ContentManager contentManager,
            HeightMap heightMap,
            MapObject[] mapObjects,
            Team[] teams,
            out WaypointCollection waypointCollection,
            out GameObjectCollection gameObjects)
        {
            var waypoints = new List <Waypoint>();

            gameObjects = new GameObjectCollection(contentManager);

            foreach (var mapObject in mapObjects)
            {
                switch (mapObject.RoadType)
                {
                case RoadType.None:
                    var position = mapObject.Position;

                    switch (mapObject.TypeName)
                    {
                    case "*Waypoints/Waypoint":
                        waypoints.Add(CreateWaypoint(mapObject));
                        break;

                    default:
                        // TODO: Handle locomotors when they're implemented.
                        position.Z += heightMap.GetHeight(position.X, position.Y);

                        var gameObject = CreateGameObject(mapObject, teams, contentManager);

                        if (gameObject != null)
                        {
                            gameObject.Transform.Translation = position;
                            gameObject.Transform.Rotation    = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, mapObject.Angle);

                            gameObjects.Add(gameObject);
                        }

                        break;
                    }
                    break;

                default:
                    // TODO: Roads.
                    break;
                }

                contentManager.GraphicsDevice.WaitForIdle();
            }

            waypointCollection = new WaypointCollection(waypoints);
        }
Beispiel #23
0
        public Scene3D(
            Game game,
            InputMessageBuffer inputMessageBuffer,
            Func <Viewport> getViewport,
            ICameraController cameraController,
            MapFile mapFile,
            Terrain.Terrain terrain,
            Terrain.WaterArea[] waterAreas,
            Terrain.Road[] roads,
            Terrain.Bridge[] bridges,
            MapScriptCollection scripts,
            GameObjectCollection gameObjects,
            WaypointCollection waypoints,
            WaypointPathCollection waypointPaths,
            WorldLighting lighting,
            Player[] players,
            Team[] teams,
            bool isDiagnosticScene = false)
        {
            Camera           = new Camera(getViewport);
            CameraController = cameraController;

            MapFile       = mapFile;
            Terrain       = terrain;
            WaterAreas    = waterAreas;
            Roads         = roads;
            Bridges       = bridges;
            Scripts       = scripts;
            GameObjects   = AddDisposable(gameObjects);
            Waypoints     = waypoints;
            WaypointPaths = waypointPaths;
            Lighting      = lighting;

            SelectionGui = new SelectionGui();

            RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer);

            DebugOverlay = new DebugOverlay(this, game.ContentManager);

            if (!isDiagnosticScene)
            {
                RegisterInputHandler(_selectionMessageHandler    = new SelectionMessageHandler(game.Selection), inputMessageBuffer);
                RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer);
                RegisterInputHandler(_debugMessageHandler        = new DebugMessageHandler(DebugOverlay), inputMessageBuffer);
            }

            _particleSystemManager = AddDisposable(new ParticleSystemManager(this));

            _players = players.ToList();
            _teams   = teams.ToList();
            // TODO: This is completely wrong.
            LocalPlayer = _players.FirstOrDefault();
        }
Beispiel #24
0
 public void LoadContent(ContentManager Content)
 {
     objects = ObjectFactory.MakeCollection("Content/CNature", "nature", Content);
     for (int i = 0; i < 20; i++)
     {
         objects.Items.Add(i.ToString(), new GameObject(new Vector2(r.Next(0, 400), r.Next(0, 250)), "yagmur", "nature", Content));
     }
     Score = objects.Items["score"];
     objects.Items.Remove("score");
     Score.MoveTo(0, 480 - Score.rTexture.Height);
     font  = Content.Load <SpriteFont>("Font1");
     mRect = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 0, 0);
 }
Beispiel #25
0
        public Scene3D(
            Game game,
            ICameraController cameraController,
            MapFile mapFile,
            Terrain.Terrain terrain,
            Terrain.WaterArea[] waterAreas,
            Terrain.Road[] roads,
            Terrain.Bridge[] bridges,
            MapScriptCollection scripts,
            GameObjectCollection gameObjects,
            WaypointCollection waypoints,
            WaypointPathCollection waypointPaths,
            WorldLighting lighting,
            Player[] players,
            Team[] teams)
        {
            Camera           = new Camera(() => game.Viewport);
            CameraController = cameraController;

            MapFile       = mapFile;
            Terrain       = terrain;
            WaterAreas    = waterAreas;
            Roads         = roads;
            Bridges       = bridges;
            Scripts       = scripts;
            GameObjects   = AddDisposable(gameObjects);
            Waypoints     = waypoints;
            WaypointPaths = waypointPaths;
            Lighting      = lighting;

            SelectionGui             = new SelectionGui();
            _selectionMessageHandler = new SelectionMessageHandler(game.Selection);
            game.InputMessageBuffer.Handlers.Add(_selectionMessageHandler);
            AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_selectionMessageHandler));

            _cameraInputMessageHandler = new CameraInputMessageHandler();
            game.InputMessageBuffer.Handlers.Add(_cameraInputMessageHandler);
            AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_cameraInputMessageHandler));

            DebugOverlay         = new DebugOverlay(this, game.ContentManager);
            _debugMessageHandler = new DebugMessageHandler(DebugOverlay);
            game.InputMessageBuffer.Handlers.Add(_debugMessageHandler);
            AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_debugMessageHandler));

            _particleSystemManager = AddDisposable(new ParticleSystemManager(game, this));

            _players = players.ToList();
            _teams   = teams.ToList();
            // TODO: This is completely wrong.
            LocalPlayer = _players.FirstOrDefault();
        }
Beispiel #26
0
        // TODO: Should this be derived from the player's buildings so that it doesn't get out of sync?
        public int GetEnergy(GameObjectCollection allGameObjects)
        {
            var energy = 0;

            foreach (var gameObject in allGameObjects.Items)
            {
                if (gameObject.Owner != this)
                {
                    continue;
                }
                energy += gameObject.EnergyProduction;
            }
            return(energy);
        }
Beispiel #27
0
        public void Can_update_item()
        {
            var item           = new Mobile(new ObjectId(0x12345678), 0x4321, new Location3D(6, 5, 4), null, Direction.East, MovementType.Run, null);
            var itemCollection = new GameObjectCollection(new Player(null, null, null, null));

            itemCollection.UpdateObject(item);

            item = item.UpdateHealth(111, 222);
            itemCollection.UpdateObject(item);

            item = (Mobile)itemCollection[item.Id];
            item.CurrentHealth.Should().Be(111);
            item.MaxHealth.Should().Be(222);
        }
Beispiel #28
0
        public GameObject InstantiateObject(string typeName, GameObjectCollection parent)
        {
            var objectDefinition = IniDataContext.Objects.FirstOrDefault(x => x.Name == typeName);

            if (objectDefinition != null)
            {
                return(new GameObject(objectDefinition, this, _game.CivilianPlayer, parent));
            }
            else
            {
                // TODO
                return(null);
            }
        }
 public GameObjectReference(GameObjectUpdate message, GameObjectCollection collection)
 {
     this.obj             = null;
     this.hasDereferenced = false;
     this.id         = message.ReadInt();
     this.collection = collection;
     if (id == 0)
     {
         hasDereferenced = true;
     }
     else
     {
         Dereference();
     }
 }
 private GameObjectReference(T obj)
 {
     this.obj             = obj;
     this.hasDereferenced = true;
     if (obj == null)
     {
         this.id         = 0;
         this.collection = null;
     }
     else
     {
         this.id         = obj.ID;
         this.collection = obj.Game.GameObjectCollection;
     }
 }
Beispiel #31
0
        public World(Game1 game, IWorldLoader worldLoader)
        {
            this.Game = game;
            this._wl = worldLoader;
            // Create a new content manager to load content used just by this World.
            this._contentManager = new ContentManager(game.Services, "Content");

            var gameItems = worldLoader.GetGameObjects(this).ToList();
            this.GameObjects = new GameObjectCollection(worldLoader.Width, worldLoader.Height, gameItems);
            this.Player = gameItems.OfType<Player>().Single();

            this._itemsToDrawByZOrder = new List<StaticItem>[10];
            for (int i = 0; i < this._itemsToDrawByZOrder.GetLength(0); i++)
                this._itemsToDrawByZOrder[i] = new List<StaticItem>();
        }
Beispiel #32
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()
        {
            base.Initialize();
            this.camera = new Camera(new Vector2(0), 1f, 0, this.graphics);

            SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice);

            myGraphicsObject = new DrawingUtils.MyGraphicsClass(this.graphics, spriteBatch, this.camera);

            backGround           = new BackGround(worldSize);
            gameObjectCollection = new GameObjectCollection(worldSize);

            this.graphics.PreferredBackBufferWidth  = this.graphics.GraphicsDevice.DisplayMode.Width;
            this.graphics.PreferredBackBufferHeight = this.graphics.GraphicsDevice.DisplayMode.Height;
            this.graphics.ApplyChanges();
        }
Beispiel #33
0
        private Scene3D(Game game, Func <Viewport> getViewport, InputMessageBuffer inputMessageBuffer, int randomSeed, bool isDiagnosticScene, MapFile mapFile)
        {
            Camera = new Camera(getViewport);

            SelectionGui = new SelectionGui();

            DebugOverlay = new DebugOverlay(this, game.ContentManager);

            Random = new Random(randomSeed);

            if (mapFile != null)
            {
                MapFile    = mapFile;
                Terrain    = AddDisposable(new Terrain.Terrain(mapFile, game.AssetStore.LoadContext));
                WaterAreas = AddDisposable(new WaterAreaCollection(mapFile.PolygonTriggers, mapFile.StandingWaterAreas, mapFile.StandingWaveAreas, game.AssetStore.LoadContext));
                Navigation = new Navigation.Navigation(mapFile.BlendTileData, Terrain.HeightMap);
            }

            RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer);

            if (!isDiagnosticScene)
            {
                RegisterInputHandler(new SelectionMessageHandler(game.Selection), inputMessageBuffer);
                RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer);
                RegisterInputHandler(_debugMessageHandler        = new DebugMessageHandler(DebugOverlay), inputMessageBuffer);
            }

            _particleSystemManager = AddDisposable(new ParticleSystemManager(game.AssetStore.LoadContext));

            GameContext = new GameContext(
                game.AssetStore.LoadContext,
                game.Audio,
                _particleSystemManager,
                new ObjectCreationListManager(),
                Terrain,
                Navigation);

            GameObjects = AddDisposable(
                new GameObjectCollection(
                    GameContext,
                    game.CivilianPlayer,
                    Navigation));

            GameContext.GameObjects = GameObjects;

            _orderGeneratorSystem = game.OrderGenerator;
        }
Beispiel #34
0
        public void LoadContent(ContentManager Content)
        {
            font    = Content.Load <SpriteFont>("Font1");
            objects = ObjectFactory.MakeCollection("Content/CFragility", "fragility", Content);
            Rectangle r = objects.Items["cimen"].getRect();

            r.Width = 1000;
            objects.Items["cimen"].setRect(r);
            fragileT = TextureLoader.TextureList("Content/fragility/CFragiles");

            foreach (string t in fragileT)
            {
                fragiles.AddObject(new GameObject(new Vector2(rand.Next(0, 700), rand.Next(0, 150)), t, "fragility", Content));
            }

            kid = new GameObject(new Vector2(0, 480 - 159), "cocuk", "fragility", Content);
        }
Beispiel #35
0
 //--------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="GameObjectManager"/> class.
 /// </summary>
 public GameObjectManager()
 {
     Objects = new GameObjectCollection();
 }
Beispiel #36
0
    public void Export( string _directory, bool _dryRun = false )
    {
        m_allFiles = new List<string>();
        m_lastExportDirectory = _directory;

        //
        // Build data.asm and files.asm content
        //
        string asmData = "";
        string asmFileList = "";
        string asmFileMap = "FileIDMap:\n";

        //
        // Export all images
        //
        foreach( string imageFile in m_imageFiles )
        {
            if( _dryRun == false )
                Debug.Log( "Exporting file '" + imageFile + "'" );

            string outFileNameNoExt = GetOutFileNameNoExt( imageFile );
            //string outBaseName = GetOutBaseName( imageFile );

            //
            PalettizedImageConfig imageConfig = new PalettizedImageConfig( imageFile + ".config" );
            PalettizedImage imageData = PalettizedImage.LoadImage( imageFile, imageConfig );
            if( imageData == null )
            {
                FullColorImage.LoadImage( imageFile, imageConfig );
            }

            //
            if( imageData != null )
            {
                // Export it
                if( imageConfig.m_importAsSprite )
                {
                    string alternativeAmigaSpriteName;
                    if( imageConfig.m_importAsBSprite )
                    {
                        alternativeAmigaSpriteName = "_sprite_bank_amiga_b_hw.bin";
                    }
                    else
                    {
                        alternativeAmigaSpriteName = "_sprite_bank_amiga_a_bob.bin";
                    }

                    AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetSpriteTileName( outFileNameNoExt ), outFileNameNoExt + alternativeAmigaSpriteName );
                    AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetPaletteName( outFileNameNoExt ));
                    AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetSpriteName( outFileNameNoExt ));
                }
                else
                {
                    AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetTileBankName( outFileNameNoExt ), outFileNameNoExt + "_bank_amiga.bin" );
                    AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetTileMapName( outFileNameNoExt ));
                    AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetPaletteName( outFileNameNoExt ));
                }
            }
        }

        //
        // Export all maps
        //
        foreach( string mapFile in m_mapFiles )
        {
            if( _dryRun == false )
                Debug.Log( "Exporting map '" + mapFile + "'" );

            string outFileNameNoExt = GetOutFileNameNoExt( mapFile );

            //
            AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetTileMapName( outFileNameNoExt ));
            AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetCollisionMapName( outFileNameNoExt ));
        }

        //
        // Export all game objects
        //
        foreach( string goFile in m_gameObjectCollectionFiles )
        {
            if( _dryRun == false )
                Debug.Log( "Exporting file '" + goFile + "'" );

            string outFileNameNoExt = GetOutFileNameNoExt( goFile );
            //string outBaseName = GetOutBaseName( imageFile );

            GameObjectCollection ggo = new GameObjectCollection(  goFile );

            //
            AddFile( ref asmData, ref asmFileList, ref asmFileMap, GetGreatGameObjectName( outFileNameNoExt ));
        }

        //
        // Generate assembly files that tie everything together
        //
        if( _dryRun == false )
        {
            System.IO.File.WriteAllText( m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + "data.asm", asmData );
            System.IO.File.WriteAllText( m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + "files.asm", asmFileList + "\n" + asmFileMap );
        }
    }
        public void Reset()
        {
            ControlPanels = new CustomPanel[] { EditorConsoleManager.Instance.ToolPane.FilesPanel, EditorConsoleManager.Instance.ToolPane.LayersPanel, EditorConsoleManager.Instance.ToolPane.ToolsPanel };

            if (_consoleLayers != null)
            {
                _consoleLayers.MouseMove -= _mouseMoveHandler;
                _consoleLayers.MouseEnter -= _mouseEnterHandler;
                _consoleLayers.MouseExit -= _mouseExitHandler;
            }

            _objectsSurface = new SadConsole.Consoles.Console(25, 10);
            _objectsSurface.Font = SadConsoleEditor.Settings.Config.ScreenFont;
            _objectsSurface.Data.DefaultForeground = Color.White;
            _objectsSurface.Data.DefaultBackground = Color.Transparent;
            _objectsSurface.Data.Clear();
            _objectsSurface.BeforeRenderHandler = (cr) => cr.Batch.Draw(SadConsole.Engine.BackgroundCell, cr.RenderBox, null, new Color(0, 0, 0, 0.5f));

            _consoleLayers = new LayeredConsole(1, 25, 10);
            _consoleLayers.Font = SadConsoleEditor.Settings.Config.ScreenFont;
            _consoleLayers.CanUseMouse = true;
            _consoleLayers.CanUseKeyboard = true;
            _consoleLayers.GetLayerMetadata(0).Name = "Root";
            _consoleLayers.GetLayerMetadata(0).IsRemoveable = false;
            _consoleLayers.GetLayerMetadata(0).IsMoveable = false;

            _width = 25;
            _height = 10;

            SelectedGameObjects = new GameObjectCollection();
            GameObjects = new List<GameObjectCollection>();
            GameObjects.Add(SelectedGameObjects);

            _mouseMoveHandler = (o, e) => { if (this.MouseMove != null) this.MouseMove(_consoleLayers.ActiveLayer, e); EditorConsoleManager.Instance.ToolPane.SelectedTool.MouseMoveSurface(e.OriginalMouseInfo, _consoleLayers.ActiveLayer); };
            _mouseEnterHandler = (o, e) => { if (this.MouseEnter != null) this.MouseEnter(_consoleLayers.ActiveLayer, e); EditorConsoleManager.Instance.ToolPane.SelectedTool.MouseEnterSurface(e.OriginalMouseInfo, _consoleLayers.ActiveLayer); };
            _mouseExitHandler = (o, e) => { if (this.MouseExit != null) this.MouseExit(_consoleLayers.ActiveLayer, e); EditorConsoleManager.Instance.ToolPane.SelectedTool.MouseExitSurface(e.OriginalMouseInfo, _consoleLayers.ActiveLayer); };

            _consoleLayers.MouseMove += _mouseMoveHandler;
            _consoleLayers.MouseEnter += _mouseEnterHandler;
            _consoleLayers.MouseExit += _mouseExitHandler;
        }
Beispiel #38
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            pixel = new Texture2D(GraphicsDevice, 1, 1);
            pixel.SetData<Color>(new Color[] { Color.White });

            Objects = new GameObjectCollection() {
                new Toy(@"Content\HammerBaby.xml") { Color = Color.White, Size = 40, Position = new Vector2(40, 100), Speed = 10 },
                new Toy(@"Content\HammerBaby.xml") { Color = Color.Blue, Size = 40, Position = new Vector2(100, 400), Speed = 20 },
                new Toy(@"Content\HammerBaby.xml") { Color = Color.Red, Size = 40, Position = new Vector2(500, 200), Speed = 15 },
                new Toy(@"Content\HammerBaby.xml") { Color = Color.Black, Size = 40, Position = new Vector2(400, 500), Speed = 40 },
                new Toy(@"Content\HammerBaby.xml") { Color = Color.Yellow, Size = 40, Position = new Vector2(800, 650), Speed = 50 }
            };

            selectedObject = Objects[0];
            // TODO: use this.Content to load your game content here
        }
Beispiel #39
0
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);

            PreloadContent();

            backgroundObjects = new GameObjectCollection();
            foreach (var obj in BackgroundObjects)
                backgroundObjects.Add(obj);

            foregroundObjects = new GameObjectCollection();
            foreach (var obj in ForegroundObjects)
                foregroundObjects.Add(obj);

            SceneManager.LoadDefaultScene();
        }
Beispiel #40
0
 public override void SetContainer(GameObjectCollection gameObjectCollection)
 {
     container = gameObjectCollection;
 }
Beispiel #41
0
 public override void UnsetContainer()
 {
     container = null;
 }
Beispiel #42
0
    //
    void ExportAll()
    {
        //
        string outFileName = EditorUtility.SaveFilePanel( "Select folder to export to", m_lastExportDirectory, "filenameignored", "bin" );

        //
        m_lastExportDirectory = System.IO.Path.GetDirectoryName( outFileName );
        SaveLastExportDirectory();

        m_project.Export( m_lastExportDirectory );

        //
        // Export all images
        //
        string[] imageFiles = m_project.m_imageFiles;
        foreach( string imageFile in imageFiles )
        {
            Debug.Log( "Exporting file '" + imageFile + "'" );

            string outFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension( imageFile ).ToLower();
            string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + outFileNameNoExt;

            //
            PalettizedImageConfig imageConfig = new PalettizedImageConfig( imageFile + ".config" );
            PalettizedImage imageData = PalettizedImage.LoadImage( imageFile, imageConfig );

            //
            if( imageData != null )
            {
                //
                imageConfig.SetImage( imageData );

                // Convert to tile banks / planar images
        //				PlanarImage planarImage = new PlanarImage( imageData);
                TileBank tileBank = new TileBank( imageData, (imageConfig.m_importAsSprite==false) );
                TilePalette tilePalette = new TilePalette( imageData );

                // Export it
                if( imageConfig.m_importAsSprite )
                {
                    Sprite sprite = new Sprite( imageConfig );
                    string alternativeAmigaSpriteName;
                    if( imageConfig.m_importAsBSprite )
                    {
                        AmigaSprite amigaSprite = new AmigaSprite( imageData, imageConfig);
                        alternativeAmigaSpriteName = "_sprite_bank_amiga_b_hw.bin";
                        amigaSprite.Export( outBaseName + alternativeAmigaSpriteName );
                    }
                    else
                    {
                        AmigaBob amigaBob = new AmigaBob( imageData, imageConfig);
                        alternativeAmigaSpriteName = "_sprite_bank_amiga_a_bob.bin";
                        amigaBob.Export( outBaseName + alternativeAmigaSpriteName );
                    }
                    tileBank.ExportMegaDrive( outBaseName + "_sprite_bank.bin" );
                    tilePalette.Export( outBaseName + "_palette.bin" );
                    sprite.Export( outBaseName + "_sprite.bin" );
                }
                else
                {
                    TileMap tileMap = new TileMap( tileBank, imageData );

                    tileBank.ExportMegaDrive( outBaseName + "_bank.bin" );
                    tileBank.ExportAmiga( outBaseName + "_bank_amiga.bin" );
                    tileMap.Export( outBaseName + "_map.bin" );
                    tilePalette.Export( outBaseName + "_palette.bin" );
                }
            }
        }

        //
        // Export all maps
        //
        string[] mapFiles = m_project.m_mapFiles;
        foreach( string mapFile in mapFiles )
        {
            Debug.Log( "Exporting map '" + mapFile + "'" );

            string outFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension( mapFile ).ToLower();
            string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar + outFileNameNoExt;

            //
            TileMap tileMap = TileMap.LoadJson( mapFile );
            CollisionMap collisionmap = new CollisionMap( tileMap );

            tileMap.Export( outBaseName + "_map.bin" );
            collisionmap.Export( outBaseName  + "_collisionmap.bin" );
        }

        //
        // Export all game objects
        //
        foreach( string goFile in m_project.m_gameObjectCollectionFiles )
        {
            Debug.Log( "Exporting game object '" + goFile + "'" );

            string outFileNameNoExt = m_project.GetOutFileNameNoExt( goFile );
            string outBaseName = m_lastExportDirectory + System.IO.Path.DirectorySeparatorChar;

            GameObjectCollection ggo = new GameObjectCollection(  goFile );
            ggo.Export( outBaseName + m_project.GetGreatGameObjectName( goFile ), m_project );
        }

        Debug.Log("Export is finished!");
    }
Beispiel #43
0
 public abstract void SetContainer(GameObjectCollection gameObjectCollection);
Beispiel #44
0
Datei: Toy.cs Projekt: smelch/BVB
 public override void SetContainer(GameObjectCollection gameObjectCollection)
 {
     return;
 }
        /// <summary>
        /// GameObject を初期化します。
        /// </summary>
        void InitializeGameObjects()
        {
            gameObjects.Items = new GameObject[MaxGameObjectCount];
            gameObjects.Count = InitialGameObjectCount;
            for (int i = 0; i < gameObjects.Count; ++i) gameObjects.Items[i].Initialize(ramdom);

            lodGameObjects = new GameObjectCollection[lodCount];
            for (int lod = 0; lod < lodCount; lod++)
            {
                lodGameObjects[lod] = new GameObjectCollection();
                lodGameObjects[lod].Items = new GameObject[MaxGameObjectCount];
                lodGameObjects[lod].Count = InitialGameObjectCount;
            }

            UpdateStatusString();
        }
Beispiel #46
0
        /// <summary>
        /// Initializes this object.
        /// </summary>
        public virtual void Initialize()
        {
            if (Body != null)
                Body = null;

            transform.GameObject = this;

            this.components = new List<ObjectComponent>();
            for (int i = componentReferences.Count - 1; i >= 0; i--)
            {
                string name = componentReferences[i];

                Type _type = SceneManager.ScriptsAssembly.GetType(name);

                if (_type == null)
                {
#if WINDOWS
                    _type = Assembly.GetExecutingAssembly().GetType(name); // system components
#elif WINRT
                    _type = typeof(GameObject).GetTypeInfo().Assembly.GetType(name);
#endif
                    //scriptsAssembly = false;
                }

                // still null? delete reference:
                //if (_type == null)
                //{
                //    componentReferences.RemoveAt(i);
                //}

                // The reference still exists?
                // (the user removed the component?)
                if (_type != null)
                {
                    try
                    {
                        ObjectComponent oc;
                        oc = (ObjectComponent)Activator.CreateInstance(_type);

                        // não apagar:
                        //if (scriptsAssembly)
                        //    oc = (ObjectComponent)SceneManager.ScriptsAssembly // .CreateInstance(name);
                        //else
                        //    oc = (ObjectComponent)typeof(GameObject).GetTypeInfo().Assembly.CreateInstance(name);

                        oc.Transform = this.Transform;

                        LoadComponentValues(oc);

                        this.components.Insert(0, oc);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(
                            "Error trying to Activate " + name + " on " + Name + " : " +                            
                            ex.Message + "\n" + ex.StackTrace.ToString());
                    }
                }
            }

            // initializes components
            foreach (var cmp in this.components)
                if (!SceneManager.IsEditor || (SceneManager.IsEditor && cmp is ExtendedObjectComponent))
                    cmp.Initialize();

            if (children == null)
                children = new GameObjectCollection(this);

            // Initialize Children game objects
            foreach (GameObject gameObject in children)
                gameObject.Initialize();

            collisionBoundryColor = Color.FromNonPremultiplied(255, 64, 0, 120);

            // initialize collision model
            //collisionModel.Initialize(this.transform);

            CheckAllAttributes();
        }