Advertisement
Guest User

AudioSync.cs

a guest
Sep 21st, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Networking;
  3. using System.Collections;
  4.  
  5. public class AudioSync : NetworkBehaviour
  6. {
  7.  
  8.     public AudioController audioController;
  9.  
  10.     // Use this for initialization
  11.     void Start()
  12.     {
  13.  
  14.         audioController = GetComponent<AudioController>();
  15.     }
  16.  
  17.     public void syncSound(int id)
  18.     {
  19.         CmdSendServerSound(id);
  20.     }
  21.  
  22.     [Command]
  23.     void CmdSendServerSound(int id)
  24.     {
  25.         RPCSendSoundToClients(id);
  26.     }
  27.  
  28.     [ClientRpc]
  29.     void RPCSendSoundToClients(int id)
  30.     {
  31.         audioController.steps.Play();
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement