Exemple #1
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Cantoneira")
     {
         SkaterController sc = transform.parent.gameObject.GetComponent <SkaterController>();
         sc.ReleaseGrindAfterDelay();
     }
 }
Exemple #2
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     Debug.Log("Stay");
     if (collision.tag == "Cantoneira")
     {
         // collision.gameObject.SetActive(false);
         GameObject       skater = transform.parent.gameObject;
         SkaterController sc     = skater.GetComponent <SkaterController>();
         /// bool askingForGrind = sc.askingForGrind;
         // Debug.Log("Asking wheel " + sc.askingForGrind);
         BoxCollider2D bc = collision.transform.parent.gameObject.GetComponent <BoxCollider2D>();
         if (sc.tryinToGrind)
         {
             sc.currentRailGrinding = bc;
             sc.KeepGrind();
         }
     }
 }
Exemple #3
0
        static void Prefix(SkaterController __instance, bool ____landingPrediction, ref float ____startTime, ref float ____duration,
                           ref Quaternion ____startRotation, ref Vector3 ____startUpVector, ref Quaternion ____newUp)
        {
            if (!____landingPrediction)
            {
                ____startTime         = Time.time;
                ____duration          = PlayerController.Instance.boardController.trajectory.CalculateTrajectory(__instance.skaterTransform.position - Vector3.up * 0.9765f, __instance.skaterRigidbody, 50f);
                ____startRotation     = __instance.skaterRigidbody.rotation;
                ____startUpVector     = __instance.skaterTransform.up;
                ____landingPrediction = true;
                //____newUp = Quaternion.FromToRotation(____startUpVector, Vector3.up);
                ____newUp  = Quaternion.identity;
                ____newUp *= __instance.skaterRigidbody.rotation;
                ((MonoBehaviour)__instance).Invoke("PreLandingEvent", ____duration - 0.3f);
            }

            AccessTools.Method(typeof(SkaterController), "InAirRotation").Invoke(__instance, new object[] { Mathf.Clamp((Time.time - ____startTime) / ____duration, 0f, 1f) });
        }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     skaterController = GetComponent <SkaterController>();
 }