protected void BoatIslandCollision(Boat boat, Island island) { if (boat.Colour == island.Colour) { if (boat.carriedResources.Count > 0)//(boat.CarriedResource != null) // if carrying a resource { //Plays the collect resource sound. This should maybe be in the CollectResource method scoreCargo.Play(); foreach (Resource r in boat.carriedResources) { PlayersByColour[(int)boat.Colour].CollectResource(r); island.AddResource(r); } //PlayersByColour[(int)boat.Colour].CollectResource(boat.CarriedResource); //island.AddResource(boat.CarriedResource); // if(boat.CarriedResource.Colour != boat.Colour) // PlayersByColour[(int)boat.Colour].score += RETURN_RESOURCE; //boat.CarriedResource = null; boat.carriedResources.Clear(); } } else { if (!boat.CheckResourceIsCarried(island.ResourceType.islandType))//!boat.carriedResources.Contains(island.ResourceType))//if (boat.CarriedResource == null) // if not carrying a resource { //PLAY THE SOUND takeCargo.Play(); PlayersByColour[(int)island.Colour].score -= 200; Resource r = new Resource(island.ResourceType); boat.carriedResources.Add(r); r.IsCarried = true; r.position = boat.position; //boat.CarriedResource = new Resource(island.ResourceType); //boat.CarriedResource.IsCarried = true; } } }
protected void BoatIslandCollision(Boat boat, Island island) { if (boat.Colour == island.Colour) { if (boat.carriedResources.Count > 0)//(boat.CarriedResource != null) // if carrying a resource { //Plays the collect resource sound. This should maybe be in the CollectResource method scoreCargo.Play(); foreach (Resource r in boat.carriedResources) { PlayersByColour[(int)boat.Colour].CollectResource(r); island.AddResource(r); } //PlayersByColour[(int)boat.Colour].CollectResource(boat.CarriedResource); //island.AddResource(boat.CarriedResource); // if(boat.CarriedResource.Colour != boat.Colour) // PlayersByColour[(int)boat.Colour].score += RETURN_RESOURCE; //boat.CarriedResource = null; boat.carriedResources.Clear(); } } else { if(!boat.CheckResourceIsCarried(island.ResourceType.islandType))//!boat.carriedResources.Contains(island.ResourceType))//if (boat.CarriedResource == null) // if not carrying a resource { //PLAY THE SOUND takeCargo.Play(); PlayersByColour[(int)island.Colour].score -= 200; Resource r = new Resource(island.ResourceType); boat.carriedResources.Add(r); r.IsCarried = true; r.position = boat.position; //boat.CarriedResource = new Resource(island.ResourceType); //boat.CarriedResource.IsCarried = true; } } }
public void CollectReward(int reward) { island.AddResource(Island.ResourceType.Gold, reward); }