Skip to content

Commit

Permalink
Overwrite Main Scene using Emily's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ethansr committed Mar 3, 2014
2 parents d43de2a + d043dd1 commit 34d6676
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 42 deletions.
Binary file modified Assets/Scenes/Main.unity
Binary file not shown.
5 changes: 5 additions & 0 deletions Assets/Scripts/Bazaar.cs
Expand Up @@ -6,6 +6,7 @@
public class Bazaar : DropLocation
{
public Dictionary<GameObject,Vector3> playersToPositions;
GameObject gameController;

void Start ()
{
Expand All @@ -17,6 +18,7 @@ void Start ()
GetComponent<DesertTile> ().maxAllowedOccupants = 20;

playersToPositions = null;
gameController = GameObject.Find ("GameController");

}

Expand All @@ -27,6 +29,9 @@ public override void SetOccupant (GameObject o)
o.GetComponent<Meeple> ().makeExplorer (gameObject);

}

if (gameController.GetComponent<GameController> ().currentPhase.Equals ("Placement"))
gameController.GetComponent<GameController> ().getNextPlayer ();

}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/GameController.cs
Expand Up @@ -31,7 +31,7 @@ public class GameController : MonoBehaviour {
DealPublicCards ();
BeginPlacementPhase ();

//BeginMovementPhase ();


}

Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/MagicCarpet.cs
Expand Up @@ -38,7 +38,6 @@ void Update ()

handleMagicCarpetPlayerSelection ();



}

Expand Down
51 changes: 39 additions & 12 deletions Assets/Scripts/MagicCarpetLocation.cs
Expand Up @@ -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<Meeple> ().player.GetComponent<PlayerInventory> ().hasGoods ();
Debug.Log (playerHasGoods);
return (base.CanOccupy (potentialOccupant) && true);//playerHasGoods);
{


if (isMeeple (potentialOccupant)) {
bool playerHasGoods = potentialOccupant.GetComponent<Meeple> ().player.GetComponent<PlayerInventory> ().hasGoods ();
return (base.CanOccupy (potentialOccupant) && playerHasGoods);
} else
return (!goodToTradeForCarpet && potentialOccupant.GetComponent<GoodToken> ());
}

public override void SetOccupant (GameObject o)
{
base.SetOccupant (o);
if (o) {
MagicCarpet.playerWithMagicCarpet = o.GetComponent<Meeple> ().player;
//DesertMovementController.playerWithMagicCarpet = o.GetComponent<Meeple> ().player;
GameObject.Find ("GameController").GetComponent<GameController> ().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<GameController> ().getNextPlayer ();


}
}




}

void givePlayerMagicCarpetPowerForGood (GameObject occupantPlayer)
{
MagicCarpet.playerWithMagicCarpet = occupantPlayer.GetComponent<Meeple> ().player;
DesertGenerator.GoodItem goodGiven = goodToTradeForCarpet.GetComponent<GoodToken> ().good;
occupant.GetComponent<Meeple> ().player.GetComponent<PlayerInventory> ().removeGoods (goodGiven, 1);

Object.Destroy (goodToTradeForCarpet);

}

bool isMeeple (GameObject potentialOccupant)
{
return potentialOccupant.GetComponent<Meeple> ();
}

bool playerHasAnyGoods (GameObject meeple)
Expand Down
3 changes: 1 addition & 2 deletions Assets/Scripts/MerchantCard.cs
Expand Up @@ -11,8 +11,7 @@ public class MerchantCard : MonoBehaviour {
public GameObject player;
public GameController controller;




float doubleClickStart = 0;
// Use this for initialization

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Oasis.cs
Expand Up @@ -28,7 +28,7 @@ void Update ()
displayResultOfTwoCaseEvent (getMoreWater, foundOasisMessage, isOasisMessage, isMirageMessage);

} else if (inControlOfTextBox) {
closeEvent ();
closeEvent ();

}

Expand Down
52 changes: 27 additions & 25 deletions Assets/Scripts/PlayerInventory.cs
Expand Up @@ -18,7 +18,7 @@ public class PlayerInventory : MonoBehaviour
public int victory_points = 0;
public List<GameObject> merchantCards;
public List<Vector3> merchantCardLocations = new List<Vector3> ();
GameObject draggableGoodPrefab;
GameObject draggableGoodPrefab;


//set this to true as the effect of the "invasion" worker placement tile;
Expand All @@ -41,10 +41,10 @@ void Start ()
amountOfEachGoodItem.Add (goodItem, 0);

}
draggableGoodPrefab = GameObject.Find ("DraggableGood");
//Vector3 goodOrigin = gameObject.GetComponent<Player> ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f;
draggableGoodPrefab = GameObject.Find ("DraggableGood");
//Vector3 goodOrigin = gameObject.GetComponent<Player> ().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);
Expand All @@ -54,7 +54,8 @@ void Start ()

}

void GoodTokens() {
void GoodTokens ()
{

Vector3 goodOrigin = gameObject.GetComponent<Player> ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f;
for (int type = 0; type < 4; type++) {
Expand All @@ -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<Player> ().transform.position + Vector3.down * 6.8f + Vector3.right * 5.5f;

public void addGoodToken(DesertGenerator.GoodItem goodItem, GameObject source) {
Vector3 goodOrigin = gameObject.GetComponent<Player> ().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<GoodToken>();
token.player = gameObject.GetComponent<Player> ();
GameObject tokenObject = (GameObject)Instantiate (draggableGoodPrefab);
GoodToken token = tokenObject.GetComponent<GoodToken> ();
token.player = gameObject.GetComponent<Player> ();

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<SpriteRenderer> ().sprite = desert.GetComponent<DesertTileIndex> ().goodTileSprites [(int)goodItem];
tokenObject.GetComponent<SpriteRenderer> ().sprite = desert.GetComponent<DesertTileIndex> ().goodTileSprites [(int)goodItem];
}
//foreach (DesertGenerator.GoodItem value in Enum.GetValues(typeof(DesertGenerator.GoodItem))) {

Expand Down Expand Up @@ -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);

}

Expand All @@ -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);
}

}

Expand Down

0 comments on commit 34d6676

Please sign in to comment.