Пример #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));
 }