Пример #1
0
    private bool IsAttached(GameObject other)
    {
        Throwable t = other.GetComponent <Throwable>();
        Network_InteractableObject nio = other.GetComponent <Network_InteractableObject>();

        return((t && t.attached) || (nio && nio.isAttached));
    }
Пример #2
0
    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();
            }
        }
    }
Пример #3
0
 private void Start()
 {
     rb        = this.GetComponentInParent <Rigidbody>();
     nio       = this.GetComponentInParent <Network_InteractableObject>();
     Coal      = new GameObject();
     Coal.name = "Coal Spawner";
 }
Пример #4
0
    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);
    }
Пример #7
0
    public void DestroyAllBendInstances()
    {
        Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController();

        npc.CmdDestroyAllBendInstances(netId);
    }
Пример #8
0
    public void OnAttachToAnvil()
    {
        Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController();

        npc.CmdOnAttachBendTool(netId);
    }