Facebook
From NoMossStudios, 3 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 491
  1.  
  2.     public override void Initialize()
  3.     {
  4.         base.Initialize();
  5.         //Give our customer their random appearance
  6.         int head = Random.Range(0, availableHeads.Length);
  7.         int body = Random.Range(0, availableBodies.Length);
  8.         photonView.RPC("InitializeAppearance", RpcTarget.AllBufferedViaServer, head, body);
  9.     }
  10.    
  11.     [PunRPC]
  12.     void InitializeAppearance(int headIndex, int bodyIndex)
  13.     {
  14.         base.Initialize();
  15.         //Initialize our appearance
  16.         ourHead = headIndex;
  17.         for (int i = 0; i < availableHeads.Length; i++)
  18.         {
  19.             availableHeads[i].SetActive(i == headIndex);
  20.         }
  21.  
  22.         ourBody = bodyIndex;
  23.         for(int j = 0; j < availableBodies.Length; j++)
  24.         {
  25.             availableBodies[j].SetActive(j == bodyIndex);
  26.         }
  27.     }