예제 #1
0
    protected override void Awake()
    {
        base.Awake();

        R        = Body.GetComponent <Rigidbody>();
        BodyColl = Body.Find("BodyColl").GetComponent <CapsuleCollider>();

        CamPivot       = transform.Find("CamPivot");
        CamSecondPivot = CamPivot.Find("CamSecondPivot");
        CamArm         = CamSecondPivot.Find("CamArm");
        AnimPivot      = CamArm.Find("AnimPivot");
        Cam_t          = AnimPivot.Find("Camera");
        Cam            = Cam_t.GetComponent <Camera>();


        LockArrow = transform.Find("LockArrowCanvas");

        CC = GetComponent <p_CameraController>();
        MC = GetComponent <p_MovementController>();
        AC = GetComponent <p_AttackController>();
        IC = GetComponent <p_InteractionController>();
        V  = GetComponent <p_Visual>();
        PB = (p_PlayerBeing)LB;

        C = GetComponent <p_Controller>();
    }
예제 #2
0
    protected void LockedEnemyRotationHandler()
    {
        Vector3    targetPoint = EnemyLocked.Body.position;
        Quaternion oRot        = CamPivot.rotation;

        CamPivot.LookAt(targetPoint.SetY(CamPivot.position.y) + Visual.right * -lockLeftOffset);

        CamPivot.rotation = Quaternion.Lerp(oRot, CamPivot.rotation, lockLerpSpeed * Utilities.Delta);

        oRot = CamSecondPivot.rotation;
        CamSecondPivot.LookAt(targetPoint + Visual.right * -lockLeftOffset + EnemyLocked.transform.up * 1f);

        CamSecondPivot.rotation         = Quaternion.Lerp(oRot, CamSecondPivot.rotation, lockLerpSpeed * Utilities.Delta);
        CamSecondPivot.localEulerAngles = CamSecondPivot.localEulerAngles.SetY(0).SetZ(0);

        float camLocalEulerX = CamSecondPivot.localEulerAngles.x;

        if (camLocalEulerX > 180)
        {
            camLocalEulerX -= 360;
        }

        eulerRot.x = Utilities.Limit(camLocalEulerX, yNegativeRotLimit, yPositiveRotLimit, false);
        eulerRot.y = Utilities.Limit(CamPivot.localEulerAngles.y, 0f, 360f, true);
    }