Example #1
0
        public void CreateBackground()
        {
            GameObject background = new GameObject(new Vector2(SceneManager.ScreenSize.X, 400, SceneManager.ScreenSize.X, 0), "", new Vector2(0, -225));

            background.Animator.AddTexture("BACKGROUND", new Bitmap("./Textures/BACKGROUND.png"), 3, 2000);
            background.Animator.CurrentTexture = "BACKGROUND";
            SceneManager.AddObject(background);

            background = new GameObject(new Vector2(SceneManager.ScreenSize.X, 270, SceneManager.ScreenSize.X, 0), "Background Bottom", new Vector2(0, 9330));
            background.Animator.AddTexture("BACKGROUND_BOTTOM", new Bitmap("./Textures/BACKGROUND_BOTTOM.png"));
            background.Animator.CurrentTexture = "BACKGROUND_BOTTOM";
            SceneManager.AddObject(background);

            GameObject sun = new GameObject(new Vector2(230, 300), "Sun", new Vector2(10, -450));

            sun.Animator.AddTexture("SUN", new Bitmap("./Textures/SUN.png"));
            sun.Animator.CurrentTexture = "SUN";
            sun.Transform.SetPositionFn(() => {
                if (CameraYPosition > 450)
                {
                    sun.Transform.Position.Y = -CameraYPosition - 25;
                }
            });
            SceneManager.AddObject(sun);
        }
Example #2
0
        public void InitScene()
        {
            GameObject background = new GameObject(new Vector2(SceneManager.ScreenSize.X, 400, SceneManager.ScreenSize.X, 0), "", new Vector2(0, 250));

            background.Animator.AddTexture("BACKGROUND", new Bitmap("./Textures/BACKGROUND.png"), 3, 2000);
            background.Animator.CurrentTexture = "BACKGROUND";
            SceneManager.AddObject(background);

            GameObject sun = new GameObject(new Vector2(230, 300), "Sun", new Vector2(10, -25));

            sun.Animator.AddTexture("SUN", new Bitmap("./Textures/SUN.png"));
            sun.Animator.CurrentTexture = "SUN";
            SceneManager.AddObject(sun);

            menuHUD = new MenuHUD(gl);
            menuHUD.Init();
            SceneManager.HUD = menuHUD;

            // Play games' song
            long position;

            try {
                position = OutputDevice.GetPosition();
            } catch {
                position = 0;
            }

            if (position == 0)
            {
                keepPlaying = true;
                OutputDevice.PlaybackStopped += SongStopped;
                OutputDevice.Init(audioFile);
                OutputDevice.Play();
            }
        }
Example #3
0
        public override void Initialize()
        {
            this.health = (TextField)UiFactory.Instance.Create(
                FontAddresses.HudFont,
                this.healthTitle,
                this.ObjectColor,
                new Vector2(1120, 40),
                this.RenderLayer);
            SceneManager.AddObject(this.health);

            this.score = (TextField)UiFactory.Instance.Create(
                FontAddresses.HudFont,
                this.scoreTitle,
                this.ObjectColor,
                new Vector2(600, 40),
                this.RenderLayer);
            SceneManager.AddObject(this.score);

            this.damage = (TextField)UiFactory.Instance.Create(
                FontAddresses.HudFont,
                this.damageTitle,
                this.ObjectColor,
                new Vector2(40, 40),
                this.RenderLayer);
            SceneManager.AddObject(this.damage);
        }
Example #4
0
        private void LoadCamera(CameraData data)
        {
            GameObject cameraPrefab = ResourceManager.GetPrefab(PrefabID.Camera);

            GameObject newPrefab = SceneManager.InstantiateUnityPrefab(cameraPrefab);
            GameObject newObject = SceneManager.AddObject(newPrefab);

            if (data.parentPath.Length > 0)
            {
                SceneManager.SetObjectParent(newObject, rootTransform.Find(data.parentPath).gameObject);
            }

            LoadCommonData(newObject, data);

            CameraController controller = newObject.GetComponent <CameraController>();

            controller.enableDOF = data.enableDOF;
            if (controller.enableDOF)
            {
                controller.CreateColimator();
            }
            controller.focal      = data.focal;
            controller.Focus      = data.focus;
            controller.aperture   = data.aperture;
            controller.near       = data.near;
            controller.far        = data.far;
            controller.filmHeight = data.filmHeight;
            controller.filmWidth  = data.filmWidth;
            controller.gateFit    = (Camera.GateFitMode)data.gateFit;

            loadedCameras.Add(controller);
        }
Example #5
0
        public void CreateBubbles(Vector2 centerPos)
        {
            float size;
            int   qty = 1 + this.random.Next(4);

            for (int i = 0; i < qty; i++)
            {
                size = 10 + (float)this.random.NextDouble() * 16;
                Vector2 pos = centerPos + (Vector2.One * ((this.random.NextDouble() + 6) * size * (this.random.NextDouble() > 0.5 ? -1 : 1)));

                GameObject bubble = new GameObject(new Vector2(size, size), "Bubble", pos);
                bubble.Animator.AddTexture("BUBBLE", gameHUD.BUBBLE_TEXTURE_ID);
                bubble.AddOnClickListener(() => {
                    if (!SceneManager.IsMute)
                    {
                        bubbleAudio.Play();
                    }

                    SceneManager.Player.BubblesScore++;
                    bubble.Destroy();
                });

                AnimationClip animationClip = new AnimationClip(AnimationClip.ClipTypes.ONCE);
                animationClip.AddClipPoint((int)Math.Round(750 * (pos.Y / 100)), "BUBBLE", new Vector2(Transform.DISABLE_AXIS_MOVIMENT, 0));
                animationClip.AddClipPoint(1000, "", null, bubble.Destroy);
                bubble.Animator.AddAnimationClip("CLIP", animationClip);

                bubble.Animator.PlayAnimationClip("CLIP");
                SceneManager.AddObject(bubble);
            }
        }
Example #6
0
        private void GenerateEnemiesAtRandomPositions()
        {
            const int SpawnStartWith   = 150;
            const int SpawnEndWidth    = GameResolution.DefaultHeight - 150;
            const int SpawnStartHeight = 150;

            var spawnEndWidth = GameResolution.DefaultWidth - 300;

            for (int i = 0; i < 5; i++, spawnEndWidth -= 100)
            {
                var creep = (Creep)DynamicObjectFactory.Instance.Create(
                    new Vector2(this.rand.Next(SpawnStartWith, spawnEndWidth), this.rand.Next(SpawnStartHeight, SpawnEndWidth)),
                    ImageAddresses.CreepImage,
                    ObjectType.Creep,
                    Color.White,
                    scale: 0.5f,
                    rotation: 0,
                    layerDepth: RenderLayers.CharacterLayer,
                    movementSpeed: 1f,
                    damage: 5,
                    health: 100);
                SceneManager.AddObject(creep);
                creep.OnDead += this.DecreaseEnemyCount;

                var wizard = (Wizard)DynamicObjectFactory.Instance.Create(
                    new Vector2(this.rand.Next(SpawnStartWith, spawnEndWidth), this.rand.Next(SpawnStartHeight, SpawnEndWidth)),
                    ImageAddresses.WizardImage,
                    ObjectType.Wizard,
                    Color.White,
                    scale: 0.5f,
                    rotation: 0,
                    layerDepth: RenderLayers.CharacterLayer,
                    movementSpeed: 1f,
                    damage: 5,
                    health: 100);
                SceneManager.AddObject(wizard);
                wizard.OnDead += this.DecreaseEnemyCount;

                var archer = (Archer)DynamicObjectFactory.Instance.Create(
                    new Vector2(this.rand.Next(SpawnStartWith, spawnEndWidth), this.rand.Next(SpawnStartHeight, SpawnEndWidth)),
                    ImageAddresses.ArcherImage,
                    ObjectType.Archer,
                    Color.White,
                    scale: 0.5f,
                    rotation: 0,
                    layerDepth: RenderLayers.CharacterLayer,
                    movementSpeed: 1f,
                    damage: 5,
                    health: 100,
                    cooldown: 50);
                SceneManager.AddObject(archer);
                archer.OnDead += this.DecreaseEnemyCount;

                this.enemyCount += 3;
            }
        }
Example #7
0
        public static void Instantiate(Vector2 position)
        {
            GameObject bomb;
            int        size     = 60 + random.Next(40);
            double     bombType = random.NextDouble();
            float      fraction = 1f / BOMB_TEXTURES.Length;

            if (bombType < 1 - fraction)
            {
                bomb = new GameObject(new Vector2(size, size), "Bomb", position);
                bomb.Animator.AddTexture("BOMB", BOMB_TEXTURES_IDS[(int)Math.Floor(bombType / fraction)]);
                bomb.Animator.CurrentTexture = "BOMB";
                bomb.Transform.Spin(3);

                // Select a random animation clip
                bomb.Animator.AddAnimationClip("CLIP", GetAnimationClip(random.Next(4), bomb));
                bomb.Animator.PlayAnimationClip("CLIP");

                SceneManager.AddObject(bomb);
            }
            else
            {
                bomb = new GameObject(new Vector2(size, size * 0.65f), "Bomb", position);
                bomb.Animator.AddTexture("BOMB", BOMB_TEXTURES_IDS[BOMB_TEXTURES.Length - 1]);
                bomb.Animator.CurrentTexture = "BOMB";

                // Select a random animation clip
                bomb.Animator.AddAnimationClip("CLIP", GetTorpedoAnimationClip(random.Next(3), bomb));
                bomb.Animator.PlayAnimationClip("CLIP");

                SceneManager.AddObject(bomb);
            }

            bomb.AddOnCollisionListener("EXPLODE", (GameObject collider) => {
                if (collider.Tag == "Player")
                {
                    // Take one player's life and destroy all fishes he hooked
                    SceneManager.Player.Lives--;
                    for (int i = 0; i < SceneManager.SceneObjects.Count; i++)
                    {
                        if (SceneManager.SceneObjects[i].Tag == "Hooked_Fish")
                        {
                            SceneManager.SceneObjects[i--].Destroy();
                        }
                    }

                    Explode(bomb);
                    bomb.Destroy();
                }
            });

            bomb.AddOnClickListener(() => {
                Explode(bomb);
                bomb.Destroy();
            });
        }
Example #8
0
        public void Load()
        {
            var winBG = UiFactory.Instance.Create(
                Color.White,
                ImageAddresses.WinBackgroundImage,
                1f,
                RenderLayers.BackgroundLayer);

            SceneManager.AddObject(winBG);
        }
Example #9
0
 public void InitScene()
 {
     background = new GameObject(new Vector2(2560, 1440, 2560, 1440));
     background.Animator.AddTexture("LRV", new Bitmap("./Textures/LRV.png"));
     background.Animator.CurrentTexture = "LRV";
     background.Animator.Color          = Color.FromArgb(0, background.Animator.Color);
     SceneManager.AddObject(background);
     start = SceneManager.Now;
     transition.Play();
 }
Example #10
0
        /// <summary>
        /// Nastavi, zda bude ci nebude videt hrac a vse s nim spojene
        /// </summary>
        /// <param name="enable">True - hrac bude videt, jinak false</param>
        public static void SetShowPlayer(bool enable)
        {
            showPlayer = enable;

            SceneManager sceneManager = GraphicCore.GetCurrentSceneManager();

            if (enable)
            {
                Camera  cam      = Camera.GetCameraInstance();
                Vector3 position = cam.GetVector3Position();
                Vector3 dir      = cam.GetVector3LookAt() - position;
                dir.Normalize();

                Scene.SceneManager.SceneObject pl = sceneManager.GetObject("Hrac");

                if (pl != null)
                {
                    player = (Objects.Player)pl.generalObject;

                    if ((Scene.SceneManager.DetailLevel)Properties.Settings.Default.DetailLevel == Scene.SceneManager.DetailLevel.Low)
                    {
                        player.SetModel(null);
                    }
                }
                else
                {
                    sceneManager.AddObject("Hrac", player, (Effect)null);
                }

                Vector3 playerPosition = position;
                playerPosition.Y -= HeightOfEye.Y;
                playerPosition   -= HeightOfEye.Z * dir;
                player.SetPosition(playerPosition);

                SceneManager.SceneObject pochoden = sceneManager.GetObject("Hrac_Pochoden");

                if (pochoden != null)
                {
                    player.EquipItem(pochoden.generalObject);
                }
            }
            else
            {
                if (player != null)
                {
                    player.SetMatrixWorld(originalPlayerWorld);
                    sceneManager.DeleteObject("Hrac");
                }
            }
        }
Example #11
0
        // scene initialization and object placement
        public void Load()
        {
            this.startGameButton = (Button)UiFactory.Instance.Create(
                Color.White,
                new Vector2(50, 420),
                ImageAddresses.NormalStartButton,
                ImageAddresses.HoveredStartButton,
                ImageAddresses.InactiveStartButton,
                RenderLayers.UiLayer,
                scale: .3f);
            SceneManager.AddObject(this.startGameButton);

            this.statsButton = (Button)UiFactory.Instance.Create(
                Color.White,
                new Vector2(50, 510),
                ImageAddresses.NormalStatsButton,
                ImageAddresses.HoveredStatsButton,
                ImageAddresses.InactiveStatsButton,
                RenderLayers.UiLayer,
                scale: .3f);
            SceneManager.AddObject(this.statsButton);

            this.exitGameButton = (Button)UiFactory.Instance.Create(
                Color.White,
                new Vector2(50, 600),
                ImageAddresses.NormalExitButton,
                ImageAddresses.HoveredExitButton,
                ImageAddresses.InactiveExitButton,
                RenderLayers.UiLayer,
                scale: .3f) as Button;
            SceneManager.AddObject(this.exitGameButton);

            Background backgr = (Background)UiFactory.Instance.Create(
                Color.White,
                ImageAddresses.MenuBackgroundImage,
                backgroundScale: .72f,
                backgroundLayer: RenderLayers.BackgroundLayer);

            SceneManager.AddObject(backgr);

            this.CurrentSelectedButton = this.startGameButton;

            this.Buttons.Add(this.startGameButton);
            this.Buttons.Add(this.statsButton);
            this.Buttons.Add(this.exitGameButton);

            this.startGameButton.OnPressed += this.LoadFirstLevel;
            this.exitGameButton.OnPressed  += this.ExitGame;
            this.statsButton.OnPressed     += this.LoadStatsLevel;
        }
Example #12
0
        private void LoadLight(LightData data)
        {
            GameObject lightPrefab = null;

            switch (data.lightType)
            {
            case LightType.Directional:
                lightPrefab = ResourceManager.GetPrefab(PrefabID.SunLight);
                break;

            case LightType.Spot:
                lightPrefab = ResourceManager.GetPrefab(PrefabID.SpotLight);
                break;

            case LightType.Point:
                lightPrefab = ResourceManager.GetPrefab(PrefabID.PointLight);
                break;
            }

            if (lightPrefab)
            {
                GameObject newPrefab = SceneManager.InstantiateUnityPrefab(lightPrefab);
                GameObject newObject = SceneManager.AddObject(newPrefab);

                if (data.parentPath.Length > 0)
                {
                    SceneManager.SetObjectParent(newObject, rootTransform.Find(data.parentPath).gameObject);
                }

                LoadCommonData(newObject, data);

                LightController controller = newObject.GetComponent <LightController>();
                controller.Intensity       = data.intensity;
                controller.minIntensity    = data.minIntensity;
                controller.maxIntensity    = data.maxIntensity;
                controller.Color           = data.color;
                controller.CastShadows     = data.castShadows;
                controller.ShadowNearPlane = data.near;
                controller.Range           = data.range;
                controller.minRange        = data.minRange;
                controller.maxRange        = data.maxRange;
                controller.OuterAngle      = data.outerAngle;
                controller.Sharpness       = data.sharpness;
            }
        }
Example #13
0
        private static void Explode(GameObject bomb)
        {
            GameObject explosion = new GameObject(Vector2.One * bomb.Transform.Size.X * 2.5, "Explosion", bomb.Transform.Position - bomb.Transform.Size);

            explosion.Animator.AddTexture("EXPLOSION", EXPLOSION_TEXTURES_IDS[random.Next(EXPLOSION_TEXTURES_IDS.Length)], 14, 600, Texture.Orientations.BOTH, 4);
            explosion.Animator.CurrentTexture = "EXPLOSION";

            AnimationClip animationClip = new AnimationClip(AnimationClip.ClipTypes.ONCE);

            animationClip.AddClipPoint(600);
            animationClip.AddClipPoint(1000, "", null, explosion.Destroy);
            explosion.Animator.AddAnimationClip("AUTO_DESTROY", animationClip);
            explosion.Animator.PlayAnimationClip("AUTO_DESTROY");
            SceneManager.AddObject(explosion);
            if (!SceneManager.IsMute)
            {
                explosionSound.Play();
            }
        }
Example #14
0
        public static void Instantiate(PlayerObject player, Vector2 position)
        {
            int        size = 50 + random.Next(50);
            GameObject fish = new GameObject(new Vector2(size, size), "Fish", position);

            int  colorIdx = random.Next(FISH_COLORS.Length);
            bool type2    = random.NextDouble() > 0.5;

            // Handle collision with the hook (player)
            fish.AddOnCollisionListener("HOOKED", (collider) => {
                if (collider.Tag == "Player" && !Game.GameEnded)
                {
                    fish.Tag = "Hooked_Fish";
                    fish.RemoveCollisionListener("HOOKED");
                    fish.Animator.StopAnimationClip();
                    fish.Transform.Rotation = -90;
                    fish.Transform.Scale.X  = 1;

                    fish.Animator.CurrentTexture = FISH_COLORS[colorIdx] + "_FISH" + (type2 ? "2" : "") + "_SWIM";

                    float spaceX = (float)random.NextDouble() * 25;
                    float spaceY = (float)random.NextDouble() * -50;
                    fish.Transform.SetPositionFn(() => {
                        fish.Transform.Position.X = player.Transform.Position.X - (player.Transform.Size.X * 1.5f) + spaceX;
                        fish.Transform.Position.Y = player.Transform.Position.Y + player.Transform.Size.Y + spaceY - 20;
                    });
                }
            });

            // Register textures (sprites)
            string restTexture = FISH_COLORS[colorIdx] + "_FISH" + (type2 ? "2" : "") + "_REST";
            string swimTexture = FISH_COLORS[colorIdx] + "_FISH" + (type2 ? "2" : "") + "_SWIM";

            fish.Animator.AddTexture(restTexture, FISH_TEXTURES_IDS[colorIdx * 4 + (type2 ? 2 : 0)], 20, 1000, Texture.Orientations.BOTH, 4);
            fish.Animator.AddTexture(swimTexture, FISH_TEXTURES_IDS[colorIdx * 4 + (type2 ? 3 : 1)], 12, 600, Texture.Orientations.BOTH, 4);

            // Select a random animation clip
            fish.Animator.AddAnimationClip("CLIP", GetAnimationClip(random.Next(6), fish, restTexture, swimTexture));
            fish.Animator.PlayAnimationClip("CLIP");

            SceneManager.AddObject(fish);
        }
Example #15
0
        protected virtual void DeathActions()
        {
            SceneManager.DestroyObject(this);

            var someBonus = (Bonus)StaticObjectFactory.Instance.Create(
                new Vector2(this.PositionX, this.PositionY),
                ImageAddresses.BonusImage,
                ObjectType.Bonus,
                Color.Red,
                scale: .2f,
                rotation: 0f,
                layerDepth: RenderLayers.StaticsLayer);

            SceneManager.AddObject(someBonus);

            this.deathEffect.Play(.3f, 0f, 0f);

            SceneManager.DestroyObject(this);
            this.SaveToScoreBoard();
        }
Example #16
0
        public static void CreateClouds()
        {
            Random random = new Random();

            uint[] cloudsIds = new uint[3];
            for (int i = 1; i <= 3; i++)
            {
                cloudsIds[i - 1] = Animator.RegisterTexture(new Bitmap("./Textures/CLOUD_" + i + ".png"));
            }

            // Create clouds
            float cloudPos = -500;

            while (cloudPos > -7300)
            {
                GameObject cloud = new GameObject(new Vector2(250, 100), "Cloud", new Vector2(-200 + (float)random.NextDouble() * (SceneManager.ScreenSize.X + 200), cloudPos, SceneManager.ScreenSize.X, 0));
                cloud.Animator.AddTexture("CLOUD", cloudsIds[random.Next(3)]);
                cloud.Animator.CurrentTexture = "CLOUD";
                SceneManager.AddObject(cloud);
                cloudPos -= (float)random.NextDouble() * 300;
            }
        }
Example #17
0
        public virtual void Shoot(Vector2 direction)
        {
            this.shootDirection = direction;

            if (this.shooterCooldown > 0)
            {
                this.shooterCooldown -= 1;
            }
            else
            {
                string[] bulletImages =
                {
                    ImageAddresses.Projectile0Image,
                    ImageAddresses.Projectile1Image
                };

                Bullet someBullet = (Bullet)DynamicObjectFactory.Instance.Create(
                    new Vector2(this.PositionX, this.PositionY),
                    bulletImages[this.bulletRandomizer.Next(0, bulletImages.Length)],
                    ObjectType.Bullet,
                    new Color(this.bulletRandomizer.Next(0, 255),
                              this.bulletRandomizer.Next(0, 255),
                              this.bulletRandomizer.Next(0, 255),
                              this.bulletRandomizer.Next(0, 255)),
                    layerDepth: 1f,
                    rotation: 0f,
                    scale: .3f,
                    damage: this.Damage,
                    cooldown: 8,
                    movementSpeed: 5,
                    targetDir: this.shootDirection);
                someBullet.FriendlyFire = this.ObjType == ObjectType.Player;
                SceneManager.AddObject(someBullet);

                this.laserEffect.Play(.3f, 0f, 0f);

                this.shooterCooldown = this.initialCooldown;
            }
        }
Example #18
0
        public void Update(GameTime gameTime)
        {
            if (this.enemyCount <= 0 && this.doorAdded == false)
            {
                Door doorToNextLevel = (Door)StaticObjectFactory.Instance.Create(
                    new Vector2(50, GameResolution.DefaultHeight / 2),
                    ImageAddresses.DoorToNextLevelImage,
                    ObjectType.Door,
                    Color.White,
                    .65f,
                    0f,
                    RenderLayers.UiLayer);
                SceneManager.AddObject(doorToNextLevel);

                this.doorAdded = true;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                EntryPoint.TheGame.Exit();
            }
        }
Example #19
0
        public static void Instantiate(PlayerObject player, Vector2 position)
        {
            int        size = 50 + random.Next(50);
            GameObject fish = new GameObject(new Vector2(size, size), "Fish", position);

            // Handle collision with the hook (player)
            fish.AddOnCollisionListener("HOOKED", (collider) => {
                if (collider.Tag == "Player" && !Game.GameEnded)
                {
                    fish.Tag = "Hooked_Fish";
                    fish.RemoveCollisionListener("HOOKED");
                    fish.Animator.StopAnimationClip();
                    fish.Animator.CurrentTexture = "FISH3_SWIM_RIGHT";
                    fish.Transform.Rotation      = 90;

                    float spaceX = (float)random.NextDouble() * 25;
                    float spaceY = (float)random.NextDouble() * -50;
                    fish.Transform.SetPositionFn(() => {
                        fish.Transform.Position.X = player.Transform.Position.X - (player.Transform.Size.X * 1.5f) + spaceX;
                        fish.Transform.Position.Y = player.Transform.Position.Y + player.Transform.Size.Y + spaceY - 20;
                    });
                }
            });

            // Register textures (sprites)
            fish.Animator.AddTexture("FISH3_SWIM_RIGHT", FISH3_TEXTURES_IDS[0], 6, 600);
            fish.Animator.AddTexture("FISH3_REST_RIGHT", FISH3_TEXTURES_IDS[1], 6, 600);
            fish.Animator.AddTexture("FISH3_SWIM_LEFT", FISH3_TEXTURES_IDS[2], 6, 600);
            fish.Animator.AddTexture("FISH3_REST_LEFT", FISH3_TEXTURES_IDS[3], 6, 600);

            // Select a random animation clip
            fish.Animator.AddAnimationClip("CLIP", GetAnimationClip(random.Next(6), fish));
            fish.Animator.PlayAnimationClip("CLIP");

            SceneManager.AddObject(fish);
        }
Example #20
0
        private void LoadObject(ObjectData data)
        {
            GameObject gobject;
            string     absoluteMeshPath;
            Transform  importedParent = null;

            // Check for import
            if (data.isImported)
            {
                try
                {
                    importedParent   = new GameObject("__VRtist_tmp_load__").transform;
                    absoluteMeshPath = data.meshPath;
                    // Don't use async import since we may reference the game object for animations or constraints
                    // and the object must be loaded before we do so
                    GlobalState.GeometryImporter.ImportObject(absoluteMeshPath, importedParent, true);
                    if (importedParent.childCount == 0)
                    {
                        return;
                    }
                    gobject = importedParent.GetChild(0).gameObject;
                }
                catch (System.Exception e)
                {
                    Debug.LogError("Failed to load external object: " + e.Message);
                    return;
                }
            }
            else
            {
                absoluteMeshPath = GetSaveFolderPath(currentProjectName) + data.meshPath;
                gobject          = new GameObject(data.name);
            }

            LoadCommonData(gobject, data);
            gobject.name = data.name;

            // Mesh
            if (null != data.meshPath && data.meshPath.Length > 0)
            {
                if (!data.isImported)
                {
                    if (!loadedMeshes.TryGetValue(absoluteMeshPath, out Mesh mesh))
                    {
                        MeshData meshData = new MeshData();
                        SerializationManager.Load(absoluteMeshPath, meshData);
                        mesh = meshData.CreateMesh();
                        loadedMeshes.Add(absoluteMeshPath, mesh);
                    }
                    gobject.AddComponent <MeshFilter>().sharedMesh  = mesh;
                    gobject.AddComponent <MeshRenderer>().materials = LoadMaterials(data);
                    gobject.AddComponent <MeshCollider>();
                }

                if (!data.visible)
                {
                    foreach (Component component in gobject.GetComponents <Component>())
                    {
                        Type componentType = component.GetType();
                        var  prop          = componentType.GetProperty("enabled");
                        if (null != prop)
                        {
                            prop.SetValue(component, data.visible);
                        }
                    }
                }
            }

            SceneManager.AddObject(gobject);

            if (data.parentPath.Length > 0)
            {
                SceneManager.SetObjectParent(gobject, rootTransform.Find(data.parentPath).gameObject);
            }

            if (data.isImported)
            {
                ParametersController controller = gobject.AddComponent <ParametersController>();
                controller.isImported = true;
                controller.importPath = data.meshPath;

                if (null != importedParent)
                {
                    Destroy(importedParent.gameObject);
                }
            }
        }
Example #21
0
        public void Load()
        {
            this.someTimer          = new Timer();
            this.someTimer.Interval = 2000;
            this.someTimer.Elapsed += new ElapsedEventHandler(this.LoadWin);

            Background backgr = (Background)UiFactory.Instance.Create(
                Color.White,
                ImageAddresses.HardLevelBackgroundImage,
                .7f,
                RenderLayers.BackgroundLayer);

            SceneManager.AddObject(backgr);

            Player fighter = (Player)DynamicObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth - 200, GameResolution.DefaultHeight / 2),
                ImageAddresses.PlayerImage,
                ObjectType.Player,
                Color.White,
                scale: 0.6f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 5f,
                damage: 50,
                health: 100,
                cooldown: 5);

            SceneManager.AddObject(fighter);

            PlayerHUD hud = (PlayerHUD)UiFactory.Instance.Create(
                FontAddresses.HudFont,
                Color.White,
                fighter,
                RenderLayers.UiLayer);

            SceneManager.AddObject(hud);

            Boss testBoss = (Boss)DynamicObjectFactory.Instance.Create(
                new Vector2(505, 505),
                ImageAddresses.BossImage,
                ObjectType.Boss,
                Color.White,
                scale: 1.5f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 1f,
                damage: 10,
                health: 1300);

            testBoss.OnDead += this.DecreaseEnemyCount;
            this.enemyCount += 1;

            SceneManager.AddObject(testBoss);

            Wall topWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth / 2, 0),
                ImageAddresses.HorizontalWall,
                ObjectType.Wall,
                Color.Black,
                1f,
                0f,
                1f);

            SceneManager.AddObject(topWall);

            Wall bottomWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth / 2, GameResolution.DefaultHeight),
                ImageAddresses.HorizontalWall,
                ObjectType.Wall,
                Color.Black,
                1f,
                0f,
                1f);

            SceneManager.AddObject(bottomWall);

            Wall rightWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(0, GameResolution.DefaultHeight),
                ImageAddresses.VerticalWall,
                ObjectType.Wall,
                Color.Black,
                1f,
                0f,
                1f);

            SceneManager.AddObject(rightWall);

            Wall leftWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth, GameResolution.DefaultHeight),
                ImageAddresses.VerticalWall,
                ObjectType.Wall,
                Color.Black,
                1f,
                0f,
                1f);

            SceneManager.AddObject(leftWall);

            this.GenerateEnemiesAtRandomPositions();
        }
Example #22
0
        public void Load()
        {
            this.LoadStats();

            Background backgr = (Background)UiFactory.Instance.Create(
                Color.White,
                ImageAddresses.StatsBackgroundImage,
                backgroundScale: .72f,
                backgroundLayer: RenderLayers.BackgroundLayer);

            SceneManager.AddObject(backgr);

            this.backButton = (Button)UiFactory.Instance.Create(
                Color.White,
                new Vector2(50, 50),
                ImageAddresses.NormalBackButton,
                ImageAddresses.HoveredBackButton,
                ImageAddresses.InactiveBackButton,
                RenderLayers.UiLayer,
                scale: .8f);
            SceneManager.AddObject(this.backButton);

            this.clearStatsButton = (Button)UiFactory.Instance.Create(
                Color.White,
                new Vector2(50, 130),
                ImageAddresses.NormalClearStatsButton,
                ImageAddresses.HoveredClearStatsButton,
                ImageAddresses.InactiveClearStatsButton,
                RenderLayers.UiLayer,
                scale: .8f);
            SceneManager.AddObject(this.clearStatsButton);

            TextField deaths = (TextField)UiFactory.Instance.Create(
                FontAddresses.StatsFont,
                "Number of deaths: " + this.deaths,
                Color.Red,
                new Vector2(50, 250),
                RenderLayers.UiLayer);

            SceneManager.AddObject(deaths);

            TextField kills = (TextField)UiFactory.Instance.Create(
                FontAddresses.StatsFont,
                "Number of kills: " + this.killsCount,
                Color.Red,
                new Vector2(50, 350),
                RenderLayers.UiLayer);

            SceneManager.AddObject(kills);

            TextField score = (TextField)UiFactory.Instance.Create(
                FontAddresses.StatsFont,
                "Max score: " + this.maxScore,
                Color.Red,
                new Vector2(50, 450),
                RenderLayers.UiLayer);

            SceneManager.AddObject(score);

            this.CurrentSelectedButton = this.backButton;

            this.Buttons.Add(this.backButton);
            this.Buttons.Add(this.clearStatsButton);

            this.backButton.OnPressed       += this.LoadMenu;
            this.clearStatsButton.OnPressed += this.ClearStats;
        }
Example #23
0
        public void InitScene()
        {
            background = new GameObject(new Vector2(SceneManager.ScreenSize.X * 0.825f, 2000 / 3000f * SceneManager.ScreenSize.X * 0.825f, SceneManager.ScreenSize.X, SceneManager.ScreenSize.Y));
            background.Animator.AddTexture("MAP", new Bitmap("./Textures/MAP.png"));
            background.Animator.CurrentTexture = "MAP";
            background.IsHidden = true;
            SceneManager.AddObject(background);

            label = new Label(quotes[LEVEL], 32, Color.White, SceneManager.ScreenSize.WithRef(SceneManager.ScreenSize), Label.Alignment.CENTER, 25);
            SceneManager.AddObject(label);

            indexesBackground = new GameObject(new Vector2((displaySize.X + SPACE) * 2 + SPACE, displaySize.Y * 4 + SPACE * 5), "", new Vector2(SceneManager.ScreenSize.X - (displaySize.X + SPACE) * 2 - SPACE, 0, SceneManager.ScreenSize.X, 0, (displaySize.X + SPACE) * 2 + SPACE));
            indexesBackground.Animator.Color          = Color.FromArgb(113, 10, 10, 10);
            indexesBackground.Animator.CurrentTexture = Animator.SOLID_TEXTURE;
            indexesBackground.IsHidden = true;
            SceneManager.AddObject(indexesBackground);

            indexes = new GameObject[8];
            for (int i = 0; i < 8; i++)
            {
                indexes[i] = new GameObject(displaySize, "", new Vector2(SceneManager.ScreenSize.X - (displaySize.X + SPACE) * (i % 2 + 1), (displaySize.Y + SPACE) * (i / 2) + SPACE, SceneManager.ScreenSize.X, 0, (displaySize.X + SPACE) * (i % 2 + 1)));
                indexes[i].Animator.AddTexture("DISPLAY", GetTexture(i));
                indexes[i].Animator.CurrentTexture = "DISPLAY";
                indexes[i].IsHidden = true;
                SceneManager.AddObject(indexes[i]);
            }

            backgroundBottom = new GameObject(new Vector2(SceneManager.ScreenSize.X, 200, SceneManager.ScreenSize.X, 0), "", new Vector2(0, SceneManager.ScreenSize.Y - 200, 0, SceneManager.ScreenSize.Y, 0, 200));
            backgroundBottom.Animator.Color          = Color.FromArgb(113, 10, 10, 10);
            backgroundBottom.Animator.CurrentTexture = Animator.SOLID_TEXTURE;
            backgroundBottom.IsHidden = true;
            SceneManager.AddObject(backgroundBottom);

            currentSpeech      = 0;
            character          = new GameObject(new Vector2(150, 150), "", new Vector2(25, SceneManager.ScreenSize.Y - 175, 0, SceneManager.ScreenSize.Y, 0, 175));
            character.IsHidden = true;
            for (int i = 0; i < CHARACTERS_TEXTURES_IDS.Length; i++)
            {
                character.Animator.AddTexture("CHARACTER_" + i, CHARACTERS_TEXTURES_IDS[i]);
            }

            SceneManager.AddObject(character);

            speech = new Label("", 22, Color.White, new Vector2(SceneManager.ScreenSize.X - 200, 200, SceneManager.ScreenSize.X, 0, 200));
            speech.Transform.Position = new Vector2(200, SceneManager.ScreenSize.Y - 175, 0, SceneManager.ScreenSize.Y, 0, 175);
            speech.IsHidden           = true;
            SceneManager.AddObject(speech);

            start = SceneManager.Now;

            // Play games' song
            long position;

            try {
                position = OutputDevice.GetPosition();
            } catch {
                position = 0;
            }

            if (position == 0)
            {
                keepPlaying = true;
                OutputDevice.PlaybackStopped += SongStopped;
                OutputDevice.Init(audioFile);
                OutputDevice.Play();
            }
        }
Example #24
0
        public void Init()
        {
            labelsBackground = new GameObject(SceneManager.ScreenSize.WithRef(SceneManager.ScreenSize));
            labelsBackground.Animator.Color          = Color.FromArgb(100, 10, 10, 10);
            labelsBackground.Animator.CurrentTexture = Animator.SOLID_TEXTURE;
            labelsBackground.IsHidden = true;
            SceneManager.AddObject(labelsBackground);

            Vector2 labelSize = SceneManager.ScreenSize.Clone();

            labelSize.Y -= PADDING + FONT_SIZE * 1.5f;
            labelSize    = labelSize.WithRef(SceneManager.ScreenSize, 0, PADDING - FONT_SIZE * 1.5f);
            about        = new Label("Desenvolvedor: Lucas Rassilan Vilanova\nMatéria: Computação Gráfica\nProfessor: Flávio Coutinho\n\n1º Semestre de 2019\nCentro Federal de Educação Tecnológica\nde Minas Gerais", FONT_SIZE, Color.White, labelSize);
            about.Transform.Position.Y = PADDING + FONT_SIZE * 1.5f;
            about.IsHidden             = true;
            SceneManager.AddObject(about);

            instructions = new Label("\nInstruções:\nPara jogar utilize as setas direita e esquerda ou as teclas A e D para movimentar o anzol. Use o mouse para clicar nas bombas e explodi-las antes que elas te atinjam. Caso encoste em uma bomba, você perderá uma vida (ração de peixe). Você pode estourar as bolhas do fundo do oceano para ganhar pontos, sendo que ao acumular 10 bolhas você ganha uma nova vida, podendo ter no máximo 4 vidas.\nApós pescar os peixes e trazê-los a superfície, você deverá clicar sobre eles para coleta-los. Ao coletar um peixe você recebe um valor proporcional ao tamanho dele.\n\nModos de jogo:\nNo modo Campanha, para passar de fase você deverá pescar peixes o suficiente para atingir uma quantidade alvo indicada no centro superior da tela.\nJá no Arcade você pesca até suas vidas acabarem, e as 4 melhores pontuações ficam listadas nos recordes.", (int)(FONT_SIZE * 0.7), Color.White, labelSize, Label.Alignment.RIGHT, 25);
            instructions.Transform.Position.Y = PADDING + FONT_SIZE * 1.5f;
            instructions.IsHidden             = true;
            SceneManager.AddObject(instructions);

            for (int i = 0; i < BTN_TEXTS.Length; i++)
            {
                // Create a local variable in this scope that is not shared between the buttons
                int idx = i;

                buttons[idx] = new Button(BTN_TEXTS[idx], FONT_SIZE, this.buttonBackgroundColor, this.buttonSize);
                buttons[idx].Transform.SetPositionFn(() => {
                    buttons[idx].Transform.Position.X = SceneManager.ScreenSize.X / 2f - this.buttonSize.X / 2f;
                    buttons[idx].Transform.Position.Y = PADDING * (idx + 1) + (int)(FONT_SIZE * 1.5) + this.buttonSize.Y / 2f + this.buttonSize.Y * idx;
                });

                switch (idx)
                {
                case 0:
                    buttons[idx].AddOnClickListener(() => {
                        StoryManager.LEVEL = 0;
                        SceneManager.LoadScene("STORY_MANAGER");
                    });
                    break;

                case 1:
                    buttons[idx].AddOnClickListener(() => {
                        ShowLevels = true;
                        for (int j = 0; j < BTN_TEXTS.Length; j++)
                        {
                            buttons[j].IsHidden = true;
                        }

                        for (int j = 0; j < BTN_LEVELS_TEXTS.Length; j++)
                        {
                            levelButtons[j].IsHidden = false;
                        }
                    });
                    break;

                case 2:
                    buttons[idx].AddOnClickListener(() => {
                        Game.Goal = 0;
                        SceneManager.LoadScene("GAME");
                    });
                    break;

                case 3:
                    buttons[idx].AddOnClickListener(() => {
                        ShowInstructions          = true;
                        labelsBackground.IsHidden = instructions.IsHidden = false;
                        for (int j = 0; j < BTN_TEXTS.Length; j++)
                        {
                            buttons[j].IsHidden = true;
                        }
                    });
                    break;

                case 4:
                    buttons[idx].AddOnClickListener(() => {
                        ShowAbout = true;
                        labelsBackground.IsHidden = about.IsHidden = false;
                        for (int j = 0; j < BTN_TEXTS.Length; j++)
                        {
                            buttons[j].IsHidden = true;
                        }
                    });
                    break;

                case 5:
                    buttons[idx].AddOnClickListener(System.Windows.Forms.Application.Exit);
                    break;
                }

                SceneManager.AddObject(buttons[idx]);
            }

            for (int i = 0; i < BTN_LEVELS_TEXTS.Length; i++)
            {
                int idx = i;
                levelButtons[idx] = new Button(BTN_LEVELS_TEXTS[idx], FONT_SIZE, this.buttonBackgroundColor, this.buttonLevelsSize);
                levelButtons[idx].Transform.SetPositionFn(() => {
                    levelButtons[idx].Transform.Position.X = SceneManager.ScreenSize.X / 2f + (idx % 2 == 0 ? -this.buttonLevelsSize.X - PADDING : PADDING);
                    levelButtons[idx].Transform.Position.Y = PADDING * (3 + (idx / 2)) + (int)(FONT_SIZE * 1.5) + this.buttonLevelsSize.Y / 2f + this.buttonLevelsSize.Y * (idx / 2);
                });

                levelButtons[idx].IsHidden = true;
                levelButtons[idx].AddOnClickListener(() => {
                    StoryManager.LEVEL = idx;
                    SceneManager.LoadScene("STORY_MANAGER");
                });

                SceneManager.AddObject(levelButtons[idx]);
            }

            if (ShowAbout)
            {
                labelsBackground.IsHidden = about.IsHidden = false;
                for (int j = 0; j < BTN_TEXTS.Length; j++)
                {
                    buttons[j].IsHidden = true;
                }
            }
        }
Example #25
0
        public void InitScene()
        {
            IsDisposed = false;
            GameEnded  = false;
            gameHUD    = new GameHUD(gl);
            gameHUD.Init();
            SceneManager.HUD = gameHUD;

            // Create scene's background
            CreateBackground();

            // Create player
            PlayerObject player = new PlayerObject(new Vector2(34, 71), "Player", new Vector2(SceneManager.ScreenSize.X / 2f, 5));

            player.Animator.AddTexture("HOOK", new Bitmap("./Textures/HOOK.png"));
            player.Animator.CurrentTexture = "HOOK";
            SceneManager.AddObject(player);
            SceneManager.Player = player;

            // Create fishes
            Fish.RegisterTextures();
            Fish3.RegisterTextures();
            new Thread(new ThreadStart(CreateFishes)).Start();

            // Create bombs
            Bombs.RegisterTextures();
            new Thread(new ThreadStart(CreateBombs)).Start();

            // Create bubbles
            float bubblePos = 500;

            while (bubblePos < 17000)
            {
                CreateBubbles(new Vector2((float)this.random.NextDouble() * SceneManager.ScreenSize.X, bubblePos, SceneManager.ScreenSize.X, 0));
                bubblePos += 50 + (float)this.random.NextDouble() * 475;
            }

            // Create player's aim
            GameObject aim = new GameObject(new Vector2(40, 40), "Aim");

            aim.Animator.AddTexture("AIM", AIM_TEXTURE_ID);
            aim.Animator.CurrentTexture = "AIM";
            aim.Transform.SetPositionFn(() => {
                aim.Transform.Position = SceneManager.MousePositionInScene() - aim.Transform.Size / 2f;
            });
            SceneManager.Aim = aim;

            // Play games' song
            long position;

            try {
                position = OutputDevice.GetPosition();
            } catch {
                position = 0;
            }

            if (position == 0)
            {
                keepPlaying = true;
                OutputDevice.PlaybackStopped += SongStopped;
                OutputDevice.Init(audioFile);
                OutputDevice.Play();
            }
        }
        /// <summary>
        /// Metoda se postara o nacteni vsech zdroju z xml do sceny
        /// </summary>
        /// <param name="url">Cesta k xml popisujicimu scenu</param>
        public void LoadSceneFromXml(String url)
        {
            sceneManager.Clear();

            Logger.AddInfo("Nacitani data.xml");
            data = new DataControl(device, sceneManager.GetSharedPool());
            List <Entity> entity = data.LoadXML(url);

            Type objectType;

            Object[]          par;
            ConstructorInfo[] constructorInfo;
            ParameterInfo[]   parameters;

            Assembly asm = Assembly.GetExecutingAssembly();

            foreach (Entity obj in entity)
            {
                List <Parametr> entityParameters = obj.GetParametrs();

                if (obj.Type == "Microsoft.DirectX.Direct3D.Effect")
                {
                    foreach (Parametr v in entityParameters)
                    {
                        sceneManager.AddEffect(v.name, v.value as Effect);
                    }

                    continue;
                }

                objectType      = asm.GetType(obj.Type);
                constructorInfo = objectType.GetConstructors();
                List <Object> objPar = new List <object>();
                foreach (ConstructorInfo constructor in constructorInfo)
                {
                    objPar.Clear();
                    parameters = constructor.GetParameters();

                    foreach (ParameterInfo param in parameters)
                    {
                        if (param.ParameterType.ToString() == "Microsoft.DirectX.Direct3D.Device")
                        {
                            objPar.Add(device);
                        }
                        else if (param.ParameterType.ToString() == "WiccanRede.Scene.SceneManager")
                        {
                            objPar.Add(sceneManager);
                        }
                        else
                        {
                            Parametr obj2 = obj[param.Name];

                            if (obj2 != null)
                            {
                                objPar.Add(obj2.value);
                            }
                            else
                            {
                                objPar.Add(null);
                            }
                        }
                    }
                }

                par = objPar.ToArray();

                Effect shader = null;
                foreach (Parametr p in entityParameters)
                {
                    if (p.type == "Microsoft.DirectX.Direct3D.Effect")
                    {
                        shader = p.value as Effect;
                    }
                    else if (p.name.ToLower() == "shader")
                    {
                        shader = sceneManager[p.value as String];
                    }
                }

                String name = obj.Type;

                if (obj["name"] != null)
                {
                    name = obj["name"].value as String;
                }

                bool shadowEmitter = true;

                if (obj["shadowEmitter"] != null)
                {
                    shadowEmitter = (bool)obj["shadowEmitter"].value;
                }

                sceneManager.AddObject(name, Activator.CreateInstance(objectType, par) as GeneralObject, shader, shadowEmitter);
            }
        }
Example #27
0
        public void Load()
        {
            this.doorAdded = false;

            Background backgr = (Background)UiFactory.Instance.Create(
                Color.White,
                ImageAddresses.LevelBackgroundImage,
                .72f,
                RenderLayers.BackgroundLayer);

            SceneManager.AddObject(backgr);

            Player fighter = (Player)DynamicObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth - 300, GameResolution.DefaultHeight / 2),
                ImageAddresses.PlayerImage,
                ObjectType.Player,
                Color.White,
                scale: 0.6f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 5f,
                damage: 100,
                health: 200,
                cooldown: 5);

            SceneManager.AddObject(fighter);

            Creep firstCreep = (Creep)DynamicObjectFactory.Instance.Create(
                new Vector2(205, 555),
                ImageAddresses.CreepImage,
                ObjectType.Creep,
                Color.White,
                scale: 0.5f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 1f,
                damage: 5,
                health: 100);

            firstCreep.OnDead += this.DecreaseEnemyCount;
            this.enemyCount   += 1;
            SceneManager.AddObject(firstCreep);

            Creep secondCreep = (Creep)DynamicObjectFactory.Instance.Create(
                new Vector2(305, 555),
                ImageAddresses.CreepImage,
                ObjectType.Creep,
                Color.Red,
                scale: 0.5f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 1f,
                damage: 5,
                health: 100);

            secondCreep.OnDead += this.DecreaseEnemyCount;
            this.enemyCount    += 1;
            SceneManager.AddObject(secondCreep);

            Creep thirdCreep = (Creep)DynamicObjectFactory.Instance.Create(
                new Vector2(805, 405),
                ImageAddresses.CreepImage,
                ObjectType.Creep,
                Color.Blue,
                scale: 0.5f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 1f,
                damage: 5,
                health: 100);

            thirdCreep.OnDead += this.DecreaseEnemyCount;
            this.enemyCount   += 1;
            SceneManager.AddObject(thirdCreep);

            Wizard testWizard = (Wizard)DynamicObjectFactory.Instance.Create(
                new Vector2(405, 305),
                ImageAddresses.WizardImage,
                ObjectType.Wizard,
                Color.White,
                scale: 0.5f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 1f,
                damage: 5,
                health: 100);

            testWizard.OnDead += this.DecreaseEnemyCount;
            this.enemyCount   += 1;
            SceneManager.AddObject(testWizard);

            Archer testArcher = (Archer)DynamicObjectFactory.Instance.Create(
                new Vector2(800, 500),
                ImageAddresses.ArcherImage,
                ObjectType.Archer,
                Color.White,
                scale: 0.5f,
                rotation: 0,
                layerDepth: RenderLayers.CharacterLayer,
                movementSpeed: 1f,
                damage: 5,
                health: 100,
                cooldown: 50);

            testWizard.OnDead += this.DecreaseEnemyCount;
            this.enemyCount   += 1;
            SceneManager.AddObject(testWizard);

            // Add player HUD
            PlayerHUD hud = (PlayerHUD)UiFactory.Instance.Create(
                FontAddresses.HudFont,
                Color.White,
                fighter,
                RenderLayers.UiLayer);

            SceneManager.AddObject(hud);

            Wall topWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth / 2, 0),
                ImageAddresses.HorizontalWall,
                ObjectType.Wall,
                Color.DarkCyan,
                1f,
                0f,
                1f);

            SceneManager.AddObject(topWall);

            Wall bottomWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth / 2, GameResolution.DefaultHeight),
                ImageAddresses.HorizontalWall,
                ObjectType.Wall,
                Color.DarkCyan,
                1f,
                0f,
                1f);

            SceneManager.AddObject(bottomWall);

            Wall rightWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(0, GameResolution.DefaultHeight),
                ImageAddresses.VerticalWall,
                ObjectType.Wall,
                Color.DarkCyan,
                1f,
                0f,
                1f);

            SceneManager.AddObject(rightWall);

            Wall leftWall = (Wall)StaticObjectFactory.Instance.Create(
                new Vector2(GameResolution.DefaultWidth, GameResolution.DefaultHeight),
                ImageAddresses.VerticalWall,
                ObjectType.Wall,
                Color.DarkCyan,
                1f,
                0f,
                1f);

            SceneManager.AddObject(leftWall);
        }