diff --git a/Assets/RockField.cs b/Assets/RockField.cs index 4986548..ab8570b 100644 --- a/Assets/RockField.cs +++ b/Assets/RockField.cs @@ -11,10 +11,9 @@ public class RockField : NetworkBehaviour public GameObject RockSpherePrefab; // Use this for initialization - [Server] - void Start () + public override void OnStartServer() { - //if (!isServer) return; + base.OnStartServer(); for (int i = 0; i < numberOfRocks; i++) { @@ -29,8 +28,13 @@ void Start () } } - // Update is called once per frame - void Update () + public override void OnStartClient() + { + base.OnStartClient(); + } + + // Update is called once per frame + void Update () { } } diff --git a/Assets/RockSphere.cs b/Assets/RockSphere.cs index 74ab8f9..bcd0f01 100644 --- a/Assets/RockSphere.cs +++ b/Assets/RockSphere.cs @@ -13,14 +13,13 @@ public class RockSphere : NetworkBehaviour public GameObject rockSpherePrefab; public int pieces; //public float rotationSpeed; - [SyncVar] bool destroyed = false; - [SyncVar] float radius = 0; - [SyncVar] Vector3 pos = Vector3.zero; - [SyncVar] Quaternion rot = Quaternion.identity; + [SyncVar] public bool destroyed = false; + [SyncVar] public float radius = 0; + [SyncVar] public Vector3 pos = Vector3.zero; + [SyncVar] public Quaternion rot = Quaternion.identity; public static int count = 0; // Use this for initialization -// [Server] public override void OnStartServer() { // call the base function, probably is empty @@ -41,8 +40,8 @@ public override void OnStartServer() // move the child rock to original location and rotation rock = transform.Find("Rock.old").gameObject; - rock.transform.position = pos; - rock.transform.rotation = rot; + rock.transform.localPosition = pos; + rock.transform.localRotation = rot; // apply some rotational torque to the parent gameobject object with the rock attached as a child Rigidbody rb = GetComponent(); diff --git a/Assets/RockSphere1.prefab b/Assets/RockSphere1.prefab index 93e420c..21996a4 100644 Binary files a/Assets/RockSphere1.prefab and b/Assets/RockSphere1.prefab differ diff --git a/Assets/RockSphere2.prefab b/Assets/RockSphere2.prefab index 25262ef..ef8c4b2 100644 Binary files a/Assets/RockSphere2.prefab and b/Assets/RockSphere2.prefab differ diff --git a/Assets/RockSphere3.prefab b/Assets/RockSphere3.prefab index c8d3237..440f09c 100644 Binary files a/Assets/RockSphere3.prefab and b/Assets/RockSphere3.prefab differ diff --git a/Assets/RocketSphere.prefab b/Assets/RocketSphere.prefab index a14168e..a2385a1 100644 Binary files a/Assets/RocketSphere.prefab and b/Assets/RocketSphere.prefab differ