Exemplo n.º 1
0
        public void DebugDraw(ref WallAnchor state)
        {
            float3 position = GetPosition(state);
            float3 normal   = GetNormalWorldSpace();

            Debug.DrawLine(position, position + normal * 0.3f, Color.red);
        }
Exemplo n.º 2
0
        public WallAnchor UpdateAnchor(WallAnchor anchor, float2 uv)
        {
            WallAnchor result;

            float width  = GetWidth();
            float height = GetHeight();

            float ud = uv.x / width;
            float vd = uv.y / height;

            result.u = math.saturate(anchor.u - ud);
            result.v = math.saturate(anchor.v - vd);

            return(result);
        }
Exemplo n.º 3
0
 IEnumerator JumpToRight()
 {
     transform.eulerAngles = Variables.RightOrientationEulerAngles;
     transform.position   += Variables.JumpRightVector * Time.deltaTime;
     while (!hitWallRight)
     {
         transform.position += Variables.JumpRightVector * Time.deltaTime;
         yield return(new WaitForEndOfFrame());
     }
     isJumping          = false;
     NewPosition        = transform.position;
     NewPosition.z      = CurrentWallHit.position.z - Variables.WallOffset;
     transform.position = WallCollisionPoint;
     PlayerAnchor       = WallAnchor.RightSide;
 }
Exemplo n.º 4
0
        public float3 GetPosition(WallAnchor anchor)
        {
            float3 orthogonal = GetOrthogonalLocalSpace();
            float3 vertex     = GetBaseVertex();

            float3 v0 =
                transformPoint(
                    center + Missing.mul(size, vertex) * 0.5f);
            float3 o  = transformDirection(orthogonal);
            float3 up = Missing.up;

            float u = GetWidth() * anchor.u;
            float v = GetHeight() * anchor.v;

            return(v0 - (o * u) - (up * v));
        }
Exemplo n.º 5
0
    public override void OnEnable()
    {
        base.OnEnable();

        state         = State.Suspended;
        previousState = State.Suspended;

        climbingState              = ClimbingState.Idle;
        previousClimbingState      = ClimbingState.Idle;
        lastCollidingClimbingState = ClimbingState.None;

        clothComponents = GetComponentsInChildren <Cloth>();

        ledgeGeometry = LedgeGeometry.Create();
        wallGeometry  = WallGeometry.Create();

        ledgeAnchor = LedgeAnchor.Create();
        wallAnchor  = WallAnchor.Create();

        transition = MemoryIdentifier.Invalid;
        locomotion = MemoryIdentifier.Invalid;
    }
Exemplo n.º 6
0
    public override void OnEnable()
    {
        base.OnEnable();

        kinematica = GetComponent <Kinematica>();

        state         = State.Suspended;
        previousState = State.Suspended;

        climbingState              = ClimbingState.Idle;
        previousClimbingState      = ClimbingState.Idle;
        lastCollidingClimbingState = ClimbingState.None;

        clothComponents = GetComponentsInChildren <Cloth>();

        ledgeGeometry = LedgeGeometry.Create();
        wallGeometry  = WallGeometry.Create();

        ledgeAnchor = LedgeAnchor.Create();
        wallAnchor  = WallAnchor.Create();

        anchoredTransition = AnchoredTransitionTask.Invalid;
    }
Exemplo n.º 7
0
    void Start()
    {
        cameraFollow          = Camera.main.GetComponent <CameraFollow> ();
        Variables             = GetComponent <PhysicsVariablesDefinitions> ();
        rb                    = GetComponent <Rigidbody> ();
        anim                  = GetComponent <Animator> ();
        transform.eulerAngles = Variables.RightOrientationEulerAngles;
        //Randomize starting anchor side
        int randomSide = Random.Range(0, 2);

        if (randomSide == 0)
        {
            PlayerAnchor          = WallAnchor.RightSide;
            transform.eulerAngles = Variables.RightOrientationEulerAngles;
        }
        else
        {
            PlayerAnchor          = WallAnchor.LeftSide;
            transform.eulerAngles = Variables.LeftOrientationEulerAngles;
        }
        NewRotation = transform.eulerAngles;
        Jump();
    }
Exemplo n.º 8
0
 public float GetHeight(ref WallAnchor anchor)
 {
     return(GetHeight() * (1.0f - anchor.v));
 }