Пример #1
0
    public static void updateInventoryForEveryone()
    {
        CommunicationScript      cs        = GameObject.FindGameObjectWithTag("Player").GetComponent <CommunicationScript>();
        Dictionary <string, int> materials = MapGeneratorScript.inventory.materials;

        foreach (KeyValuePair <string, int> pair in materials)
        {
            cs.photonView.RPC("receiveMessage", RpcTarget.Others, "materialupdate/" + pair.Key + "/" + pair.Value);
        }
        cs.photonView.RPC("receiveMessage", RpcTarget.All, "mastersaveinv");
    }
 // Use this for initialization
 void Start()
 {
     S         = this;
     osc       = GetComponentsInChildren <OSC>();
     playerNum = PlayerManager.S.playerNum;
     if (playerNum == 0)
     {
         osc [0].SetAddressHandler("/score1", OnReceiveScore1);
         osc [1].SetAddressHandler("/score2", OnReceiveScore2);
     }
     else
     {
         osc [playerNum + 1].SetAddressHandler("/state", OnReceiveState);
     }
 }