Example #1
0
        public Resource(Texture2D sprite, Colour colour, Island.IslandType islandType)
            : base(sprite)
        {
            Colour = colour;
            scale = new Vector2(0.3f);
            IsCarried = false;

            this.islandType = islandType;
            Debug.WriteLine("Resource Island Type = " + islandType);
        }
Example #2
0
        // creates a new boat matching the specified colour, loading the sprite from the contentmanager
        public static Resource InitializeFromIslandType(Colour colour, Island.IslandType islandType, ContentManager content)
        {
            // retrieve texture name matching specified colour
            string textureName = resources[islandType];

            // load the texture specified from a folder named Resources
            Texture2D sprite = content.Load<Texture2D>("Cargo/" + textureName);

            // create a new entity using the loaded sprite
            return new Resource(sprite, colour, islandType);
        }
Example #3
0
        /*public void HandleInput(InputState input, int index)
        {
            KeyboardState keyboardState = input.CurrentKeyboardStates(index);
            GamePadState gamePadState = input.CurrrentGamePadStates(index);

            this.twinstick = false;
            Vector2 direction = Vector2.Zero;
            this.bulletDir = Vectror2.Zero;

            direction.X += gamePadState.Thumbsticks.Left.X;
            direction.Y -= gamePadState.ThumbSticks.Left.Y;

            bulletDir.X += gamePadState.Thumbsticks.Right.X;
            bulletDir.Y += gamePadState.Thumbsticks.Right.Y;

        }*/
        public bool CheckResourceIsCarried(Island.IslandType type)
        {
            foreach (Resource r in carriedResources)
            {
                if (r.islandType == type)
                    return true;
            }

            return false;
        }