public void Awake()
            {
                holdoutZoneController = GetComponent <HoldoutZoneController>();

                animationCurve = new AnimationCurve
                {
                    keys = new Keyframe[]
                    {
                        new Keyframe(0f, 0f),
                        new Keyframe(0.5f, 1f),
                        new Keyframe(1f, 0f)
                    },
                    preWrapMode  = WrapMode.Clamp,
                    postWrapMode = WrapMode.Clamp
                };

                sphereSearch = new SphereSearch
                {
                    mask   = LayerIndex.entityPrecise.mask,
                    origin = transform.position,
                    queryTriggerInteraction = QueryTriggerInteraction.Collide,
                    radius = 0f
                };
                teamMask = TeamMask.AllExcept(TeamIndex.Player);
            }
            private void Awake()
            {
#if DEBUG
                TurboEdition._logger.LogWarning("Waking up: " + this);
#endif
                stopwatch       = 0f;
                lifeStopwatch   = 0f;
                teamFilter      = GetComponent <TeamFilter>();
                sphereSearch    = GetComponent <SphereSearch>();
                novaRadiusCurve = EntityStates.TeleporterHealNovaController.TeleporterHealNovaPulse.novaRadiusCurve;
            }
Beispiel #3
0
            private void Awake()
            {
#if DEBUG
                TurboEdition._logger.LogWarning("LinkComponent awake, with the following: (panic if theres nothing following)");
#endif
                this.transform = base.transform;
                //this.networkedBodyAttachment = base.GetComponent<NetworkedBodyAttachment>();
                this.sphereSearch        = new SphereSearch();
                this.previousBounces     = new List <HealthComponent>();
                this.tetheredHurtBoxList = new List <HurtBox>();
                this.timer = 0f;
#if DEBUG
                TurboEdition._logger.LogWarning(/*"networkedBodyAttachment: " + networkedBodyAttachment + */ " sphereSearch: " + sphereSearch + " transform " + transform + " and timer " + timer);
#endif
            }
            private void ServerPulse(TeamIndex teamIndex)
            {
#if DEBUG
                TurboEdition._logger.LogWarning("Server Pulse made.");
#endif
                this.sphereSearch = new RoR2.SphereSearch()
                {
                    mask   = LayerIndex.entityPrecise.mask,                     //This should be ok too
                    origin = owner.transform.position,                          //This should be ok
                    queryTriggerInteraction = QueryTriggerInteraction.Collide,
                    radius = 0f                                                 //it starts with 0 radius, yea
                };
                this.finalRadius = radius;
                this.rate        = 1f / duration;
                this.enemyTeams  = TeamMask.GetEnemyTeams(teamIndex); //inb4 this will give issues with chaos and you will get affected by yourself
            }
Beispiel #5
0
        public void Given_Some_Cities()
        {
            cities = new List <City>
            {
                new  City("Boston", 42.358, -71.064),
                new City("Troy", 42.732, -73.693),
                new City("New York", 40.664, -73.939),
                new City("Miami", 25.788, -80.224),
                new City("London", 51.507, -0.128),
                new City("Paris", 48.857, 2.351),
                new City("Vienna", 48.208, 16.373),
                new City("Rome", 41.900, 12.500),
                new City("Beijing", 39.914, 116.392),
                new City("Hong Kong", 22.278, 114.159),
                new City("Seoul", 37.567, 126.978),
                new City("Tokyo", 35.690, 139.692)
            };

            citySearch = new SphereSearch <City>(cities, new Func <City, double[]>(c => Cartesian.FromSpherical(c.Latitude, c.Longitude)));
        }
 // Token: 0x06002E79 RID: 11897 RVA: 0x000C571C File Offset: 0x000C391C
 public override void OnEnter()
 {
     base.OnEnter();
     if (base.isAuthority)
     {
         TeamMask  mask      = TeamMask.AllExcept(base.ownerBody.teamComponent.teamIndex);
         HurtBox[] hurtBoxes = new SphereSearch
         {
             radius = AimState.targetAcquisitionRadius,
             mask   = LayerIndex.entityPrecise.mask,
             origin = base.transform.position,
             queryTriggerInteraction = QueryTriggerInteraction.UseGlobal
         }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(mask).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
         float blastRadius = FireMainBeamState.secondBombPrefab.GetComponent <ProjectileImpactExplosion>().blastRadius;
         int   num         = -1;
         int   num2        = 0;
         for (int i = 0; i < hurtBoxes.Length; i++)
         {
             HurtBox[] hurtBoxes2 = new SphereSearch
             {
                 radius = blastRadius,
                 mask   = LayerIndex.entityPrecise.mask,
                 origin = hurtBoxes[i].transform.position,
                 queryTriggerInteraction = QueryTriggerInteraction.UseGlobal
             }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(mask).FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
             if (hurtBoxes2.Length > num2)
             {
                 num  = i;
                 num2 = hurtBoxes2.Length;
             }
         }
         if (num != -1)
         {
             base.simpleRotateToDirection.targetRotation = Quaternion.LookRotation(hurtBoxes[num].transform.position - base.transform.position);
             this.foundTarget = true;
         }
     }
 }
Beispiel #7
0
        public override bool OnUse(EquipmentSlot equipmentSlot)
        {
            if (!equipmentSlot.healthComponent)
            {
                return(false);
            }

            EffectData effectData = new EffectData
            {
                origin   = equipmentSlot.characterBody.corePosition,
                rotation = Quaternion.identity
            };

            effectData.SetHurtBoxReference(equipmentSlot.characterBody.mainHurtBox);
            EffectManager.SpawnEffect(visualEffect, effectData, true);
            HurtBox[] hurtBoxes = new SphereSearch
            {
                mask   = LayerIndex.entityPrecise.mask,
                origin = equipmentSlot.characterBody.corePosition,
                queryTriggerInteraction = QueryTriggerInteraction.Collide,
                radius = radius.Value
            }.RefreshCandidates().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
            float myHealthFraction = equipmentSlot.healthComponent.combinedHealthFraction;
            float hp      = Mathf.Clamp01(myHealthFraction);
            float barrier = Mathf.Clamp01(myHealthFraction - 1f);

            foreach (HurtBox hurtBox in hurtBoxes)
            {
                HealthComponent healthComponent = hurtBox.healthComponent;
                if (healthComponent && healthComponent.alive)
                {
                    healthComponent.Networkhealth  = (healthComponent.fullHealth / healthComponent.fullCombinedHealth) * hp * healthComponent.fullCombinedHealth;
                    healthComponent.Networkshield  = (healthComponent.fullShield / healthComponent.fullCombinedHealth) * hp * healthComponent.fullCombinedHealth;
                    healthComponent.Networkbarrier = (healthComponent.fullBarrier / healthComponent.fullCombinedHealth) * barrier * healthComponent.fullCombinedHealth;
                }
            }
            return(true);
        }