// Token: 0x06000D2C RID: 3372 RVA: 0x0003B3A4 File Offset: 0x000395A4
        public bool GetAimRaycast(float maxDistance, out RaycastHit hitInfo)
        {
            float time      = Time.time;
            float fixedTime = Time.fixedTime;

            if (!this.cachedRaycast.time.Equals(time) || !this.cachedRaycast.fixedTime.Equals(fixedTime) || (this.cachedRaycast.maxDistance < maxDistance && !this.cachedRaycast.didHit))
            {
                float num = 0f;
                Ray   ray = CameraRigController.ModifyAimRayIfApplicable(this.GetAimRay(), base.gameObject, out num);
                this.cachedRaycast             = InputBankTest.CachedRaycastInfo.empty;
                this.cachedRaycast.time        = time;
                this.cachedRaycast.fixedTime   = fixedTime;
                this.cachedRaycast.maxDistance = maxDistance;
                GameObject gameObject   = base.gameObject;
                Ray        ray2         = ray;
                float      maxDistance2 = maxDistance + num;
                LayerMask  layerMask    = LayerIndex.world.mask | LayerIndex.entityPrecise.mask;
                this.cachedRaycast.didHit = Util.CharacterRaycast(gameObject, ray2, out this.cachedRaycast.hitInfo, maxDistance2, layerMask, QueryTriggerInteraction.Ignore);
            }
            bool flag = this.cachedRaycast.didHit;

            hitInfo = this.cachedRaycast.hitInfo;
            if (flag && hitInfo.distance > maxDistance)
            {
                flag    = false;
                hitInfo = default(RaycastHit);
            }
            return(flag);
        }
Esempio n. 2
0
        // Token: 0x060012D6 RID: 4822 RVA: 0x0005C5E0 File Offset: 0x0005A7E0
        public void AttemptPing(Ray aimRay, GameObject bodyObject)
        {
            if (this.pingStock <= 0)
            {
                Chat.AddMessage(Language.GetString("PLAYER_PING_COOLDOWN"));
                return;
            }
            PingerController.PingInfo pingInfo = new PingerController.PingInfo
            {
                active = true
            };
            this.pingStock--;
            BullseyeSearch bullseyeSearch = new BullseyeSearch();

            bullseyeSearch.filterByLoS       = true;
            bullseyeSearch.maxDistanceFilter = 1000f;
            bullseyeSearch.maxAngleFilter    = 10f;
            bullseyeSearch.teamMaskFilter    = TeamMask.allButNeutral;
            bullseyeSearch.sortMode          = BullseyeSearch.SortMode.Distance;
            bullseyeSearch.searchOrigin      = aimRay.origin;
            bullseyeSearch.searchDirection   = aimRay.direction;
            bullseyeSearch.RefreshCandidates();
            bullseyeSearch.FilterOutGameObject(bodyObject);
            HurtBox    hurtBox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>();
            RaycastHit raycastHit;

            if (hurtBox && hurtBox.healthComponent)
            {
                Transform transform = hurtBox.healthComponent.transform;
                pingInfo.origin = transform.position;
                pingInfo.targetNetworkIdentity = hurtBox.healthComponent.GetComponent <NetworkIdentity>();
            }
            else if (Util.CharacterRaycast(base.gameObject, aimRay, out raycastHit, 1000f, LayerIndex.world.mask | LayerIndex.defaultLayer.mask, QueryTriggerInteraction.Collide))
            {
                GameObject      gameObject      = raycastHit.collider.gameObject;
                NetworkIdentity networkIdentity = gameObject.GetComponentInParent <NetworkIdentity>();
                if (!networkIdentity)
                {
                    EntityLocator entityLocator = gameObject.transform.parent ? gameObject.transform.parent.GetComponentInChildren <EntityLocator>() : gameObject.GetComponent <EntityLocator>();
                    if (entityLocator)
                    {
                        gameObject      = entityLocator.entity;
                        networkIdentity = gameObject.GetComponent <NetworkIdentity>();
                    }
                }
                pingInfo.origin = raycastHit.point;
                pingInfo.normal = raycastHit.normal;
                pingInfo.targetNetworkIdentity = networkIdentity;
            }
            if (pingInfo.targetNetworkIdentity != null && pingInfo.targetNetworkIdentity == this.currentPing.targetNetworkIdentity)
            {
                pingInfo = PingerController.emptyPing;
                this.pingStock++;
            }
            this.SetCurrentPing(pingInfo);
        }
Esempio n. 3
0
        // Token: 0x06000FE2 RID: 4066 RVA: 0x00045CF4 File Offset: 0x00043EF4
        public void AttemptPing(Ray aimRay, GameObject bodyObject)
        {
            if (this.pingStock <= 0)
            {
                Chat.AddMessage(Language.GetString("PLAYER_PING_COOLDOWN"));
                return;
            }
            PingerController.PingInfo pingInfo = new PingerController.PingInfo
            {
                active = true
            };
            if (!RoR2Application.isInSinglePlayer)
            {
                this.pingStock--;
            }
            HurtBox    hurtBox = null;
            RaycastHit raycastHit;

            if (Util.CharacterRaycast(bodyObject, aimRay, out raycastHit, 1000f, LayerIndex.entityPrecise.mask | LayerIndex.world.mask, QueryTriggerInteraction.UseGlobal))
            {
                hurtBox = raycastHit.collider.GetComponent <HurtBox>();
            }
            if (hurtBox && hurtBox.healthComponent)
            {
                Transform transform = hurtBox.healthComponent.transform;
                pingInfo.origin = transform.position;
                pingInfo.targetNetworkIdentity = hurtBox.healthComponent.GetComponent <NetworkIdentity>();
            }
            else if (Util.CharacterRaycast(base.gameObject, aimRay, out raycastHit, 1000f, LayerIndex.world.mask | LayerIndex.defaultLayer.mask, QueryTriggerInteraction.Collide))
            {
                GameObject      gameObject      = raycastHit.collider.gameObject;
                NetworkIdentity networkIdentity = gameObject.GetComponentInParent <NetworkIdentity>();
                if (!networkIdentity)
                {
                    EntityLocator entityLocator = gameObject.transform.parent ? gameObject.transform.parent.GetComponentInChildren <EntityLocator>() : gameObject.GetComponent <EntityLocator>();
                    if (entityLocator)
                    {
                        gameObject      = entityLocator.entity;
                        networkIdentity = gameObject.GetComponent <NetworkIdentity>();
                    }
                }
                pingInfo.origin = raycastHit.point;
                pingInfo.normal = raycastHit.normal;
                pingInfo.targetNetworkIdentity = networkIdentity;
            }
            if (pingInfo.targetNetworkIdentity != null && pingInfo.targetNetworkIdentity == this.currentPing.targetNetworkIdentity)
            {
                pingInfo = PingerController.emptyPing;
                this.pingStock++;
            }
            this.SetCurrentPing(pingInfo);
        }
 private void Fire()
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.TitanRockController::Fire()' called on client");
         return;
     }
     if (this.ownerInputBank)
     {
         Vector3    position = this.fireTransform.position;
         Vector3    forward  = this.ownerInputBank.aimDirection;
         RaycastHit raycastHit;
         if (Util.CharacterRaycast(this.owner, new Ray(this.ownerInputBank.aimOrigin, this.ownerInputBank.aimDirection), out raycastHit, float.PositiveInfinity, LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal))
         {
             forward = raycastHit.point - position;
         }
         float num = this.ownerCharacterBody ? this.ownerCharacterBody.damage : 1f;
         ProjectileManager.instance.FireProjectile(this.projectilePrefab, position, Util.QuaternionSafeLookRotation(forward), this.owner, this.damageCoefficient * num, this.damageForce, this.isCrit, DamageColorIndex.Default, null, -1f);
     }
 }