// Create a copy from this resource public Resource(Resource resource) : base(resource.sprite) { Colour = resource.Colour; scale = resource.scale; IsCarried = resource.IsCarried; islandType = resource.islandType; }
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); }
// 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)); }
/*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); }