Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
0
 public void createNewInventory(Inventory  inventory)
 {
     this.inventory = inventory;
 }