Beispiel #1
0
    public void RPC_TradeProperty(PhotonPlayer trader, PhotonPlayer tradee, int[] propA, int[] propB, int moneyA, int moneyB)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NPlayer playerA = FindGamePlayer(trader);
        NPlayer playerB = FindGamePlayer(tradee);

        playerA.ChangeMoney(-moneyA);
        playerA.ChangeMoney(moneyB);
        playerB.ChangeMoney(moneyA);
        playerB.ChangeMoney(-moneyB);

        foreach (int propID in propB)
        {
            NProperty property = NBoardManager.instance.Properties[propID];
            playerB.RemoveProperty(property);
            playerA.AddProperty(property);
            property.SoldTo(playerA);
            photonView.RPC("RPC_SetPropertyOwnerMarker", PhotonTargets.All, propID, trader);
        }

        foreach (int propID in propA)
        {
            NProperty property = NBoardManager.instance.Properties[propID];
            playerA.RemoveProperty(property);
            playerB.AddProperty(property);
            property.SoldTo(playerB);
            photonView.RPC("RPC_SetPropertyOwnerMarker", PhotonTargets.All, propID, tradee);
        }
    }
Beispiel #2
0
 public override void StepOn(NPlayer player)
 {
     if (!PhotonNetwork.isMasterClient)
     {
         return;
     }
     player.ChangeMoney(-fee);
     FindObjectOfType <NParking>().ReceiveFee(fee);
 }
 public override void StepOn(NPlayer player)
 {
     if (!PhotonNetwork.isMasterClient)
     {
         return;
     }
     player.ChangeMoney(totalFee);
     totalFee = 0;
     // text.text = "";
 }
Beispiel #4
0
    public void RPC_BailToGetOut(PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NPlayer player = FindGamePlayer(caller);

        player.ChangeMoney(-100);
        player.GetOutOfJail();
    }
Beispiel #5
0
    public void RPC_DegradeLand(int propertyID, PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NLand   landToDegrade = NBoardManager.instance.Properties[propertyID] as NLand;
        NPlayer player        = FindGamePlayer(caller);

        if (landToDegrade.Degradable && landToDegrade.CurrentLevel > 0)
        {
            player.ChangeMoney(landToDegrade.UpgradePrice / 2);
            landToDegrade.Degrade();
            photonView.RPC("RPC_UpdateLandLevel", PhotonTargets.All, propertyID, landToDegrade.CurrentLevel);
        }
    }
Beispiel #6
0
    public void RPC_PurchaseProperty(int propertyID, int purchasePrice, PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NPlayer   player   = FindGamePlayer(caller);
        NProperty property = NBoardManager.instance.Properties[propertyID];

        if (player.CurrentMoney >= purchasePrice)
        {
            player.ChangeMoney(-purchasePrice);
            player.AddProperty(property);
            property.SoldTo(player);
            photonView.RPC("RPC_SetPropertyOwnerMarker", PhotonTargets.All, propertyID, caller);
        }
    }
Beispiel #7
0
    public void RPC_RedeemProperty(int propertyID, PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }

        NProperty property = NBoardManager.instance.Properties[propertyID];
        NPlayer   player   = FindGamePlayer(caller);

        if (property.IsMortgaged)
        {
            property.IsMortgaged = false;
            player.ChangeMoney(-(int)(property.PurchasePrice / 2 * 1.1f));
            photonView.RPC("RPC_TogglePropertyMortgagedBackground", PhotonTargets.All, propertyID, false);
        }
    }
Beispiel #8
0
 public override void StepOn(NPlayer player)
 {
     if (!PhotonNetwork.isMasterClient)
     {
         return;
     }
     if (_owner == null)
     {
         NDialogManager.instance.CallPropertyPurchaseDialog(_propertyID, player.photonView.owner);
     }
     else
     {
         if (_owner != player)
         {
             _owner.ChangeMoney(_currentRent);
             player.ChangeMoney(-_currentRent);
             Debug.Log(player.photonView.owner.NickName + " paid $" + _currentRent + " to " + _owner.photonView.owner.NickName);
         }
     }
 }
    // 9
    void Wheel_giveOneHundredToOtherPlayer(NPlayer player)
    {
        NPlayer[] players = NGameplay.instance.Players;
        int       min     = 100000;
        int       id      = 0;

        for (int i = 0; i < players.Length; i++)
        {
            if (players[i] == player)
            {
                continue;
            }
            if (players[i].CurrentMoney < min)
            {
                min = players[i].CurrentMoney;
                id  = i;
            }
        }
        players[id].ChangeMoney(100);
        player.ChangeMoney(-100);
    }
    // 8
    void Wheel_receiveOneHundredFromOtherPlayer(NPlayer player)
    {
        NPlayer[] players = NGameplay.instance.Players;
        int       max     = 0;
        int       id      = 0;

        for (int i = 0; i < players.Length; i++)
        {
            if (players[i] == player)
            {
                continue;
            }
            if (players[i].CurrentMoney > max)
            {
                max = players[i].CurrentMoney;
                id  = i;
            }
        }
        players[id].ChangeMoney(-100);
        player.ChangeMoney(100);
    }
Beispiel #11
0
    public void RPC_UpgradeLand(int propertyID, PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NLand   landToUpgrade = NBoardManager.instance.Properties[propertyID] as NLand;
        NPlayer player        = FindGamePlayer(caller);

        //Debug.Log(caller.NickName + " wants to upgrade " + landToUpgrade.PropertyName);

        if (player.CurrentMoney < landToUpgrade.UpgradePrice || landToUpgrade.IsMortgaged)
        {
            return;
        }
        if (landToUpgrade.Upgradable && landToUpgrade.CurrentLevel < NLand.maxLevel)
        {
            player.ChangeMoney(-landToUpgrade.UpgradePrice);
            landToUpgrade.Upgrade();
            photonView.RPC("RPC_UpdateLandLevel", PhotonTargets.All, propertyID, landToUpgrade.CurrentLevel);
        }
    }
 // 5
 void Wheel_GetFiveHundredDollars(NPlayer player)
 {
     player.ChangeMoney(500);
 }
 // 3
 void Wheel_GetTwoHundredDollars(NPlayer player)
 {
     player.ChangeMoney(200);
 }
 // 2
 void Wheel_LoseOneHundredDollars(NPlayer player)
 {
     player.ChangeMoney(-100);
 }
 // 1
 void Wheel_GetOneHundredDollars(NPlayer player)
 {
     player.ChangeMoney(100);
 }
 // 6
 void Wheel_LoseTwentyPercentMoney(NPlayer player)
 {
     player.ChangeMoney((int)(-player.CurrentMoney * 0.2f));
 }
Beispiel #17
0
 public void PassGo(NPlayer player)
 {
     player.ChangeMoney(NGameplay.passGoBonus);
 }
 // 4
 void Wheel_LoseTwoHundredDollars(NPlayer player)
 {
     player.ChangeMoney(-200);
 }