Example #1
0
        public Lab(Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale,
                   List <Polygon> polygons, List <AABB> axisAlignedBoxes, float depthPosition, string name)
        {
            Components.Add("CollisionComponent", new CollisionComponent(this, polygons, axisAlignedBoxes));
            Components.Add("DepthComponent", new DepthComponent(this, depthPosition));
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, -1.0f));

            this.name = name;
        }
        public BackgroundObject(Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale,
                                List <Polygon> polygons, List <AABB> axisAlignedBoxes, string name)
        {
            Components.Add("CollisionComponent", new CollisionComponent(this, polygons, axisAlignedBoxes));
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, 1.0f));

            Name = name;
            interactionDistance = 100.0f;
            mouseIsHovering     = false;
        }
        public InventorySlotHud(ESlotType slotType, Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale)
        {
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, 1.0f));


            //We just initialize these at default values
            // DrawableComponents.Add("RenderComponent2", new RenderComponent(this, null, new Vector2(), 0.0f, new Vector2(), new Vector2(), 1.0f));
            containsItem  = false;
            this.slotType = slotType;
            item          = null;
            numberOfItems = 0;
        }
Example #4
0
        public SnakeGame()
            : base(new ConsoleRenderer(60, 30), new CmdInputManager())
        {
            var screenManager = new ScreenManager(InputManager);

            var screen = new GameScreen(screenManager, GameRenderer.Width, GameRenderer.Height);

            screenManager.AddScreen(screen);

            screen.Show();

            DrawableComponents.Add(new FpsCounter());
            DrawableComponents.Add(screenManager);
        }
Example #5
0
        public MiddleObject(Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale,
                            List <Polygon> polygons, List <AABB> axisAlignedBoxes, float depthPosition, string name)
        {
            Components.Add("CollisionComponent", new CollisionComponent(this, polygons, axisAlignedBoxes));
            Components.Add("DepthComponent", new DepthComponent(this, depthPosition));
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, -1.0f));

            Name = name;
            interactionDistance = 150.0f;
            mouseIsHovering     = false;

            Random r = new Random();

            dRand = r.Next(0, 5);
        }
Example #6
0
        public MiddleObject(Texture2D[] textures, Vector2 position, float rotation, Vector2 origin, Vector2 scale,
                            List <Polygon> polygons, List <AABB> axisAlignedBoxes, int numberOfAnimations, int[] animationSpeeds, int[] numberOfFrames,
                            int[] numberOfRows, float depthPosition, string name)
        {
            Components.Add("CollisionComponent", new CollisionComponent(this, polygons, axisAlignedBoxes));
            Components.Add("DepthComponent", new DepthComponent(this, depthPosition));
            DrawableComponents.Add("AnimationComponent", new AnimationComponent(this, textures, position, rotation, origin, scale,
                                                                                numberOfAnimations, animationSpeeds, numberOfFrames, numberOfRows));

            Name = name;
            interactionDistance = 200.0f;
            mouseIsHovering     = false;

            Random r = new Random();

            dRand = r.Next(0, 5);
        }
Example #7
0
        public MouseCursor(Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale, string name)
        {
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, 0.0f));

            position += Input.getInstance.getMousePosRelativeToScreen();

            ((RenderComponent)DrawableComponents.ElementAt(0).Value).IsMouse = true;

            Name = name;
            interactionDistance = 200.0f;

            foreach (KeyValuePair <string, Texture2D> texture in ResourceManager.getInstance.getRuntimeTextures())
            {
                if (texture.Key == "Mouse")
                {
                    Properties.updateProperty <Texture2D>("Texture2D", texture.Value);
                }
            }
        }
Example #8
0
        public Character(Texture2D[] textures, Vector2 position, Vector2 acceleration, float rotation, Vector2 origin,
                         Vector2 scale, List <Polygon> polygons, List <AABB> axisAlignedBoxes, int numberOfAnimations, int[] animationSpeeds, int[] numberOfFrames,
                         int[] numberOfRows, float depthPosition, string name)
        {
            Components.Add("PhysicsComponent", new PhysicsComponent(this, position, acceleration));
            Components.Add("CollisionComponent", new CollisionComponent(this, polygons, axisAlignedBoxes));
            Components.Add("DepthComponent", new DepthComponent(this, depthPosition));
            DrawableComponents.Add("AnimationComponent", new AnimationComponent(this, textures, position, rotation, origin, scale,
                                                                                numberOfAnimations, animationSpeeds, numberOfFrames, numberOfRows));

            ((PhysicsComponent)Components.ElementAt(0).Value).IsMoveable = true;

            Name               = name;
            inventory          = new Inventory(new ResourceItem());
            fantasyTool        = false;
            shovel             = true;
            openInventory      = true;
            openQuests         = false;
            openCurrentQuests  = false;
            openFinishedQuests = false;

            //Adds the players starting equipment to the inventory
            foreach (KeyValuePair <string, Texture2D> texture in ResourceManager.getInstance.getRuntimeTextures())
            {
                if (texture.Key == "HudPickaxe")
                {
                    SceneManager.getInstance.getHudManager().getInventoryHud().insertItem(new ItemHud(EItemType.PICKAXE, texture.Value,
                                                                                                      new Vector2(), 0.0f, new Vector2(texture.Value.Width / 2, texture.Value.Height / 2), new Vector2(1, 1)), 1, ESlotType.MAIN);
                }
            }
            foreach (KeyValuePair <string, Texture2D> texture in ResourceManager.getInstance.getRuntimeTextures())
            {
                if (texture.Key == "HudShovel")
                {
                    SceneManager.getInstance.getHudManager().getInventoryHud().insertItem(new ItemHud(EItemType.SHOVEL, texture.Value,
                                                                                                      new Vector2(), 0.0f, new Vector2(texture.Value.Width / 2, texture.Value.Height / 2), new Vector2(1, 1)), 1, ESlotType.MAIN);
                }
            }
        }
Example #9
0
        public Shadow(Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale, string name)
        {
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, 1.0f));

            Name = name;
        }
Example #10
0
 /// <summary>
 /// Add component to scene collection.
 /// </summary>
 /// <param name="gameObject">Adds drawable component to collection.</param>
 public void AddComponent(DrawableGameComponent component)
 {
     DrawableComponents.Add(component);
 }
Example #11
0
        public ItemHud(EItemType itemType, Texture2D texture2D, Vector2 position, float rotation, Vector2 origin, Vector2 scale)
        {
            DrawableComponents.Add("RenderComponent", new RenderComponent(this, texture2D, position, rotation, origin, scale, 1.0f));

            this.itemType = itemType;
        }