Exemple #1
0
 static public Collider ChangeGrippablePoint(ref GrippablePoint2 currentGripping, Collider nextGrippingCollider)
 {
     // 現在掴んでいる場所から離れる
     if (currentGripping != null)
     {
         currentGripping.gameObject.layer = LayerMask.NameToLayer("GrippingPoint");
     }
     currentGripping = nextGrippingCollider.gameObject.GetComponent <GrippablePoint2>();
     currentGripping.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
     return(nextGrippingCollider);
 }
Exemple #2
0
 public void CreateGripPoint(Vector3[] vertices, List <List <int> > grippableList)
 {
     for (int i = 0; i < grippableList.Count; i++) // 次の頂点も同時に参照するため -1
     {
         for (int j = 0; j < grippableList[i].Count - 1; j++)
         {
             Vector3[] worldVert = new Vector3[2] {
                 vertices[grippableList[i][j]], vertices[grippableList[i][j + 1]]
             };
             for (int worldVertI = 0; worldVertI < worldVert.Length; worldVertI++)
             {
                 worldVert[worldVertI] = transform.TransformPoint(worldVert[worldVertI]);
             }
             GrippablePoint2.CreateEdges(worldVert[0], worldVert[1], gameObject.transform);
         }
     }
 }
Exemple #3
0
    void Awake()
    {
        GetComponent <LineRenderer>().GetPositions(edges);

        GrippablePoint2.CreateEdges(edges[0], edges[1]);
        Destroy(gameObject);
        return;

        float radius = 0.1f;

        transform.localScale = new Vector3(radius, radius, radius);


        transform.position   = (edges[0] + edges[1]) / 2;
        transform.localScale = new Vector3((edges[0] - edges[1]).magnitude, radius, radius);  // 仮
        transform.rotation   = Quaternion.FromToRotation(Vector3.right, edges[0] - edges[1]); // 仮
    }
Exemple #4
0
    //? 現在の実装だと役立たず
    static public void SetHandForwardAndBack(
        ref GameObject forwardHand, ref GameObject backHand,
        GameObject rightHand, GameObject leftHand,
        GrippablePoint2 gripping, Vector3 direction)
    {
        var index = gripping.GetEdgeIndexFromDirection(direction);

        switch (index)
        {
        case 0:
            forwardHand = leftHand;
            backHand    = rightHand;
            break;

        case 1:
            forwardHand = rightHand;
            backHand    = leftHand;
            break;

        default:
            break;
        }
    }
Exemple #5
0
 static public void Jump(Vector3 jumpDir, Rigidbody rigid, ref GrippablePoint2 grippablePoint, float jumpPower)
 {
     rigid.AddForce(jumpDir * jumpPower, ForceMode.Impulse);
     ClimberMethod.ReleaseGrippablePoint(ref grippablePoint);
 }
Exemple #6
0
 static public void ReleaseGrippablePoint(ref GrippablePoint2 grippoint)
 {
     grippoint.gameObject.layer = LayerMask.NameToLayer("GrippingPoint");
 }