示例#1
0
        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);
            }
        }
示例#2
0
 public virtual void OnFullStabReached(HVRStabber stabber)
 {
     FullStabbed.Invoke(stabber, this);
 }
示例#3
0
 public virtual void OnStabberExit(HVRStabber stabber)
 {
     Stabbers.Remove(stabber);
     UnStabbed.Invoke(stabber, this);
 }
示例#4
0
 public virtual void OnStabberEnter(HVRStabber stabber, Collision collision)
 {
     Stabbers.Add(stabber);
     Stabbed.Invoke(stabber, this, collision);
 }