コード例 #1
0
        public void AddShrineStack(Interactor activator)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineChanceBehavior::AddShrineStack(RoR2.Interactor)' called on client");
                return;
            }
            PickupIndex none   = PickupIndex.none;
            PickupIndex value  = this.rng.NextElementUniform <PickupIndex>(Run.instance.availableTier1DropList);
            PickupIndex value2 = this.rng.NextElementUniform <PickupIndex>(Run.instance.availableTier2DropList);
            PickupIndex value3 = this.rng.NextElementUniform <PickupIndex>(Run.instance.availableTier3DropList);
            PickupIndex value4 = this.rng.NextElementUniform <PickupIndex>(Run.instance.availableEquipmentDropList);
            WeightedSelection <PickupIndex> weightedSelection = new WeightedSelection <PickupIndex>(8);

            weightedSelection.AddChoice(none, this.failureWeight);
            weightedSelection.AddChoice(value, this.tier1Weight);
            weightedSelection.AddChoice(value2, this.tier2Weight);
            weightedSelection.AddChoice(value3, this.tier3Weight);
            weightedSelection.AddChoice(value4, this.equipmentWeight);
            PickupIndex pickupIndex = weightedSelection.Evaluate(this.rng.nextNormalizedFloat);
            bool        flag        = pickupIndex == PickupIndex.none;
            string      baseToken;

            if (flag)
            {
                baseToken = "SHRINE_CHANCE_FAIL_MESSAGE";
            }
            else
            {
                baseToken = "SHRINE_CHANCE_SUCCESS_MESSAGE";
                this.successfulPurchaseCount++;
                PickupDropletController.CreatePickupDroplet(pickupIndex, this.dropletOrigin.position, this.dropletOrigin.forward * 20f);
            }
            Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
            {
                subjectAsCharacterBody = activator.GetComponent <CharacterBody>(),
                baseToken = baseToken
            });
            Action <bool, Interactor> action = ShrineChanceBehavior.onShrineChancePurchaseGlobal;

            if (action != null)
            {
                action(flag, activator);
            }
            this.waitingForRefresh = true;
            this.refreshTimer      = 2f;
            EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
            {
                origin   = base.transform.position,
                rotation = Quaternion.identity,
                scale    = 1f,
                color    = this.shrineColor
            }, true);
            if (this.successfulPurchaseCount >= this.maxPurchaseCount)
            {
                this.symbolTransform.gameObject.SetActive(false);
            }
        }
コード例 #2
0
        // Token: 0x06000E34 RID: 3636 RVA: 0x0003F430 File Offset: 0x0003D630
        private void FixedUpdate()
        {
            if (!NetworkServer.active)
            {
                return;
            }
            this.waveTimer -= Time.fixedDeltaTime;
            if (this.waveTimer <= 0f && this.wavesPerformed < this.waveCount)
            {
                this.wavesPerformed++;
                this.waveTimer = UnityEngine.Random.Range(this.waveMinInterval, this.waveMaxInterval);
                MeteorStormController.MeteorWave item = new MeteorStormController.MeteorWave(CharacterBody.readOnlyInstancesList.ToArray <CharacterBody>(), base.transform.position);
                this.waveList.Add(item);
            }
            for (int i = this.waveList.Count - 1; i >= 0; i--)
            {
                MeteorStormController.MeteorWave meteorWave = this.waveList[i];
                meteorWave.timer -= Time.fixedDeltaTime;
                if (meteorWave.timer <= 0f)
                {
                    meteorWave.timer = UnityEngine.Random.Range(0.05f, 1f);
                    MeteorStormController.Meteor nextMeteor = meteorWave.GetNextMeteor();
                    if (nextMeteor == null)
                    {
                        this.waveList.RemoveAt(i);
                    }
                    else if (nextMeteor.valid)
                    {
                        this.meteorList.Add(nextMeteor);
                        EffectManager.SpawnEffect(this.warningEffectPrefab, new EffectData
                        {
                            origin = nextMeteor.impactPosition,
                            scale  = this.blastRadius
                        }, true);
                    }
                }
            }
            float num  = Run.instance.time - this.impactDelay;
            float num2 = num - this.travelEffectDuration;

            for (int j = this.meteorList.Count - 1; j >= 0; j--)
            {
                MeteorStormController.Meteor meteor = this.meteorList[j];
                if (meteor.startTime < num2 && !meteor.didTravelEffect)
                {
                    this.DoMeteorEffect(meteor);
                }
                if (meteor.startTime < num)
                {
                    this.meteorList.RemoveAt(j);
                    this.DetonateMeteor(meteor);
                }
            }
            if (this.wavesPerformed == this.waveCount && this.meteorList.Count == 0)
            {
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
コード例 #3
0
 // Token: 0x06000560 RID: 1376 RVA: 0x00015DB0 File Offset: 0x00013FB0
 private static void HandleEffectClientInternal(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <EffectManager.EffectMessage>(EffectManager.incomingEffectMessage);
     if (EffectCatalog.GetEffectDef(EffectManager.incomingEffectMessage.effectIndex) == null)
     {
         return;
     }
     EffectManager.SpawnEffect(EffectManager.incomingEffectMessage.effectIndex, EffectManager.incomingEffectMessage.effectData, false);
 }
コード例 #4
0
 // Token: 0x06000564 RID: 1380 RVA: 0x00015ED0 File Offset: 0x000140D0
 public static void SimpleImpactEffect(GameObject effectPrefab, Vector3 hitPos, Vector3 normal, Color color, bool transmit)
 {
     EffectManager.SpawnEffect(effectPrefab, new EffectData
     {
         origin   = hitPos,
         rotation = Util.QuaternionSafeLookRotation(normal),
         color    = color
     }, transmit);
 }
コード例 #5
0
 // Token: 0x0600091E RID: 2334 RVA: 0x000275B0 File Offset: 0x000257B0
 private void FixedUpdate()
 {
     if (this.characterBody && this.characterBody.wasLucky)
     {
         this.characterBody.wasLucky = false;
         EffectData effectData = new EffectData();
         effectData.origin   = base.transform.position;
         effectData.rotation = base.transform.rotation;
         EffectManager.SpawnEffect(this.triggerEffect, effectData, true);
     }
 }
コード例 #6
0
 // Token: 0x06000E36 RID: 3638 RVA: 0x0003F62A File Offset: 0x0003D82A
 private void DoMeteorEffect(MeteorStormController.Meteor meteor)
 {
     meteor.didTravelEffect = true;
     if (this.travelEffectPrefab)
     {
         EffectManager.SpawnEffect(this.travelEffectPrefab, new EffectData
         {
             origin = meteor.impactPosition
         }, true);
     }
 }
コード例 #7
0
 // Token: 0x06000A0A RID: 2570 RVA: 0x0002BF40 File Offset: 0x0002A140
 private void Start()
 {
     if (this.delayEffect)
     {
         EffectManager.SpawnEffect(this.delayEffect, new EffectData
         {
             origin   = base.transform.position,
             rotation = Util.QuaternionSafeLookRotation(base.transform.forward),
             scale    = this.radius
         }, true);
     }
 }
コード例 #8
0
 private void CoinDrop()
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.BarrelInteraction::CoinDrop()' called on client");
         return;
     }
     EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/CoinEmitter"), new EffectData
     {
         origin       = base.transform.position,
         genericFloat = (float)this.goldReward
     }, true);
 }
コード例 #9
0
        public void AddShrineStack(Interactor interactor)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineCombatBehavior::AddShrineStack(RoR2.Interactor)' called on client");
                return;
            }
            new List <CharacterBody>();
            this.waitingForRefresh = true;
            if (this.combatDirector)
            {
                this.combatDirector.enabled        = true;
                this.combatDirector.monsterCredit += this.monsterCredit;
                this.combatDirector.OverrideCurrentMonsterCard(this.chosenDirectorCard);
                this.combatDirector.monsterSpawnTimer = 0f;
            }
            CharacterMaster component = this.chosenDirectorCard.spawnCard.prefab.GetComponent <CharacterMaster>();

            if (component)
            {
                CharacterBody component2 = component.bodyPrefab.GetComponent <CharacterBody>();
                if (component2)
                {
                    Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
                    {
                        subjectAsCharacterBody = interactor.GetComponent <CharacterBody>(),
                        baseToken   = "SHRINE_COMBAT_USE_MESSAGE",
                        paramTokens = new string[]
                        {
                            component2.baseNameToken
                        }
                    });
                }
            }
            EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
            {
                origin   = base.transform.position,
                rotation = Quaternion.identity,
                scale    = 1f,
                color    = this.shrineEffectColor
            }, true);
            this.purchaseCount++;
            this.refreshTimer = 2f;
            if (this.purchaseCount >= this.maxPurchaseCount)
            {
                this.symbolTransform.gameObject.SetActive(false);
            }
        }
コード例 #10
0
 // Token: 0x06001019 RID: 4121 RVA: 0x00046CC8 File Offset: 0x00044EC8
 public void GrantPortalEntry()
 {
     PortalStatueBehavior.PortalType portalType = this.portalType;
     if (portalType != PortalStatueBehavior.PortalType.Shop)
     {
         if (portalType == PortalStatueBehavior.PortalType.Goldshores)
         {
             if (TeleporterInteraction.instance)
             {
                 TeleporterInteraction.instance.shouldAttemptToSpawnGoldshoresPortal = true;
             }
             EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
             {
                 origin   = base.transform.position,
                 rotation = Quaternion.identity,
                 scale    = 1f,
                 color    = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Money)
             }, true);
         }
     }
     else
     {
         if (TeleporterInteraction.instance)
         {
             TeleporterInteraction.instance.shouldAttemptToSpawnShopPortal = true;
         }
         EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
         {
             origin   = base.transform.position,
             rotation = Quaternion.identity,
             scale    = 1f,
             color    = ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem)
         }, true);
     }
     foreach (PortalStatueBehavior portalStatueBehavior in UnityEngine.Object.FindObjectsOfType <PortalStatueBehavior>())
     {
         if (portalStatueBehavior.portalType == this.portalType)
         {
             PurchaseInteraction component = portalStatueBehavior.GetComponent <PurchaseInteraction>();
             if (component)
             {
                 component.Networkavailable = false;
             }
         }
     }
 }
コード例 #11
0
        public static void CreateItemTakenOrb(Vector3 effectOrigin, GameObject targetObject, ItemIndex itemIndex)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.PurchaseInteraction::CreateItemTakenOrb(UnityEngine.Vector3,UnityEngine.GameObject,RoR2.ItemIndex)' called on client");
                return;
            }
            GameObject effectPrefab = Resources.Load <GameObject>("Prefabs/Effects/OrbEffects/ItemTakenOrbEffect");
            EffectData effectData   = new EffectData
            {
                origin       = effectOrigin,
                genericFloat = 1.5f,
                genericUInt  = (uint)(itemIndex + 1)
            };

            effectData.SetNetworkedObjectReference(targetObject);
            EffectManager.SpawnEffect(effectPrefab, effectData, true);
        }
コード例 #12
0
 // Token: 0x06000C72 RID: 3186 RVA: 0x0003822C File Offset: 0x0003642C
 private void OnTriggerStay(Collider other)
 {
     if (NetworkServer.active && this.alive && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex)
     {
         CharacterBody component = other.GetComponent <CharacterBody>();
         if (component)
         {
             HealthComponent healthComponent = component.healthComponent;
             if (healthComponent)
             {
                 component.healthComponent.Heal(this.flatHealing + healthComponent.fullHealth * this.fractionalHealing, default(ProcChainMask), true);
                 EffectManager.SpawnEffect(this.pickupEffect, new EffectData
                 {
                     origin = base.transform.position
                 }, true);
             }
             UnityEngine.Object.Destroy(this.baseObject);
         }
     }
 }
コード例 #13
0
        // Token: 0x060005D7 RID: 1495 RVA: 0x0001834C File Offset: 0x0001654C
        public void CreateEffect(AnimationEvent animationEvent)
        {
            Transform transform = base.transform;
            int       num       = -1;

            if (!string.IsNullOrEmpty(animationEvent.stringParameter))
            {
                num = this.childLocator.FindChildIndex(animationEvent.stringParameter);
                if (num != -1)
                {
                    transform = this.childLocator.FindChild(num);
                }
            }
            bool       transmit   = animationEvent.intParameter != 0;
            EffectData effectData = new EffectData();

            effectData.origin = transform.position;
            effectData.SetChildLocatorTransformReference(this.bodyObject, num);
            EffectManager.SpawnEffect((GameObject)animationEvent.objectReferenceParameter, effectData, transmit);
        }
コード例 #14
0
 // Token: 0x06000A07 RID: 2567 RVA: 0x0002BEA8 File Offset: 0x0002A0A8
 private void OnTriggerEnter(Collider other)
 {
     if (NetworkServer.active)
     {
         CharacterBody component = other.GetComponent <CharacterBody>();
         if (component)
         {
             component.AddTimedBuff(this.buffType, this.buffDuration);
             Util.PlaySound(this.buffApplicationSoundString, component.gameObject);
             if (this.buffApplicationEffectPrefab)
             {
                 EffectManager.SpawnEffect(this.buffApplicationEffectPrefab, new EffectData
                 {
                     origin = component.mainHurtBox.transform.position,
                     scale  = component.radius
                 }, true);
             }
         }
     }
 }
コード例 #15
0
        public void AddShrineStack(Interactor interactor)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineBloodBehavior::AddShrineStack(RoR2.Interactor)' called on client");
                return;
            }
            this.waitingForRefresh = true;
            CharacterBody component = interactor.GetComponent <CharacterBody>();

            if (component)
            {
                uint amount = (uint)(component.healthComponent.fullCombinedHealth * (float)this.purchaseInteraction.cost / 100f * this.goldToPaidHpRatio);
                if (component.master)
                {
                    component.master.GiveMoney(amount);
                    Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
                    {
                        subjectAsCharacterBody = component,
                        baseToken   = "SHRINE_BLOOD_USE_MESSAGE",
                        paramTokens = new string[]
                        {
                            amount.ToString()
                        }
                    });
                }
            }
            EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
            {
                origin   = base.transform.position,
                rotation = Quaternion.identity,
                scale    = 1f,
                color    = Color.red
            }, true);
            this.purchaseCount++;
            this.refreshTimer = 2f;
            if (this.purchaseCount >= this.maxPurchaseCount)
            {
                this.symbolTransform.gameObject.SetActive(false);
            }
        }
コード例 #16
0
 private void PerformDeath()
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.WormBodyPositions2::PerformDeath()' called on client");
         return;
     }
     for (int i = 0; i < this.bones.Length; i++)
     {
         if (this.bones[i])
         {
             EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/MagmaWormDeathDust"), new EffectData
             {
                 origin   = this.bones[i].position,
                 rotation = UnityEngine.Random.rotation,
                 scale    = 1f
             }, true);
         }
     }
     UnityEngine.Object.Destroy(base.gameObject);
 }
コード例 #17
0
 // Token: 0x060014AB RID: 5291 RVA: 0x000584D8 File Offset: 0x000566D8
 public void FixedUpdate()
 {
     this.fixedAge += Time.fixedDeltaTime;
     if (this.fixedAge >= this.delayBeforePlayingSFX && !this.hasPlayedSFX)
     {
         this.hasPlayedSFX = true;
         Util.PlaySound(TeleportOutController.tpOutSoundString, this.target);
     }
     if (NetworkServer.active && this.fixedAge >= 2f && this.target)
     {
         GameObject teleportEffectPrefab = Run.instance.GetTeleportEffectPrefab(this.target);
         if (teleportEffectPrefab)
         {
             EffectManager.SpawnEffect(teleportEffectPrefab, new EffectData
             {
                 origin = this.target.transform.position
             }, true);
         }
         UnityEngine.Object.Destroy(this.target);
     }
 }
コード例 #18
0
        public void AddShrineStack(Interactor activator)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineHealingBehavior::AddShrineStack(RoR2.Interactor)' called on client");
                return;
            }
            this.SetWardEnabled(true);
            Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
            {
                subjectAsCharacterBody = activator.gameObject.GetComponent <CharacterBody>(),
                baseToken = "SHRINE_HEALING_USE_MESSAGE"
            });
            this.waitingForRefresh = true;
            int purchaseCount = this.purchaseCount;

            this.purchaseCount = purchaseCount + 1;
            float networkradius = this.baseRadius + this.radiusBonusPerPurchase * (float)(this.purchaseCount - 1);

            this.healingWard.Networkradius = networkradius;
            this.refreshTimer = 2f;
            EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
            {
                origin   = base.transform.position,
                rotation = Quaternion.identity,
                scale    = 1f,
                color    = Color.green
            }, true);
            if (this.purchaseCount >= this.maxPurchaseCount)
            {
                this.symbolTransform.gameObject.SetActive(false);
            }
            Action <ShrineHealingBehavior, Interactor> action = ShrineHealingBehavior.onActivated;

            if (action == null)
            {
                return;
            }
            action(this, activator);
        }
コード例 #19
0
        // Token: 0x06000AF6 RID: 2806 RVA: 0x000307FC File Offset: 0x0002E9FC
        private void DetonateServer()
        {
            if (this.hasDetonatedServer)
            {
                return;
            }
            this.hasDetonatedServer = true;
            CharacterBody currentPassengerBody = this.vehicleSeat.currentPassengerBody;

            if (currentPassengerBody)
            {
                EffectData effectData = new EffectData
                {
                    origin = base.transform.position,
                    scale  = this.blastRadius
                };
                EffectManager.SpawnEffect(this.explosionEffectPrefab, effectData, true);
                new BlastAttack
                {
                    attacker         = currentPassengerBody.gameObject,
                    baseDamage       = this.blastDamageCoefficient * currentPassengerBody.damage,
                    baseForce        = this.blastForce,
                    bonusForce       = this.blastBonusForce,
                    canHurtAttacker  = false,
                    crit             = currentPassengerBody.RollCrit(),
                    damageColorIndex = DamageColorIndex.Item,
                    damageType       = this.blastDamageType,
                    falloffModel     = this.blastFalloffModel,
                    inflictor        = base.gameObject,
                    position         = base.transform.position,
                    procChainMask    = default(ProcChainMask),
                    procCoefficient  = this.blastProcCoefficient,
                    radius           = this.blastRadius,
                    teamIndex        = currentPassengerBody.teamComponent.teamIndex
                }.Fire();
            }
            Util.PlaySound(this.explosionSoundString, base.gameObject);
            UnityEngine.Object.Destroy(base.gameObject);
        }
コード例 #20
0
        // Token: 0x06000846 RID: 2118 RVA: 0x00023BD8 File Offset: 0x00021DD8
        public void RespawnExtraLife()
        {
            this.inventory.GiveItem(ItemIndex.ExtraLifeConsumed, 1);
            this.Respawn(this.deathFootPosition, Quaternion.Euler(0f, UnityEngine.Random.Range(0f, 360f), 0f), false);
            this.GetBody().AddTimedBuff(BuffIndex.Immune, 3f);
            GameObject gameObject = Resources.Load <GameObject>("Prefabs/Effects/HippoRezEffect");

            if (this.bodyInstanceObject)
            {
                foreach (EntityStateMachine entityStateMachine in this.bodyInstanceObject.GetComponents <EntityStateMachine>())
                {
                    entityStateMachine.initialStateType = entityStateMachine.mainStateType;
                }
                if (gameObject)
                {
                    EffectManager.SpawnEffect(gameObject, new EffectData
                    {
                        origin   = this.deathFootPosition,
                        rotation = this.bodyInstanceObject.transform.rotation
                    }, true);
                }
            }
        }
コード例 #21
0
 // Token: 0x060008F6 RID: 2294 RVA: 0x00026DF0 File Offset: 0x00024FF0
 public void Pulse()
 {
     ChestRevealer.< > c__DisplayClass12_0 CS$ < > 8__locals1;
     CS$ < > 8__locals1.< > 4__this         = this;
     CS$ < > 8__locals1.origin              = base.transform.position;
     CS$ < > 8__locals1.radiusSqr           = this.radius * this.radius;
     CS$ < > 8__locals1.invPulseTravelSpeed = 1f / this.pulseTravelSpeed;
     Type[] array = ChestRevealer.typesToCheck;
     for (int i = 0; i < array.Length; i++)
     {
         foreach (MonoBehaviour monoBehaviour in InstanceTracker.FindInstancesEnumerable(array[i]))
         {
             if (((IInteractable)monoBehaviour).ShouldShowOnScanner())
             {
                 this.< Pulse > g__TryAddRevealable | 12_0 (monoBehaviour.transform, ref CS$ < > 8__locals1);
             }
         }
     }
     EffectManager.SpawnEffect(this.pulseEffectPrefab, new EffectData
     {
         origin = CS$ < > 8__locals1.origin,
         scale  = this.radius * this.pulseEffectScale
     }, false);
コード例 #22
0
 private void OnExitSurface(Vector3 point, Vector3 surfaceNormal)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.WormBodyPositions2::OnExitSurface(UnityEngine.Vector3,UnityEngine.Vector3)' called on client");
         return;
     }
     if (this.exitTriggerCooldownTimer > 0f)
     {
         return;
     }
     this.exitTriggerCooldownTimer = this.impactCooldownDuration;
     EffectManager.SpawnEffect(this.burrowEffectPrefab, new EffectData
     {
         origin   = point,
         rotation = Util.QuaternionSafeLookRotation(surfaceNormal),
         scale    = 1f
     }, true);
     if (this.shouldFireMeatballsOnImpact)
     {
         this.FireMeatballs(surfaceNormal, point + surfaceNormal * 3f, this.characterDirection.forward, this.meatballCount, this.meatballAngle, this.meatballForce);
     }
 }
コード例 #23
0
        public void AddShrineStack(Interactor interactor)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineRestackBehavior::AddShrineStack(RoR2.Interactor)' called on client");
                return;
            }
            this.waitingForRefresh = true;
            CharacterBody component = interactor.GetComponent <CharacterBody>();

            if (component && component.master)
            {
                Inventory inventory = component.master.inventory;
                if (inventory)
                {
                    inventory.ShrineRestackInventory(this.rng);
                    Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
                    {
                        subjectAsCharacterBody = component,
                        baseToken = "SHRINE_RESTACK_USE_MESSAGE"
                    });
                }
            }
            EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
            {
                origin   = base.transform.position,
                rotation = Quaternion.identity,
                scale    = 1f,
                color    = new Color(1f, 0.23f, 0.6337214f)
            }, true);
            this.purchaseCount++;
            this.refreshTimer = 2f;
            if (this.purchaseCount >= this.maxPurchaseCount)
            {
                this.symbolTransform.gameObject.SetActive(false);
            }
        }
コード例 #24
0
 // Token: 0x060015B2 RID: 5554 RVA: 0x0005C6AC File Offset: 0x0005A8AC
 protected override void OnFixedUpdate()
 {
     base.OnFixedUpdate();
     if (TeleporterInteraction.instance)
     {
         bool flag = this.crystalsRequiredToKill > this.crystalsKilled;
         if (flag != TeleporterInteraction.instance.locked)
         {
             if (flag)
             {
                 if (NetworkServer.active)
                 {
                     TeleporterInteraction.instance.Networklocked = true;
                     return;
                 }
             }
             else
             {
                 if (NetworkServer.active)
                 {
                     TeleporterInteraction.instance.Networklocked = false;
                 }
                 ChildLocator component = TeleporterInteraction.instance.GetComponent <ModelLocator>().modelTransform.GetComponent <ChildLocator>();
                 if (component)
                 {
                     Transform transform = component.FindChild("TimeCrystalBeaconBlocker");
                     EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/TimeCrystalDeath"), new EffectData
                     {
                         origin = transform.transform.position
                     }, false);
                     transform.gameObject.SetActive(false);
                 }
             }
         }
     }
 }
コード例 #25
0
        private void AddDot(GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.DotController::AddDot(UnityEngine.GameObject,System.Single,RoR2.DotController/DotIndex,System.Single)' called on client");
                return;
            }
            if (dotIndex < DotController.DotIndex.Bleed || dotIndex >= DotController.DotIndex.Count)
            {
                return;
            }
            TeamIndex     teamIndex = TeamIndex.Neutral;
            float         num       = 0f;
            TeamComponent component = attackerObject.GetComponent <TeamComponent>();

            if (component)
            {
                teamIndex = component.teamIndex;
            }
            CharacterBody component2 = attackerObject.GetComponent <CharacterBody>();

            if (component2)
            {
                num = component2.damage;
            }
            DotController.DotDef   dotDef   = DotController.dotDefs[(int)dotIndex];
            DotController.DotStack dotStack = new DotController.DotStack
            {
                dotIndex       = dotIndex,
                dotDef         = dotDef,
                attackerObject = attackerObject,
                attackerTeam   = teamIndex,
                timer          = duration,
                damage         = dotDef.damageCoefficient * num * damageMultiplier,
                damageType     = DamageType.Generic
            };
            switch (dotIndex)
            {
            case DotController.DotIndex.Helfire:
            {
                if (!component2)
                {
                    return;
                }
                HealthComponent healthComponent = component2.healthComponent;
                if (!healthComponent)
                {
                    return;
                }
                dotStack.damage = healthComponent.fullHealth * 0.01f * damageMultiplier;
                if (this.victimObject == attackerObject)
                {
                    dotStack.damageType |= (DamageType.NonLethal | DamageType.Silent);
                }
                else if (this.victimTeam == teamIndex)
                {
                    dotStack.damage *= 0.5f;
                }
                else
                {
                    dotStack.damage *= 24f;
                }
                int i     = 0;
                int count = this.dotStackList.Count;
                while (i < count)
                {
                    if (this.dotStackList[i].dotIndex == DotController.DotIndex.Helfire && this.dotStackList[i].attackerObject == attackerObject)
                    {
                        this.dotStackList[i].timer  = Mathf.Max(this.dotStackList[i].timer, duration);
                        this.dotStackList[i].damage = dotStack.damage;
                        return;
                    }
                    i++;
                }
                if (this.victimBody)
                {
                    EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/HelfireIgniteEffect"), new EffectData
                        {
                            origin = this.victimBody.corePosition
                        }, true);
                }
                break;
            }

            case DotController.DotIndex.PercentBurn:
                dotStack.damage = Mathf.Min(dotStack.damage, this.victimBody.healthComponent.fullCombinedHealth * 0.01f);
                break;

            case DotController.DotIndex.Poison:
            {
                float a = this.victimHealthComponent.fullCombinedHealth / 100f * 1f * dotDef.interval;
                dotStack.damage     = Mathf.Min(Mathf.Max(a, dotStack.damage), dotStack.damage * 50f);
                dotStack.damageType = DamageType.NonLethal;
                int j      = 0;
                int count2 = this.dotStackList.Count;
                while (j < count2)
                {
                    if (this.dotStackList[j].dotIndex == DotController.DotIndex.Poison)
                    {
                        this.dotStackList[j].timer  = Mathf.Max(this.dotStackList[j].timer, duration);
                        this.dotStackList[j].damage = dotStack.damage;
                        return;
                    }
                    j++;
                }
                bool flag = false;
                for (int k = 0; k < this.dotStackList.Count; k++)
                {
                    if (this.dotStackList[k].dotIndex == DotController.DotIndex.Poison)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag && component2 != null)
                {
                    CharacterMaster master = component2.master;
                    if (master != null)
                    {
                        PlayerStatsComponent playerStatsComponent = master.playerStatsComponent;
                        if (playerStatsComponent != null)
                        {
                            playerStatsComponent.currentStats.PushStatValue(StatDef.totalCrocoInfectionsInflicted, 1UL);
                        }
                    }
                }
                break;
            }
            }
            this.dotStackList.Add(dotStack);
            this.OnDotStackAddedServer(dotStack);
        }
コード例 #26
0
        // Token: 0x060017D7 RID: 6103 RVA: 0x00067824 File Offset: 0x00065A24
        private void ProcessHits(List <OverlapAttack.OverlapInfo> hitList)
        {
            if (hitList.Count == 0)
            {
                return;
            }
            Vector3 vector = Vector3.zero;
            float   d      = 1f / (float)hitList.Count;

            for (int i = 0; i < hitList.Count; i++)
            {
                OverlapAttack.OverlapInfo overlapInfo = hitList[i];
                if (this.hitEffectPrefab)
                {
                    Vector3 forward = -hitList[i].pushDirection;
                    EffectManager.SpawnEffect(this.hitEffectPrefab, new EffectData
                    {
                        origin   = overlapInfo.hitPosition,
                        rotation = Util.QuaternionSafeLookRotation(forward),
                        networkSoundEventIndex = this.impactSound
                    }, true);
                }
                vector += overlapInfo.hitPosition * d;
                SurfaceDefProvider component = hitList[i].hurtBox.GetComponent <SurfaceDefProvider>();
                if (component && component.surfaceDef)
                {
                    SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(hitList[i].hurtBox.collider, hitList[i].hitPosition);
                    if (objectSurfaceDef)
                    {
                        if (objectSurfaceDef.impactEffectPrefab)
                        {
                            EffectManager.SpawnEffect(objectSurfaceDef.impactEffectPrefab, new EffectData
                            {
                                origin   = overlapInfo.hitPosition,
                                rotation = ((overlapInfo.pushDirection == Vector3.zero) ? Quaternion.identity : Util.QuaternionSafeLookRotation(overlapInfo.pushDirection)),
                                color    = objectSurfaceDef.approximateColor,
                                scale    = 2f
                            }, true);
                        }
                        if (objectSurfaceDef.impactSoundString != null && objectSurfaceDef.impactSoundString.Length != 0)
                        {
                            Util.PlaySound(objectSurfaceDef.impactSoundString, hitList[i].hurtBox.gameObject);
                        }
                    }
                }
            }
            this.lastFireAverageHitPosition = vector;
            if (NetworkServer.active)
            {
                OverlapAttack.PerformDamage(this.attacker, this.inflictor, this.damage, this.isCrit, this.procChainMask, this.procCoefficient, this.damageColorIndex, this.damageType, this.forceVector, this.pushAwayForce, hitList);
                return;
            }
            OverlapAttack.outgoingMessage.attacker         = this.attacker;
            OverlapAttack.outgoingMessage.inflictor        = this.inflictor;
            OverlapAttack.outgoingMessage.damage           = this.damage;
            OverlapAttack.outgoingMessage.isCrit           = this.isCrit;
            OverlapAttack.outgoingMessage.procChainMask    = this.procChainMask;
            OverlapAttack.outgoingMessage.procCoefficient  = this.procCoefficient;
            OverlapAttack.outgoingMessage.damageColorIndex = this.damageColorIndex;
            OverlapAttack.outgoingMessage.damageType       = this.damageType;
            OverlapAttack.outgoingMessage.forceVector      = this.forceVector;
            OverlapAttack.outgoingMessage.pushAwayForce    = this.pushAwayForce;
            Util.CopyList <OverlapAttack.OverlapInfo>(hitList, OverlapAttack.outgoingMessage.overlapInfoList);
            GameNetworkManager.singleton.client.connection.SendByChannel(71, OverlapAttack.outgoingMessage, QosChannelIndex.defaultReliable.intVal);
        }
コード例 #27
0
        // Token: 0x06000426 RID: 1062 RVA: 0x00010B54 File Offset: 0x0000ED54
        public bool DefaultHitCallback(ref BulletAttack.BulletHit hitInfo)
        {
            bool result = false;

            if (hitInfo.collider)
            {
                result = ((1 << hitInfo.collider.gameObject.layer & this.stopperMask) == 0);
            }
            if (this.hitEffectPrefab)
            {
                EffectManager.SimpleImpactEffect(this.hitEffectPrefab, hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true);
            }
            if (hitInfo.collider)
            {
                SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(hitInfo.collider, hitInfo.point);
                if (objectSurfaceDef && objectSurfaceDef.impactEffectPrefab)
                {
                    EffectData effectData = new EffectData
                    {
                        origin          = hitInfo.point,
                        rotation        = Quaternion.LookRotation(hitInfo.surfaceNormal),
                        color           = objectSurfaceDef.approximateColor,
                        surfaceDefIndex = objectSurfaceDef.surfaceDefIndex
                    };
                    EffectManager.SpawnEffect(objectSurfaceDef.impactEffectPrefab, effectData, true);
                }
            }
            if (this.isCrit)
            {
                EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/Critspark"), hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true);
            }
            GameObject entityObject = hitInfo.entityObject;

            if (entityObject)
            {
                float num = 1f;
                switch (this.falloffModel)
                {
                case BulletAttack.FalloffModel.None:
                    num = 1f;
                    break;

                case BulletAttack.FalloffModel.DefaultBullet:
                    num = 0.5f + Mathf.Clamp01(Mathf.InverseLerp(60f, 25f, hitInfo.distance)) * 0.5f;
                    break;

                case BulletAttack.FalloffModel.Buckshot:
                    num = 0.25f + Mathf.Clamp01(Mathf.InverseLerp(25f, 7f, hitInfo.distance)) * 0.75f;
                    break;
                }
                DamageInfo damageInfo = new DamageInfo();
                damageInfo.damage           = this.damage * num;
                damageInfo.crit             = this.isCrit;
                damageInfo.attacker         = this.owner;
                damageInfo.inflictor        = this.weapon;
                damageInfo.position         = hitInfo.point;
                damageInfo.force            = hitInfo.direction * (this.force * num);
                damageInfo.procChainMask    = this.procChainMask;
                damageInfo.procCoefficient  = this.procCoefficient;
                damageInfo.damageType       = this.damageType;
                damageInfo.damageColorIndex = this.damageColorIndex;
                damageInfo.ModifyDamageInfo(hitInfo.damageModifier);
                TeamIndex teamIndex = TeamIndex.Neutral;
                if (this.owner)
                {
                    TeamComponent component = this.owner.GetComponent <TeamComponent>();
                    if (component)
                    {
                        teamIndex = component.teamIndex;
                    }
                }
                TeamIndex     teamIndex2 = TeamIndex.Neutral;
                TeamComponent component2 = hitInfo.entityObject.GetComponent <TeamComponent>();
                if (component2)
                {
                    teamIndex2 = component2.teamIndex;
                }
                bool            flag            = teamIndex == teamIndex2;
                HealthComponent healthComponent = null;
                if (!flag)
                {
                    healthComponent = entityObject.GetComponent <HealthComponent>();
                }
                if (NetworkServer.active)
                {
                    if (healthComponent)
                    {
                        healthComponent.TakeDamage(damageInfo);
                        GlobalEventManager.instance.OnHitEnemy(damageInfo, hitInfo.entityObject);
                    }
                    GlobalEventManager.instance.OnHitAll(damageInfo, hitInfo.entityObject);
                }
                else if (ClientScene.ready)
                {
                    BulletAttack.messageWriter.StartMessage(53);
                    BulletAttack.messageWriter.Write(entityObject);
                    BulletAttack.messageWriter.Write(damageInfo);
                    BulletAttack.messageWriter.Write(healthComponent != null);
                    BulletAttack.messageWriter.FinishMessage();
                    ClientScene.readyConnection.SendWriter(BulletAttack.messageWriter, QosChannelIndex.defaultReliable.intVal);
                }
            }
            return(result);
        }
コード例 #28
0
        // Token: 0x0600042F RID: 1071 RVA: 0x000113A0 File Offset: 0x0000F5A0
        private void FireSingle(Vector3 normal, int muzzleIndex)
        {
            float   num    = this.maxDistance;
            Vector3 vector = this.origin + normal * this.maxDistance;
            List <BulletAttack.BulletHit> list = new List <BulletAttack.BulletHit>();
            bool flag  = this.radius == 0f || this.smartCollision;
            bool flag2 = this.radius != 0f;
            HashSet <GameObject> hashSet = null;

            if (this.smartCollision)
            {
                hashSet = new HashSet <GameObject>();
            }
            if (flag)
            {
                RaycastHit[] array = Physics.RaycastAll(this.origin, normal, num, this.hitMask, this.queryTriggerInteraction);
                for (int i = 0; i < array.Length; i++)
                {
                    BulletAttack.BulletHit bulletHit = default(BulletAttack.BulletHit);
                    this.InitBulletHitFromRaycastHit(ref bulletHit, this.origin, normal, ref array[i]);
                    list.Add(bulletHit);
                    if (this.smartCollision)
                    {
                        hashSet.Add(bulletHit.entityObject);
                    }
                    if (bulletHit.distance < num)
                    {
                        num = bulletHit.distance;
                    }
                }
            }
            if (flag2)
            {
                LayerMask mask = this.hitMask;
                if (this.smartCollision)
                {
                    mask &= ~LayerIndex.world.mask;
                }
                RaycastHit[] array2 = Physics.SphereCastAll(this.origin, this.radius, normal, num, mask, this.queryTriggerInteraction);
                for (int j = 0; j < array2.Length; j++)
                {
                    BulletAttack.BulletHit bulletHit2 = default(BulletAttack.BulletHit);
                    this.InitBulletHitFromRaycastHit(ref bulletHit2, this.origin, normal, ref array2[j]);
                    if (!this.smartCollision || !hashSet.Contains(bulletHit2.entityObject))
                    {
                        list.Add(bulletHit2);
                    }
                }
            }
            this.ProcessHitList(list, ref vector, new List <GameObject>());
            if (this.tracerEffectPrefab)
            {
                EffectData effectData = new EffectData
                {
                    origin = vector,
                    start  = this.origin
                };
                effectData.SetChildLocatorTransformReference(this.weapon, muzzleIndex);
                EffectManager.SpawnEffect(this.tracerEffectPrefab, effectData, true);
            }
        }
コード例 #29
0
        private bool PerformEquipmentAction(EquipmentIndex equipmentIndex)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Boolean RoR2.EquipmentSlot::PerformEquipmentAction(RoR2.EquipmentIndex)' called on client");
                return(false);
            }
            switch (equipmentIndex)
            {
            case EquipmentIndex.CommandMissile:
                this.remainingMissiles += 12;
                return(true);

            case EquipmentIndex.Saw:
            {
                Vector3 position = base.transform.position;
                Ray     aimRay   = this.GetAimRay();
                bool    crit     = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
                ProjectileManager.instance.FireProjectile(Resources.Load <GameObject>("Prefabs/Projectiles/Sawmerang"), aimRay.origin, Util.QuaternionSafeLookRotation(aimRay.direction), base.gameObject, this.characterBody.damage, 0f, crit, DamageColorIndex.Default, null, -1f);
                return(true);
            }

            case EquipmentIndex.Fruit:
                if (this.healthComponent)
                {
                    Util.PlaySound("Play_item_use_fruit", base.gameObject);
                    EffectData effectData = new EffectData();
                    effectData.origin = base.transform.position;
                    effectData.SetNetworkedObjectReference(base.gameObject);
                    EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/FruitHealEffect"), effectData, true);
                    this.healthComponent.HealFraction(0.5f, default(ProcChainMask));
                    return(true);
                }
                return(true);

            case EquipmentIndex.Meteor:
            {
                MeteorStormController component = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/MeteorStorm"), this.characterBody.corePosition, Quaternion.identity).GetComponent <MeteorStormController>();
                component.owner       = base.gameObject;
                component.ownerDamage = this.characterBody.damage;
                component.isCrit      = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
                NetworkServer.Spawn(component.gameObject);
                return(true);
            }

            case EquipmentIndex.SoulJar:
                return(true);

            case EquipmentIndex.Blackhole:
            {
                Vector3 position2 = base.transform.position;
                Ray     aimRay2   = this.GetAimRay();
                ProjectileManager.instance.FireProjectile(Resources.Load <GameObject>("Prefabs/Projectiles/GravSphere"), position2, Util.QuaternionSafeLookRotation(aimRay2.direction), base.gameObject, 0f, 0f, false, DamageColorIndex.Default, null, -1f);
                return(true);
            }

            case EquipmentIndex.GhostGun:
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/GhostGun"), base.transform.position, Quaternion.identity);
                gameObject.GetComponent <GhostGunController>().owner = base.gameObject;
                NetworkServer.Spawn(gameObject);
                return(true);
            }

            case EquipmentIndex.CritOnUse:
                this.characterBody.AddTimedBuff(BuffIndex.FullCrit, 8f);
                return(true);

            case EquipmentIndex.DroneBackup:
            {
                Util.PlaySound("Play_item_use_radio", base.gameObject);
                int   sliceCount = 4;
                float num        = 25f;
                if (NetworkServer.active)
                {
                    float y = Quaternion.LookRotation(this.GetAimRay().direction).eulerAngles.y;
                    float d = 3f;
                    foreach (float num2 in new DegreeSlices(sliceCount, 0.5f))
                    {
                        Quaternion      rotation        = Quaternion.Euler(0f, y + num2, 0f);
                        Quaternion      rotation2       = Quaternion.Euler(0f, y + num2 + 180f, 0f);
                        Vector3         position3       = base.transform.position + rotation * (Vector3.forward * d);
                        CharacterMaster characterMaster = this.SummonMaster(Resources.Load <GameObject>("Prefabs/CharacterMasters/DroneBackupMaster"), position3, rotation2);
                        if (characterMaster)
                        {
                            characterMaster.gameObject.AddComponent <MasterSuicideOnTimer>().lifeTimer = num + UnityEngine.Random.Range(0f, 3f);
                        }
                    }
                }
                this.subcooldownTimer = 0.5f;
                return(true);
            }

            case EquipmentIndex.OrbitalLaser:
            {
                Vector3    position4 = base.transform.position;
                RaycastHit raycastHit;
                if (Physics.Raycast(this.GetAimRay(), out raycastHit, 900f, LayerIndex.world.mask | LayerIndex.defaultLayer.mask))
                {
                    position4 = raycastHit.point;
                }
                GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Prefabs/NetworkedObjects/OrbitalLaser"), position4, Quaternion.identity);
                gameObject2.GetComponent <OrbitalLaserController>().ownerBody = this.characterBody;
                NetworkServer.Spawn(gameObject2);
                return(true);
            }

            case EquipmentIndex.BFG:
                this.bfgChargeTimer   = 2f;
                this.subcooldownTimer = 2.2f;
                return(true);

            case EquipmentIndex.Enigma:
            {
                EquipmentIndex equipmentIndex2 = EquipmentCatalog.enigmaEquipmentList[UnityEngine.Random.Range(0, EquipmentCatalog.enigmaEquipmentList.Count - 1)];
                this.PerformEquipmentAction(equipmentIndex2);
                return(true);
            }

            case EquipmentIndex.Jetpack:
            {
                JetpackController jetpackController = JetpackController.FindJetpackController(base.gameObject);
                if (!jetpackController)
                {
                    GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/JetpackController"));
                    jetpackController = gameObject3.GetComponent <JetpackController>();
                    jetpackController.NetworktargetObject = base.gameObject;
                    NetworkServer.Spawn(gameObject3);
                    return(true);
                }
                jetpackController.ResetTimer();
                return(true);
            }

            case EquipmentIndex.Lightning:
            {
                this.UpdateTargets();
                HurtBox hurtBox = this.currentTargetHurtBox;
                if (hurtBox)
                {
                    this.subcooldownTimer = 0.2f;
                    OrbManager.instance.AddOrb(new LightningStrikeOrb
                        {
                            attacker         = base.gameObject,
                            damageColorIndex = DamageColorIndex.Item,
                            damageValue      = this.characterBody.damage * 30f,
                            isCrit           = Util.CheckRoll(this.characterBody.crit, this.characterBody.master),
                            procChainMask    = default(ProcChainMask),
                            procCoefficient  = 1f,
                            target           = hurtBox
                        });
                    this.InvalidateCurrentTarget();
                    return(true);
                }
                return(false);
            }

            case EquipmentIndex.PassiveHealing:
                if (this.passiveHealingFollower)
                {
                    this.UpdateTargets();
                    this.passiveHealingFollower.AssignNewTarget(this.currentTargetBodyObject);
                    this.InvalidateCurrentTarget();
                    return(true);
                }
                return(true);

            case EquipmentIndex.BurnNearby:
                if (this.characterBody)
                {
                    this.characterBody.AddHelfireDuration(8f);
                    return(true);
                }
                return(true);

            case EquipmentIndex.SoulCorruptor:
            {
                this.UpdateTargets();
                HurtBox hurtBox2 = this.currentTargetHurtBox;
                if (!hurtBox2)
                {
                    return(false);
                }
                if (!hurtBox2.healthComponent || hurtBox2.healthComponent.combinedHealthFraction > 0.25f)
                {
                    return(false);
                }
                Util.TryToCreateGhost(hurtBox2.healthComponent.body, this.characterBody, 30);
                hurtBox2.healthComponent.Suicide(base.gameObject, null, DamageType.Generic);
                this.InvalidateCurrentTarget();
                return(true);
            }

            case EquipmentIndex.Scanner:
                NetworkServer.Spawn(UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/ChestScanner"), this.characterBody.corePosition, Quaternion.identity));
                return(true);

            case EquipmentIndex.CrippleWard:
                NetworkServer.Spawn(UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/CrippleWard"), this.characterBody.corePosition, Quaternion.identity));
                this.inventory.SetEquipmentIndex(EquipmentIndex.None);
                return(true);

            case EquipmentIndex.Gateway:
                return(this.FireGateway());

            case EquipmentIndex.Tonic:
                this.characterBody.AddTimedBuff(BuffIndex.TonicBuff, EquipmentSlot.tonicBuffDuration);
                if (!Util.CheckRoll(80f, this.characterBody.master))
                {
                    this.characterBody.pendingTonicAfflictionCount++;
                    return(true);
                }
                return(true);

            case EquipmentIndex.QuestVolatileBattery:
                return(false);

            case EquipmentIndex.Cleanse:
            {
                Vector3    corePosition = this.characterBody.corePosition;
                EffectData effectData2  = new EffectData
                {
                    origin = corePosition
                };
                effectData2.SetHurtBoxReference(this.characterBody.mainHurtBox);
                EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/CleanseEffect"), effectData2, true);
                BuffIndex buffIndex = BuffIndex.Slow50;
                BuffIndex buffCount = (BuffIndex)BuffCatalog.buffCount;
                while (buffIndex < buffCount)
                {
                    if (BuffCatalog.GetBuffDef(buffIndex).isDebuff)
                    {
                        this.characterBody.ClearTimedBuffs(buffIndex);
                    }
                    buffIndex++;
                }
                DotController.RemoveAllDots(base.gameObject);
                SetStateOnHurt component2 = base.GetComponent <SetStateOnHurt>();
                if (component2)
                {
                    component2.Cleanse();
                }
                float     num3      = 6f;
                float     num4      = num3 * num3;
                TeamIndex teamIndex = this.teamComponent.teamIndex;
                List <ProjectileController> instancesList = InstanceTracker.GetInstancesList <ProjectileController>();
                List <ProjectileController> list          = new List <ProjectileController>();
                int i     = 0;
                int count = instancesList.Count;
                while (i < count)
                {
                    ProjectileController projectileController = instancesList[i];
                    if (projectileController.teamFilter.teamIndex != teamIndex && (projectileController.transform.position - corePosition).sqrMagnitude < num4)
                    {
                        list.Add(projectileController);
                    }
                    i++;
                }
                int j      = 0;
                int count2 = list.Count;
                while (j < count2)
                {
                    ProjectileController projectileController2 = list[j];
                    if (projectileController2)
                    {
                        UnityEngine.Object.Destroy(projectileController2.gameObject);
                    }
                    j++;
                }
                return(true);
            }

            case EquipmentIndex.FireBallDash:
            {
                Ray        aimRay3     = this.GetAimRay();
                GameObject gameObject4 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/FireballVehicle"), aimRay3.origin, Quaternion.LookRotation(aimRay3.direction));
                gameObject4.GetComponent <VehicleSeat>().AssignPassenger(base.gameObject);
                CharacterBody characterBody = this.characterBody;
                NetworkUser   networkUser;
                if (characterBody == null)
                {
                    networkUser = null;
                }
                else
                {
                    CharacterMaster master = characterBody.master;
                    if (master == null)
                    {
                        networkUser = null;
                    }
                    else
                    {
                        PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
                        networkUser = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null);
                    }
                }
                NetworkUser networkUser2 = networkUser;
                if (networkUser2)
                {
                    NetworkServer.SpawnWithClientAuthority(gameObject4, networkUser2.gameObject);
                }
                else
                {
                    NetworkServer.Spawn(gameObject4);
                }
                this.subcooldownTimer = 2f;
                return(true);
            }

            case EquipmentIndex.GainArmor:
                this.characterBody.AddTimedBuff(BuffIndex.ElephantArmorBoost, 5f);
                return(true);
            }
            return(false);
        }
コード例 #30
0
        // Token: 0x06000B07 RID: 2823 RVA: 0x00030EAC File Offset: 0x0002F0AC
        public void Footstep(string childName, GameObject footstepEffect)
        {
            if (!this.body)
            {
                return;
            }
            Transform transform = this.childLocator.FindChild(childName);

            if (transform)
            {
                Color      color      = Color.gray;
                RaycastHit raycastHit = default(RaycastHit);
                Vector3    position   = transform.position;
                position.y += 1.5f;
                Debug.DrawRay(position, Vector3.down);
                if (Physics.Raycast(new Ray(position, Vector3.down), out raycastHit, 4f, LayerIndex.world.mask | LayerIndex.water.mask, QueryTriggerInteraction.Collide))
                {
                    if (this.bodyInventory && this.bodyInventory.GetItemCount(ItemIndex.Hoof) > 0 && childName == "FootR")
                    {
                        Util.PlaySound("Play_item_proc_hoof", this.body.gameObject);
                    }
                    if (footstepEffect)
                    {
                        EffectManager.SimpleImpactEffect(footstepEffect, raycastHit.point, raycastHit.normal, false);
                    }
                    SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(raycastHit.collider, raycastHit.point);
                    bool       flag             = false;
                    if (objectSurfaceDef)
                    {
                        color = objectSurfaceDef.approximateColor;
                        if (objectSurfaceDef.footstepEffectPrefab)
                        {
                            EffectManager.SpawnEffect(objectSurfaceDef.footstepEffectPrefab, new EffectData
                            {
                                origin = raycastHit.point,
                                scale  = this.body.radius
                            }, false);
                            flag = true;
                        }
                        if (!string.IsNullOrEmpty(objectSurfaceDef.materialSwitchString))
                        {
                            AkSoundEngine.SetSwitch("material", objectSurfaceDef.materialSwitchString, this.body.gameObject);
                        }
                    }
                    else
                    {
                        Debug.LogFormat("{0} is missing surface def", new object[]
                        {
                            raycastHit.collider.gameObject
                        });
                    }
                    if (this.footstepDustInstanceTransform && !flag)
                    {
                        this.footstepDustInstanceTransform.position             = raycastHit.point;
                        this.footstepDustInstanceParticleSystem.main.startColor = color;
                        this.footstepDustInstanceParticleSystem.Play();
                        if (this.footstepDustInstanceShakeEmitter)
                        {
                            this.footstepDustInstanceShakeEmitter.StartShake();
                        }
                    }
                }
                Util.PlaySound((!string.IsNullOrEmpty(this.sprintFootstepOverrideString) && this.body.isSprinting) ? this.sprintFootstepOverrideString : this.baseFootstepString, this.body.gameObject);
                return;
            }
            Debug.LogWarningFormat("Object {0} lacks ChildLocator entry \"{1}\" to handle Footstep event!", new object[]
            {
                base.gameObject.name,
                childName
            });
        }