예제 #1
0
        public bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance, Vector3 muzzle)
        {
            scanInfo             = default;
            scanInfo.origin      = position;
            scanInfo.direction   = direction;
            scanInfo.maxDistance = maxDistance;
            scanInfo.muzzle      = muzzle;

            bool success = Physics.Raycast(position, direction, out scanInfo.hitInfo, maxDistance, layerMask);

            scanInfo.success = success;

            // Events processing
            HitscanEventArgs args = new HitscanEventArgs(scanInfo);

            Launched?.Invoke(this, args);
            if (success)
            {
                Impacted?.Invoke(this, args);
            }

            return(success);
        }
예제 #2
0
 public HitscanEventArgs(HitscanInfo scanInfo)
 {
     this.scanInfo = scanInfo;
 }
예제 #3
0
 public static bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance)
 {
     return(Current.manager.Raycast(position, direction, out scanInfo, maxDistance));
 }
예제 #4
0
 public bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance)
 {
     return(Raycast(position, direction, out scanInfo, maxDistance, position));
 }