public override void PropPurchased(Player pPlayer, PurchasedProp pPurchasedProp) { if (pPlayer.uID == mNetworkManager.myPlayer.uID) { PopulateAvailableProps(); mMyProps.Add(pPurchasedProp); } }
public override void PropSold(Player pPlayer, PurchasedProp pPurchasedProp) { if (pPlayer.uID == mNetworkManager.myPlayer.uID) { mMyProps.Remove(pPurchasedProp); PopulateAvailableProps(); } }
public void Remove(PurchasedProp pPurchasedProp) { Destroy(mPurchasedPropObjects[pPurchasedProp].gameObject); mPurchasedPropObjects.Remove(pPurchasedProp); if (uSelectedPurchasedProp != null && uSelectedPurchasedProp.uID == pPurchasedProp.uID) { uSelectedPurchasedProp = null; } }
public void Add(PurchasedProp pPurchasedProp) { GameObject propSelectionPurchasedProp = (GameObject) Instantiate(mPropSelectionPurchasedPropPrefab, Vector3.zero, Quaternion.identity); PropSelectionPurchasedProp p = (PropSelectionPurchasedProp)propSelectionPurchasedProp.GetComponent (typeof(PropSelectionPurchasedProp)); p.uPurchasedProp = pPurchasedProp; p.uImage.Texture = pPurchasedProp.uIconTexture; propSelectionPurchasedProp.transform.parent = mMyPropsList.transform; mPurchasedPropObjects.Add (pPurchasedProp, p); }
public void Add(PurchasedProp pPurchasedProp) { GameObject propSelectionPurchasedProp = (GameObject)Instantiate(mPropSelectionPurchasedPropPrefab, Vector3.zero, Quaternion.identity); PropSelectionPurchasedProp p = (PropSelectionPurchasedProp)propSelectionPurchasedProp.GetComponent(typeof(PropSelectionPurchasedProp)); p.uPurchasedProp = pPurchasedProp; p.uImage.Texture = pPurchasedProp.uIconTexture; propSelectionPurchasedProp.transform.parent = mMyPropsList.transform; mPurchasedPropObjects.Add(pPurchasedProp, p); }
public void Select(PurchasedProp pPurchasedProp) { foreach(KeyValuePair<PurchasedProp, PropSelectionPurchasedProp> kv in mPurchasedPropObjects) { if (kv.Value.uPurchasedProp.uID == pPurchasedProp.uID) { kv.Value.uIsSelected = true; } else { kv.Value.uIsSelected = false; } } uSelectedPurchasedProp = pPurchasedProp; }
public void Select(PurchasedProp pPurchasedProp) { foreach (KeyValuePair <PurchasedProp, PropSelectionPurchasedProp> kv in mPurchasedPropObjects) { if (kv.Value.uPurchasedProp.uID == pPurchasedProp.uID) { kv.Value.uIsSelected = true; } else { kv.Value.uIsSelected = false; } } uSelectedPurchasedProp = pPurchasedProp; }
[RPC] public void SellProp(string pPurchasedPropID) { if (!uPurchasedProps.ContainsKey(pPurchasedPropID)) { return; } // Remove the prop from purchases and add to the budget PurchasedProp p = uPurchasedProps[pPurchasedPropID]; uPurchasedProps.Remove(pPurchasedPropID); uBudget += p.uProp.uPrice; mSceneManager.PropSold(this, p); // I don't think we need to sync buying and selling // if (networkView.isMine) { // networkView.RPC ("SellProp", RPCMode.Others, p.uID); // } }
[RPC] public void PurchaseProp(string pPropID) { Prop prop = mGame.uProps[pPropID]; // Check that there is a prop.uID available bool propAvailable = false; foreach (Prop p in uUnpurchasedProps) { if (p.uID == prop.uID) { propAvailable = true; break; } } if (!propAvailable) { return; } // Check that we have enough money if (uBudget < prop.uPrice) { return; } // Add the prop to our props, and take away the money PurchasedProp purchasedProp = new PurchasedProp(prop); uPurchasedProps.Add(purchasedProp.uID, purchasedProp); uBudget -= prop.uPrice; mSceneManager.PropPurchased(this, purchasedProp); // I don't think we need to sync buying and selling // if (networkView.isMine) { // networkView.RPC ("PurchaseProp", RPCMode.Others, prop.uID); // } }
public virtual void PropSold(Player pPlayer, PurchasedProp pPurchasedProp) { }