Exemple #1
0
    void OnCoin(SocketIOEvent socketIOEvent)
    {
        CoinsJSON  coinsJSON = CoinsJSON.CreateFromJSON(socketIOEvent.data.ToString());
        SpawnCoins es        = GetComponent <SpawnCoins>();

        es.SpawnsCoins(coinsJSON);
    }
Exemple #2
0
 public void SpawnsCoins(CoinsJSON coinsJSON)
 {
     foreach (UserJSON coinJSON in coinsJSON.coins)
     {
         Vector3    position = new Vector3(coinJSON.position[0], coinJSON.position[1], coinJSON.position[2]);
         Quaternion rotation = Quaternion.Euler(coinJSON.rotation[0], coinJSON.rotation[1], coinJSON.rotation[2]);
         GameObject newCoin  = Instantiate(coin, position, rotation) as GameObject;
         newCoin.name = coinJSON.name;
     }
 }