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();
     }
 }
Example #3
0
    public void Remove(PurchasedProp pPurchasedProp)
    {
        Destroy(mPurchasedPropObjects[pPurchasedProp].gameObject);
        mPurchasedPropObjects.Remove(pPurchasedProp);

        if (uSelectedPurchasedProp != null && uSelectedPurchasedProp.uID == pPurchasedProp.uID) {
            uSelectedPurchasedProp = null;
        }
    }
Example #4
0
 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);
 }
Example #5
0
    public void Remove(PurchasedProp pPurchasedProp)
    {
        Destroy(mPurchasedPropObjects[pPurchasedProp].gameObject);
        mPurchasedPropObjects.Remove(pPurchasedProp);

        if (uSelectedPurchasedProp != null && uSelectedPurchasedProp.uID == pPurchasedProp.uID)
        {
            uSelectedPurchasedProp = null;
        }
    }
Example #6
0
    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);
    }
Example #7
0
    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;
    }
Example #8
0
    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 override void PropSold(Player pPlayer, PurchasedProp pPurchasedProp)
 {
     if (pPlayer.uID == mNetworkManager.myPlayer.uID) {
         mMyProps.Remove(pPurchasedProp);
         PopulateAvailableProps();
     }
 }
 public override void PropPurchased(Player pPlayer, PurchasedProp pPurchasedProp)
 {
     if (pPlayer.uID == mNetworkManager.myPlayer.uID) {
         PopulateAvailableProps();
         mMyProps.Add(pPurchasedProp);
     }
 }
 public virtual void PropSold(Player pPlayer, PurchasedProp pPurchasedProp)
 {
 }
 public virtual void PropSold(Player pPlayer, PurchasedProp pPurchasedProp)
 {
 }