예제 #1
0
        public override bool ApplyOperation()
        {
            if (base.ApplyOperation())
            {
                Network_BendTool netBendTool = objectTransform.GetComponent <Network_BendTool>();

                if (netBendTool && netBendTool.bendTool.bendPrefab != null)
                {
                    GameObject   bendObj      = Instantiate(netBendTool.bendTool.bendPrefab);
                    BendInstance bendInstance = bendObj.GetComponentInChildren <BendInstance>();

                    if (bendInstance)
                    {
                        bendInstance.curvature = curvature;
                        bendInstance.length    = length;
                        bendInstance.amount    = amount;
                        bendInstance.direction = direction;

                        if (!applyOnlyToCollider)
                        {
                            bendInstance.DeformAll();
                        }
                        else
                        {
                            bendInstance.Deform(1);
                        }

                        Destroy(bendObj);
                        return(true);
                    }
                }
            }

            return(false);
        }
    public void RpcUpdateBendColliders(NetworkInstanceId bendInstanceId)
    {
        GameObject   bendInstanceLocal = ClientScene.FindLocalObject(bendInstanceId);
        BendInstance bi = bendInstanceLocal.GetComponentInChildren <BendInstance>();

        bi.UpdateMeshCollider();
    }
예제 #3
0
    public void RpcOnAttachToAnvil(NetworkInstanceId bendInstanceId)
    {
        GameObject bendInstanceLocal = ClientScene.FindLocalObject(bendInstanceId);

        bendInstance = bendInstanceLocal.GetComponentInChildren <BendInstance>();

        bendInstanceLocal.transform.parent   = bendTool.attachedRod.transform;
        bendInstanceLocal.transform.position = bendTool.transform.position;
        bendInstanceLocal.transform.rotation = bendTool.attachedRod.transform.rotation;
        bendInstance.Initialize();
    }
    public void RpcOnBend(NetworkInstanceId bendInstanceId, float curvature, float length, float amount, bool direction, bool handDirection)
    {
        GameObject bendInstanceLocal = ClientScene.FindLocalObject(bendInstanceId);

        if (bendInstanceLocal)
        {
            BendInstance bendInstanceScript = bendInstanceLocal.GetComponentInChildren <BendInstance>();

            bendInstanceScript.curvature     = curvature;
            bendInstanceScript.length        = length;
            bendInstanceScript.amount        = amount;
            bendInstanceScript.direction     = direction;
            bendInstanceScript.handDirection = handDirection;
            bendInstanceScript.DeformAll();
        }
    }
    public void UpdateNetworkDeform(BendInstance bendInstance)
    {
        Network_PlayerController npc = Network_InteractableObject.GetLocalPlayerController();

        npc.CmdOnBend(netId, bendInstance.curvature, bendInstance.length, bendInstance.amount, bendInstance.direction, bendInstance.handDirection);
    }
예제 #6
0
 public void RpcDestroyAllBendInstances()
 {
     bendInstance = null;
 }