private bool IsAttached(GameObject other) { Throwable t = other.GetComponent <Throwable>(); Network_InteractableObject nio = other.GetComponent <Network_InteractableObject>(); return((t && t.attached) || (nio && nio.isAttached)); }
private void OnTriggerStay(Collider other) { if (other.tag == tooltag) { bool handAttached = other.GetComponent <Throwable>().attached; Network_InteractableObject nio = other.GetComponent <Network_InteractableObject>(); if (nio) { handAttached = nio.isAttached; } if (!handAttached) { attachedRb = other.GetComponent <Rigidbody>(); attachedRb.constraints = RigidbodyConstraints.FreezeAll; other.transform.position = transform.position; other.transform.rotation = transform.rotation; //* other.transform.rotation; isAttached = true; UnHighlight(); // Needs to use the transform otherwise it doesn't work. // The first Collider it gets is not the AttachPoint. So we need to get the second one it returns ( a child ). other.transform.GetComponentsInChildren <BoxCollider>()[1].enabled = true; } else { other.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; other.transform.GetComponentsInChildren <BoxCollider>()[1].enabled = false; Highlight(); } } }
private void Start() { rb = this.GetComponentInParent <Rigidbody>(); nio = this.GetComponentInParent <Network_InteractableObject>(); Coal = new GameObject(); Coal.name = "Coal Spawner"; }
private void Update() { if (bendTool.attachedRod) { RodGripScript rgs = bendTool.attachedRod.GetComponent <RodGripScript>(); if (rgs.isGripped) { bendInstance.rodGripScriptReference = rgs; Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController(); npc.CmdBendInstanceLookAtGrip(bendInstance.GetComponentInParent <NetworkIdentity>().netId, rgs.target.position); } else if (bendInstance) { bendInstance.rodGripScriptReference = null; } } }
public void UpdateNetworkDeform(BendInstance bendInstance) { Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController(); npc.CmdOnBend(netId, bendInstance.curvature, bendInstance.length, bendInstance.amount, bendInstance.direction, bendInstance.handDirection); }
public void NetworkUpdateMeshCollider() { Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController(); npc.CmdUpdateBendColliders(netId); }
public void DestroyAllBendInstances() { Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController(); npc.CmdDestroyAllBendInstances(netId); }
public void OnAttachToAnvil() { Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController(); npc.CmdOnAttachBendTool(netId); }