diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 39b043b..bc4cc89 100644 Binary files a/Assets/Scenes/Main.unity and b/Assets/Scenes/Main.unity differ diff --git a/Assets/Scripts/Bazaar.cs b/Assets/Scripts/Bazaar.cs index dd3bc0a..515f4cd 100644 --- a/Assets/Scripts/Bazaar.cs +++ b/Assets/Scripts/Bazaar.cs @@ -6,6 +6,7 @@ public class Bazaar : DropLocation { public Dictionary playersToPositions; + GameObject gameController; void Start () { @@ -17,6 +18,7 @@ void Start () GetComponent ().maxAllowedOccupants = 20; playersToPositions = null; + gameController = GameObject.Find ("GameController"); } @@ -27,6 +29,9 @@ public override void SetOccupant (GameObject o) o.GetComponent ().makeExplorer (gameObject); } + + if (gameController.GetComponent ().currentPhase.Equals ("Placement")) + gameController.GetComponent ().getNextPlayer (); } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index 9b3dee6..6ef61d6 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -31,7 +31,7 @@ public class GameController : MonoBehaviour { DealPublicCards (); BeginPlacementPhase (); - //BeginMovementPhase (); + } diff --git a/Assets/Scripts/MagicCarpet.cs b/Assets/Scripts/MagicCarpet.cs index 998dece..b99a765 100644 --- a/Assets/Scripts/MagicCarpet.cs +++ b/Assets/Scripts/MagicCarpet.cs @@ -38,7 +38,6 @@ void Update () handleMagicCarpetPlayerSelection (); - } diff --git a/Assets/Scripts/MagicCarpetLocation.cs b/Assets/Scripts/MagicCarpetLocation.cs index cd79546..4dc620f 100644 --- a/Assets/Scripts/MagicCarpetLocation.cs +++ b/Assets/Scripts/MagicCarpetLocation.cs @@ -3,34 +3,61 @@ public class MagicCarpetLocation : DropLocation { + GameObject goodToTradeForCarpet; // Use this for initialization void Start () { allowMultipleOccupants = false; - + goodToTradeForCarpet = null; } protected override bool CanOccupy (GameObject potentialOccupant) - { - bool playerHasGoods = potentialOccupant.GetComponent ().player.GetComponent ().hasGoods (); - Debug.Log (playerHasGoods); - return (base.CanOccupy (potentialOccupant) && true);//playerHasGoods); + { + + + if (isMeeple (potentialOccupant)) { + bool playerHasGoods = potentialOccupant.GetComponent ().player.GetComponent ().hasGoods (); + return (base.CanOccupy (potentialOccupant) && playerHasGoods); + } else + return (!goodToTradeForCarpet && potentialOccupant.GetComponent ()); } public override void SetOccupant (GameObject o) { - base.SetOccupant (o); if (o) { - MagicCarpet.playerWithMagicCarpet = o.GetComponent ().player; - //DesertMovementController.playerWithMagicCarpet = o.GetComponent ().player; - GameObject.Find ("GameController").GetComponent ().getNextPlayer (); + if (isMeeple (o)) { + base.SetOccupant (o); + Debug.Log ("meeple"); + } else { + goodToTradeForCarpet = o; + Debug.Log ("good "); + + } + if (occupant && goodToTradeForCarpet) { + givePlayerMagicCarpetPowerForGood (occupant); + GameObject.Find ("GameController").GetComponent ().getNextPlayer (); + + } } - - - + + } + + void givePlayerMagicCarpetPowerForGood (GameObject occupantPlayer) + { + MagicCarpet.playerWithMagicCarpet = occupantPlayer.GetComponent ().player; + DesertGenerator.GoodItem goodGiven = goodToTradeForCarpet.GetComponent ().good; + occupant.GetComponent ().player.GetComponent ().removeGoods (goodGiven, 1); + + Object.Destroy (goodToTradeForCarpet); + + } + + bool isMeeple (GameObject potentialOccupant) + { + return potentialOccupant.GetComponent (); } bool playerHasAnyGoods (GameObject meeple) diff --git a/Assets/Scripts/MerchantCard.cs b/Assets/Scripts/MerchantCard.cs index a781f04..1d72c92 100644 --- a/Assets/Scripts/MerchantCard.cs +++ b/Assets/Scripts/MerchantCard.cs @@ -11,8 +11,7 @@ public class MerchantCard : MonoBehaviour { public GameObject player; public GameController controller; - - + float doubleClickStart = 0; // Use this for initialization diff --git a/Assets/Scripts/Oasis.cs b/Assets/Scripts/Oasis.cs index c75ebce..630f356 100644 --- a/Assets/Scripts/Oasis.cs +++ b/Assets/Scripts/Oasis.cs @@ -28,7 +28,7 @@ void Update () displayResultOfTwoCaseEvent (getMoreWater, foundOasisMessage, isOasisMessage, isMirageMessage); } else if (inControlOfTextBox) { - closeEvent (); + closeEvent (); } diff --git a/Assets/Scripts/PlayerInventory.cs b/Assets/Scripts/PlayerInventory.cs index 55a6185..3db893e 100644 --- a/Assets/Scripts/PlayerInventory.cs +++ b/Assets/Scripts/PlayerInventory.cs @@ -18,7 +18,7 @@ public class PlayerInventory : MonoBehaviour public int victory_points = 0; public List merchantCards; public List merchantCardLocations = new List (); - GameObject draggableGoodPrefab; + GameObject draggableGoodPrefab; //set this to true as the effect of the "invasion" worker placement tile; @@ -41,10 +41,10 @@ void Start () amountOfEachGoodItem.Add (goodItem, 0); } - draggableGoodPrefab = GameObject.Find ("DraggableGood"); - //Vector3 goodOrigin = gameObject.GetComponent ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f; + draggableGoodPrefab = GameObject.Find ("DraggableGood"); + //Vector3 goodOrigin = gameObject.GetComponent ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f; - //GoodTokens (); + //GoodTokens (); merchantCardLocations.Add (transform.position + Vector3.right * 35 + Vector3.up * 1.1f); merchantCardLocations.Add (transform.position + Vector3.right * 45 + Vector3.up * 1.1f); @@ -54,7 +54,8 @@ void Start () } - void GoodTokens() { + void GoodTokens () + { Vector3 goodOrigin = gameObject.GetComponent ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f; for (int type = 0; type < 4; type++) { @@ -66,29 +67,30 @@ void Start () } } - public void addGoodToken(DesertGenerator.GoodItem goodItem) { - addGoodToken (goodItem, gameObject); + public void addGoodToken (DesertGenerator.GoodItem goodItem) + { + addGoodToken (goodItem, gameObject); } + public void addGoodToken (DesertGenerator.GoodItem goodItem, GameObject source) + { + Vector3 goodOrigin = gameObject.GetComponent ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f; - public void addGoodToken(DesertGenerator.GoodItem goodItem, GameObject source) { - Vector3 goodOrigin = gameObject.GetComponent ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f; - - int goodOffset = (int)goodItem % 4; - int goodType = (int)goodItem / 4; - //DesertGenerator.GoodItem goodItem = (DesertGenerator.GoodItem)(type * 3 + offset); - GameObject desert = GameObject.Find("Desert"); + int goodOffset = (int)goodItem % 4; + int goodType = (int)goodItem / 4; + //DesertGenerator.GoodItem goodItem = (DesertGenerator.GoodItem)(type * 3 + offset); + GameObject desert = GameObject.Find ("Desert"); - GameObject tokenObject = (GameObject)Instantiate(draggableGoodPrefab); - GoodToken token = tokenObject.GetComponent(); - token.player = gameObject.GetComponent (); + GameObject tokenObject = (GameObject)Instantiate (draggableGoodPrefab); + GoodToken token = tokenObject.GetComponent (); + token.player = gameObject.GetComponent (); - tokenObject.transform.position = source.transform.position; + tokenObject.transform.position = source.transform.position; - iTween.MoveTo (tokenObject, goodOrigin + Vector3.right * 3 * goodOffset + Vector3.down * 3 * goodType, 2.0f); - //tokenObject.transform.position = goodOrigin + Vector3.right * 3 * goodOffset + Vector3.down * 3 * goodType; + iTween.MoveTo (tokenObject, goodOrigin + Vector3.right * 3 * goodOffset + Vector3.down * 3 * goodType, 2.0f); + //tokenObject.transform.position = goodOrigin + Vector3.right * 3 * goodOffset + Vector3.down * 3 * goodType; - tokenObject.GetComponent ().sprite = desert.GetComponent ().goodTileSprites [(int)goodItem]; + tokenObject.GetComponent ().sprite = desert.GetComponent ().goodTileSprites [(int)goodItem]; } //foreach (DesertGenerator.GoodItem value in Enum.GetValues(typeof(DesertGenerator.GoodItem))) { @@ -145,7 +147,7 @@ public void increaseGood (DesertGenerator.GoodItem good, GameObject source) amountOfEachGoodItem [good] = amountOfEachGoodItem [good] + 1; Debug.Log (amountOfEachGoodType [typeOfGoodItem].ToString () + " " + DesertGenerator.typeOfGoodItem (good).ToString ()); Debug.Log (amountOfEachGoodItem [good].ToString () + " " + good.ToString ()); - addGoodToken (good, source); + addGoodToken (good, source); } @@ -159,9 +161,9 @@ public void increaseGood (DesertGenerator.GoodItem good, int numOf) amountOfEachGoodType [typeOfGoodItem] = newAmount; Debug.Log (amountOfEachGoodItem [good].ToString () + " " + good.ToString ()); - for(int i = 0 ; i < numOf; i++) { - addGoodToken (good); - } + for (int i = 0; i < numOf; i++) { + addGoodToken (good); + } }