// 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);
        }
示例#2
0
        // Token: 0x06000D3C RID: 3388 RVA: 0x0003B7B4 File Offset: 0x000399B4
        public GameObject FindBestInteractableObject()
        {
            if (this.interactableOverride)
            {
                return(this.interactableOverride);
            }
            float num            = 0f;
            Ray   originalAimRay = new Ray(this.inputBank.aimOrigin, this.inputBank.aimDirection);
            Ray   raycastRay     = CameraRigController.ModifyAimRayIfApplicable(originalAimRay, base.gameObject, out num);

            return(this.interactor.FindBestInteractableObject(raycastRay, this.interactor.maxInteractionDistance + num, originalAimRay.origin, this.interactor.maxInteractionDistance));
        }
        // Token: 0x06000AA3 RID: 2723 RVA: 0x0002F354 File Offset: 0x0002D554
        private void ConfigureTargetFinderBase()
        {
            this.targetFinder.teamMaskFilter = TeamMask.allButNeutral;
            this.targetFinder.teamMaskFilter.RemoveTeam(this.teamComponent.teamIndex);
            this.targetFinder.sortMode    = BullseyeSearch.SortMode.Angle;
            this.targetFinder.filterByLoS = true;
            float num;
            Ray   ray = CameraRigController.ModifyAimRayIfApplicable(this.GetAimRay(), base.gameObject, out num);

            this.targetFinder.searchOrigin    = ray.origin;
            this.targetFinder.searchDirection = ray.direction;
            this.targetFinder.maxAngleFilter  = 10f;
            this.targetFinder.viewer          = this.characterBody;
        }
示例#4
0
        // Token: 0x06000AF7 RID: 2807 RVA: 0x00030944 File Offset: 0x0002EB44
        private void FixedUpdate()
        {
            if (!this.vehicleSeat)
            {
                return;
            }
            if (!this.vehicleSeat.currentPassengerInputBank)
            {
                return;
            }
            this.age             += Time.fixedDeltaTime;
            this.overlapFireAge  += Time.fixedDeltaTime;
            this.overlapResetAge += Time.fixedDeltaTime;
            if (NetworkServer.active)
            {
                if (this.overlapFireAge > 1f / this.overlapFireFrequency)
                {
                    if (this.overlapAttack.Fire(null))
                    {
                        this.age = Mathf.Max(0f, this.age - this.overlapVehicleDurationBonusPerHit);
                    }
                    this.overlapFireAge = 0f;
                }
                if (this.overlapResetAge >= 1f / this.overlapResetFrequency)
                {
                    this.overlapAttack.ResetIgnoredHealthComponents();
                    this.overlapResetAge = 0f;
                }
            }
            Ray   originalAimRay = this.vehicleSeat.currentPassengerInputBank.GetAimRay();
            float num;

            originalAimRay = CameraRigController.ModifyAimRayIfApplicable(originalAimRay, base.gameObject, out num);
            Vector3 velocity = this.rigidbody.velocity;
            Vector3 target   = originalAimRay.direction * this.targetSpeed;
            Vector3 a        = Vector3.MoveTowards(velocity, target, this.acceleration * Time.fixedDeltaTime);

            this.rigidbody.MoveRotation(Quaternion.LookRotation(originalAimRay.direction));
            this.rigidbody.AddForce(a - velocity, ForceMode.VelocityChange);
            if (NetworkServer.active && this.duration <= this.age)
            {
                this.DetonateServer();
            }
        }