Beispiel #1
0
        static bool Prefix(Gravsphere __instance, Collider collider)
        {
            float range   = __instance.GetComponent <GravTrapMK2.Tag>()? Main.config.mk2Range: 17f;
            float distSqr = (__instance.transform.position - collider.transform.position).sqrMagnitude;                                                                     $"Gravsphere_OnTriggerExit_Patch: object: {collider.name} distance: {Mathf.Sqrt(distSqr)}".logDbg();

            return(distSqr > range * range);
        }
Beispiel #2
0
        static void Gravsphere_DestroyEffect_Postfix(Gravsphere __instance, int index)
        {
            var rigidBody = __instance.attractableList[index];

            if (rigidBody)
            {
                __instance.GetComponent <GravTrapObjectsType>().handleAttracted(rigidBody.gameObject, false);
            }
        }
Beispiel #3
0
        public static void updateRange(Gravsphere gravsphere)
        {
            if (!gravsphere.GetComponent <GravTrapMK2.Tag>())
            {
                return;
            }

            if (gravsphere.gameObject.GetComponents <SphereCollider>()?.FirstOrDefault(s => s.radius > 10) is SphereCollider sphere)
            {
                sphere.radius = Main.config.mk2Range;
            }
        }
Beispiel #4
0
 static bool Gravsphere_IsValidTarget_Prefix(Gravsphere __instance, GameObject obj, ref bool __result)
 {
     __result = __instance.GetComponent <GravTrapObjectsType>().isValidTarget(obj);
     return(false);
 }
Beispiel #5
0
 static void Gravsphere_AddAttractable_Postfix(Gravsphere __instance, Rigidbody r)
 {
     $"Gravsphere.AddAttractable: {r.gameObject.name} mass: {r.mass}".logDbg();
     __instance.GetComponent <GravTrapObjectsType>().handleAttracted(r.gameObject, true);
 }
Beispiel #6
0
 static void Postfix(Gravsphere __instance, Rigidbody r) =>
 __instance.GetComponent <GravTrapObjectsType>().handleAttracted(r.gameObject, true);