// Use this for initialization void Start() { currentLocalRot = Quaternion.identity; this.transform.localPosition = new Vector3(0, 0, 0); owner = transform.parent.GetComponent<NetworkIdentity>(); cmc = transform.parent.gameObject.GetComponentInChildren<CharacterModelControl>(); }
public override void OnStartClient() { // When we are spawned on the client, // find the parent object using its ID, // and set it to be our transform's parent. base.OnStartClient(); Debug.Log("revolver started on client"); // Debug.Log("For: " + gameObject + " Script: " + this); //Debug.Log("Trying to find: " + parentNetId); weaponOwner = ClientScene.FindLocalObject(weaponOwnerNetID); //Debug.Log("Parent object: " + parentObject); cmc = weaponOwner.GetComponentInChildren<CharacterModelControl>(); transform.SetParent(cmc.weaponHand.transform, false); transform.localPosition = Vector3.zero; weaponOwner.GetComponent<CombatControl>().SetWeapon(this); cc = weaponOwner.GetComponent<CombatControl>(); // Debug.Log("Parent set"); weaponOwnerCollider = weaponOwner.GetComponentInChildren<Collider>(); }