Example #1
0
 // Token: 0x060012D2 RID: 4818 RVA: 0x0005C546 File Offset: 0x0005A746
 private void OnSyncCurrentPing(PingerController.PingInfo newPingInfo)
 {
     if (base.hasAuthority)
     {
         return;
     }
     this.SetCurrentPing(newPingInfo);
 }
Example #2
0
 // Token: 0x060012D3 RID: 4819 RVA: 0x0005C558 File Offset: 0x0005A758
 private void SetCurrentPing(PingerController.PingInfo newPingInfo)
 {
     this.NetworkcurrentPing = newPingInfo;
     this.RebuildPing(this.currentPing);
     if (base.hasAuthority)
     {
         this.CallCmdPing(this.currentPing);
     }
 }
Example #3
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);
        }
Example #4
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);
        }
Example #5
0
 // Token: 0x060012D0 RID: 4816 RVA: 0x0005C474 File Offset: 0x0005A674
 private void RebuildPing(PingerController.PingInfo pingInfo)
 {
     if (!pingInfo.active && this.pingIndicator != null)
     {
         UnityEngine.Object.Destroy(this.pingIndicator.gameObject);
         this.pingIndicator = null;
         return;
     }
     if (!this.pingIndicator)
     {
         GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Prefabs/PingIndicator"));
         this.pingIndicator           = gameObject.GetComponent <PingIndicator>();
         this.pingIndicator.pingOwner = base.gameObject;
     }
     this.pingIndicator.pingOrigin = pingInfo.origin;
     this.pingIndicator.pingNormal = pingInfo.normal;
     this.pingIndicator.pingTarget = pingInfo.targetGameObject;
     this.pingIndicator.RebuildPing();
 }
Example #6
0
        // Token: 0x060012DD RID: 4829 RVA: 0x0005C8A4 File Offset: 0x0005AAA4
        public void CallCmdPing(PingerController.PingInfo incomingPing)
        {
            if (!NetworkClient.active)
            {
                Debug.LogError("Command function CmdPing called on server.");
                return;
            }
            if (base.isServer)
            {
                this.CmdPing(incomingPing);
                return;
            }
            NetworkWriter networkWriter = new NetworkWriter();

            networkWriter.Write(0);
            networkWriter.Write((short)((ushort)5));
            networkWriter.WritePackedUInt32((uint)PingerController.kCmdCmdPing);
            networkWriter.Write(base.GetComponent <NetworkIdentity>().netId);
            GeneratedNetworkCode._WritePingInfo_PingerController(networkWriter, incomingPing);
            base.SendCommandInternal(networkWriter, 0, "CmdPing");
        }
Example #7
0
 private void CmdPing(PingerController.PingInfo incomingPing)
 {
     this.NetworkcurrentPing = incomingPing;
 }