public HVRStabTracker(HVRStabber stabber, HVRStabbable stabbable, HVRStabbableSettings settings, ConfigurableJoint joint, GameObject stabbedObject, Vector3 stabDirection, Transform tip, Collider[] stabbedColliders) { Stabber = stabber; Stabbable = stabbable; Settings = settings; Joint = joint; StabbedObject = stabbedObject; StabbedColliders = stabbedColliders; _stabberLength = stabber.Length; //use world in case stabber is scaled _canFullStab = true; _stabLocalPosition = Joint.connectedAnchor; _stabDirectionLocal = stabbedObject.transform.InverseTransformDirection(stabDirection); _tip = tip; _base = tip == stabber.Tip ? stabber.Base : stabber.Tip; _unstabThreshold = Stabber.Settings.UnstabThreshold; UpdateEntryAndExit(); if (Stabber.IsDualStabber || settings.CanBeImpaled || Stabber.CanRunThrough) { TryFindExitPoint(stabDirection, stabbedColliders); } }
protected internal virtual void OnFullStab(HVRStabbable stabbable) { if (VerboseDebugging) { Debug.Log($"{name} -> {stabbable?.name} OnFullStab"); } if (stabbable) { FullStabbed.Invoke(this, stabbable); stabbable.OnFullStabReached(this); } }
protected internal virtual void OnStabExit(HVRStabbable stabbable) { if (VerboseDebugging) { Debug.Log($"{name} -> {stabbable?.name} OnStabExit"); } if (stabbable) { stabbable.OnStabberExit(this); } UnStabbed.Invoke(this, stabbable); }
protected internal virtual void OnStabEnter(HVRStabbable stabbable, Collision collision) { Stabbed.Invoke(this, stabbable, collision); if (VerboseDebugging) { Debug.Log($"{name} -> {stabbable?.name} OnStabEnter"); } if (stabbable) { stabbable.OnStabberEnter(this, collision); } }