Пример #1
0
            public void DestroyThingsOnOpen()
            {
                SfxLocator sfxLocator = GetComponent <SfxLocator>();

                if (sfxLocator)
                {
                    Util.PlaySound(sfxLocator.openSound, gameObject);
                }

                if (ppDuration)
                {
                    ppDuration.enabled = true;
                }
                if (positionIndicator)
                {
                    positionIndicator.gameObject.SetActive(false);
                }

                ObjectScaleCurve objectScaleCurve = GetComponentInChildren <ObjectScaleCurve>();

                if (objectScaleCurve)
                {
                    objectScaleCurve.enabled = true;
                }

                if (NetworkServer.active)
                {
                    new SyncDestroyThingsOnOpen(gameObject.GetComponent <NetworkIdentity>().netId).Send(NetworkDestination.Clients);
                }
            }
Пример #2
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration     = this.baseDuration / this.attackSpeedStat;
            this.animator     = base.GetModelAnimator();
            this.childLocator = base.GetModelChildLocator();

            if (this.childLocator)
            {
                Transform transform = this.childLocator.FindChild("HandL");

                if (transform && this.chargeEffectPrefab)
                {
                    this.chargeEffectInstance = UnityEngine.Object.Instantiate <GameObject>(this.chargeEffectPrefab, transform.position, transform.rotation);
                    this.chargeEffectInstance.transform.parent = transform;

                    ScaleParticleSystemDuration scaleParticleSystemDuration = this.chargeEffectInstance.GetComponent <ScaleParticleSystemDuration>();
                    ObjectScaleCurve            scaleCurve = this.chargeEffectInstance.GetComponent <ObjectScaleCurve>();

                    if (scaleParticleSystemDuration)
                    {
                        scaleParticleSystemDuration.newDuration = this.duration;
                    }
                    if (scaleCurve)
                    {
                        scaleCurve.timeMax = this.duration;
                    }
                }
            }

            base.PlayAnimation("Gesture, Override", "ChannelSpell", "Spell.playbackRate", 0.85f);
            this.loopSoundInstanceId    = Util.PlayScaledSound(this.chargeSoundString, base.gameObject, this.attackSpeedStat);
            this.defaultCrosshairPrefab = base.characterBody.crosshairPrefab;

            if (base.cameraTargetParams)
            {
                base.cameraTargetParams.aimMode = CameraTargetParams.AimType.AimThrow;
            }

            if (this.crosshairOverridePrefab)
            {
                base.characterBody.crosshairPrefab = this.crosshairOverridePrefab;
            }

            if (NetworkServer.active)
            {
                base.characterBody.AddBuff(BuffIndex.Slow50);
            }

            if (EntityStates.Huntress.ArrowRain.areaIndicatorPrefab)
            {
                this.areaIndicatorInstance = UnityEngine.Object.Instantiate <GameObject>(EntityStates.Huntress.ArrowRain.areaIndicatorPrefab);
                this.areaIndicatorInstance.transform.localScale = Vector3.zero;
            }
        }
Пример #3
0
 // Token: 0x0600333C RID: 13116 RVA: 0x000DE470 File Offset: 0x000DC670
 private void EnableIndicator(Transform indicator)
 {
     if (indicator)
     {
         indicator.gameObject.SetActive(true);
         ObjectScaleCurve component = indicator.gameObject.GetComponent <ObjectScaleCurve>();
         if (component)
         {
             component.time = 0f;
         }
     }
 }
Пример #4
0
        private void ScaleObject(GameObject objectToScaleDown, bool scaleUp)
        {
            float            valueEnd   = scaleUp ? 1f : 0f;
            float            valueStart = scaleUp ? 0f : 1f;
            ObjectScaleCurve component  = objectToScaleDown.GetComponent <ObjectScaleCurve>();

            component.timeMax      = PortalJump.portalScaleDuration;
            component.curveX       = AnimationCurve.Linear(0f, valueStart, 1f, valueEnd);
            component.curveY       = AnimationCurve.Linear(0f, valueStart, 1f, valueEnd);
            component.curveZ       = AnimationCurve.Linear(0f, valueStart, 1f, valueEnd);
            component.overallCurve = AnimationCurve.EaseInOut(0f, valueStart, 1f, valueEnd);
            component.enabled      = true;
        }
Пример #5
0
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_RiftLensDebuff";
            SetItemTierWhenAvailable(ItemTier.NoTier);
            itemDef.canRemove        = false;
            itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Rift Lens Debuff/Icon.png");

            GameObject debuffedVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Rift Lens Debuff/RiftLensAfflictionVFX.prefab");
            GameObject vfxOrigin   = debuffedVFX.transform.Find("Origin").gameObject;

            CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = debuffedVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>();
            RotateAroundAxis rotateAroundAxis = vfxOrigin.AddComponent <RotateAroundAxis>();

            rotateAroundAxis.relativeTo        = Space.Self;
            rotateAroundAxis.rotateAroundAxis  = RotateAroundAxis.RotationAxis.X;
            rotateAroundAxis.slowRotationSpeed = 30f;
            rotateAroundAxis.speed             = RotateAroundAxis.Speed.Slow;
            ObjectScaleCurve fadeOut = vfxOrigin.AddComponent <ObjectScaleCurve>();

            fadeOut.overallCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(-20f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 0f, Mathf.Tan(160f * Mathf.Deg2Rad), 0f)
                }
            };
            fadeOut.useOverallCurveOnly = true;
            fadeOut.enabled             = false;
            fadeOut.timeMax             = 0.6f;
            tempVFX.exitBehaviours      = new MonoBehaviour[]
            {
                fadeOut
            };
            CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo
            {
                prefab    = debuffedVFX,
                condition = (x) => {
                    Inventory inventory = x.inventory;
                    if (inventory)
                    {
                        return(inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff) > 0);
                    }
                    return(false);
                },
                radius = CustomTempVFXManagement.DefaultRadiusCall
            });
        }
Пример #6
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.animator     = base.GetModelAnimator();
            this.childLocator = base.GetModelChildLocator();

            if (this.childLocator)
            {
                Transform transform = this.childLocator.FindChild("HandL");

                if (transform && this.chargeEffectPrefab)
                {
                    this.chargeEffectInstance = UnityEngine.Object.Instantiate <GameObject>(this.chargeEffectPrefab, transform.position, transform.rotation);
                    this.chargeEffectInstance.transform.parent = transform;
                    ScaleParticleSystemDuration component  = this.chargeEffectInstance.GetComponent <ScaleParticleSystemDuration>();
                    ObjectScaleCurve            component2 = this.chargeEffectInstance.GetComponent <ObjectScaleCurve>();
                    if (component)
                    {
                        component.newDuration = this.duration;
                    }
                    if (component2)
                    {
                        component2.timeMax = this.duration;
                    }
                }
            }

            base.PlayAnimation("Gesture, Override", "ChargeSpell", "Spell.playbackRate", 0.4f);
            this.loopSoundInstanceId    = Util.PlayAttackSpeedSound(this.chargeSoundString, base.gameObject, this.attackSpeedStat);
            this.defaultCrosshairPrefab = base.characterBody.crosshairPrefab;

            if (base.cameraTargetParams)
            {
                //base.cameraTargetParams.aimMode = CameraTargetParams.AimType.OverTheShoulder;
            }

            if (this.crosshairOverridePrefab)
            {
                base.characterBody.crosshairPrefab = this.crosshairOverridePrefab;
            }

            if (EntityStates.Huntress.ArrowRain.areaIndicatorPrefab)
            {
                this.areaIndicatorInstance = UnityEngine.Object.Instantiate <GameObject>(EntityStates.Huntress.ArrowRain.areaIndicatorPrefab);
                this.areaIndicatorInstance.transform.localScale = new Vector3(this.spellRadius, this.spellRadius, this.spellRadius);
            }
        }
        // Token: 0x0600053D RID: 1341 RVA: 0x00017460 File Offset: 0x00015660
        public override void OnEnter()
        {
            base.OnEnter();
            MageLastElementTracker component = base.GetComponent <MageLastElementTracker>();

            if (component)
            {
                component.ApplyElement(MageElement.Lightning);
            }
            this.stopwatch        = 0f;
            this.windDownDuration = ChargeNovabomb.baseWinddownDuration / this.attackSpeedStat;
            this.chargeDuration   = ChargeNovabomb.baseChargeDuration / this.attackSpeedStat;
            Util.PlayScaledSound(ChargeNovabomb.chargeSoundString, base.gameObject, this.attackSpeedStat);
            base.characterBody.SetAimTimer(this.chargeDuration + this.windDownDuration + 2f);
            this.muzzleString = "MuzzleBetween";
            this.animator     = base.GetModelAnimator();
            if (this.animator)
            {
                this.childLocator = this.animator.GetComponent <ChildLocator>();
            }
            if (this.childLocator)
            {
                this.muzzleTransform = this.childLocator.FindChild(this.muzzleString);
                if (this.muzzleTransform && ChargeNovabomb.chargeEffectPrefab)
                {
                    this.chargeEffectInstance = UnityEngine.Object.Instantiate <GameObject>(ChargeNovabomb.chargeEffectPrefab, this.muzzleTransform.position, this.muzzleTransform.rotation);
                    this.chargeEffectInstance.transform.parent = this.muzzleTransform;
                    ScaleParticleSystemDuration component2 = this.chargeEffectInstance.GetComponent <ScaleParticleSystemDuration>();
                    ObjectScaleCurve            component3 = this.chargeEffectInstance.GetComponent <ObjectScaleCurve>();
                    if (component2)
                    {
                        component2.newDuration = this.chargeDuration;
                    }
                    if (component3)
                    {
                        component3.timeMax = this.chargeDuration;
                    }
                }
            }
            base.PlayAnimation("Gesture, Additive", "ChargeNovaBomb", "ChargeNovaBomb.playbackRate", this.chargeDuration);
            this.defaultCrosshairPrefab = base.characterBody.crosshairPrefab;
            if (ChargeNovabomb.crosshairOverridePrefab)
            {
                base.characterBody.crosshairPrefab = ChargeNovabomb.crosshairOverridePrefab;
            }
        }
Пример #8
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration        = this.baseDuration / this.attackSpeedStat;
            this.animator        = base.GetModelAnimator();
            this.childLocator    = base.GetModelChildLocator();
            this.swordController = base.GetComponent <PaladinSwordController>();

            if (this.swordController)
            {
                this.swordController.attacking = true;
            }

            if (this.childLocator)
            {
                Transform transform = this.childLocator.FindChild("HandL");

                if (transform && this.chargeEffectPrefab)
                {
                    this.chargeEffectInstance = UnityEngine.Object.Instantiate <GameObject>(this.chargeEffectPrefab, transform.position, transform.rotation);
                    this.chargeEffectInstance.transform.parent = transform;
                    ScaleParticleSystemDuration component  = this.chargeEffectInstance.GetComponent <ScaleParticleSystemDuration>();
                    ObjectScaleCurve            component2 = this.chargeEffectInstance.GetComponent <ObjectScaleCurve>();
                    if (component)
                    {
                        component.newDuration = this.duration;
                    }
                    if (component2)
                    {
                        component2.timeMax = this.duration;
                    }
                }
            }

            base.PlayAnimation("Gesture, Override", "ChargeSpell", "ChargeSpell.playbackRate", 0.4f * this.duration);
            this.loopSoundInstanceId    = Util.PlayScaledSound(this.chargeSoundString, base.gameObject, this.attackSpeedStat);
            this.defaultCrosshairPrefab = base.characterBody.crosshairPrefab;

            if (this.crosshairOverridePrefab)
            {
                base.characterBody.crosshairPrefab = this.crosshairOverridePrefab;
            }

            base.StartAimMode(this.duration + 2f, false);
        }
        // Token: 0x06002CE4 RID: 11492 RVA: 0x000BD81C File Offset: 0x000BBA1C
        private void EnableIndicator(string childLocatorName, ChildLocator childLocator = null)
        {
            if (!childLocator)
            {
                childLocator = base.GetModelTransform().GetComponent <ChildLocator>();
            }
            Transform transform = childLocator.FindChild(childLocatorName);

            if (transform)
            {
                transform.gameObject.SetActive(true);
                ObjectScaleCurve component = transform.gameObject.GetComponent <ObjectScaleCurve>();
                if (component)
                {
                    component.time = 0f;
                }
            }
        }
Пример #10
0
 // Token: 0x06002B18 RID: 11032 RVA: 0x000B5608 File Offset: 0x000B3808
 public override void OnEnter()
 {
     base.OnEnter();
     this.duration = ChargeState.baseDuration / (base.attachedBody ? base.attachedBody.attackSpeed : 1f);
     base.SetChargeSparkEmissionRateMultiplier(1f);
     if (base.attachedBody)
     {
         Vector3    position = base.transform.position;
         Quaternion rotation = base.transform.rotation;
         this.chargeVfxInstance = UnityEngine.Object.Instantiate <GameObject>(ChargeMegaNova.chargingEffectPrefab, position, rotation);
         this.chargeVfxInstance.transform.localScale = Vector3.one * 0.25f;
         Util.PlaySound(ChargeState.chargeSound, base.gameObject);
         this.areaIndicatorVfxInstance = UnityEngine.Object.Instantiate <GameObject>(ChargeMegaNova.areaIndicatorPrefab, position, rotation);
         ObjectScaleCurve component = this.areaIndicatorVfxInstance.GetComponent <ObjectScaleCurve>();
         component.timeMax   = this.duration;
         component.baseScale = Vector3.one * DetonateState.blastRadius;
         this.areaIndicatorVfxInstance.GetComponent <AnimateShaderAlpha>().timeMax = this.duration;
     }
     RoR2Application.onLateUpdate += this.OnLateUpdate;
 }
Пример #11
0
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_DeathCeremony";
            SetItemTierWhenAvailable(ItemTier.Tier2);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Damage
            };

            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Death Ceremony/Model.prefab"));
            HopooShaderToMaterial.Standard.Apply(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial);
            HopooShaderToMaterial.Standard.Emission(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 1f);
            itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Death Ceremony/Icon.png");
            itemDisplayPrefab        = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "CalfL", new Vector3(0.07748F, 0.19394F, -0.03508F), new Vector3(351.2407F, 38.31051F, 271.2653F), new Vector3(0.08418F, 0.08418F, 0.08418F));
                AddDisplayRule("HuntressBody", "CalfL", new Vector3(0.01081F, 0.33039F, -0.04676F), new Vector3(271.8222F, -0.00021F, 329.7724F), new Vector3(0.07837F, 0.07837F, 0.07837F));
                AddDisplayRule("Bandit2Body", "CalfL", new Vector3(0.03402F, 0.33989F, -0.05447F), new Vector3(275.6507F, 198.2068F, 136.1487F), new Vector3(0.07333F, 0.07333F, 0.07333F));
                AddDisplayRule("ToolbotBody", "CalfL", new Vector3(-0.76507F, 2.13588F, -0.16809F), new Vector3(0F, 0F, 92.59356F), new Vector3(0.6665F, 0.6665F, 0.6665F));
                AddDisplayRule("EngiBody", "CalfL", new Vector3(0.06642F, 0.07521F, -0.07491F), new Vector3(2.18099F, 54.26896F, 272.251F), new Vector3(0.07373F, 0.07373F, 0.07373F));
                AddDisplayRule("EngiTurretBody", "LegBar2", new Vector3(-0.00001F, 0.25339F, 0.2332F), new Vector3(87.51187F, 180F, 180F), new Vector3(0.31299F, 0.31299F, 0.31299F));
                AddDisplayRule("EngiWalkerTurretBody", "LegBar2", new Vector3(-0.00001F, 0.32614F, 0.3331F), new Vector3(80.43612F, 180F, 180F), new Vector3(0.35353F, 0.35353F, 0.35353F));
                AddDisplayRule("MageBody", "CalfL", new Vector3(-0.05753F, 0.055F, -0.00398F), new Vector3(283.2863F, 250.2234F, 182.1714F), new Vector3(0.08759F, 0.08759F, 0.08759F));
                AddDisplayRule("MercBody", "CalfL", new Vector3(0F, 0.06378F, -0.0637F), new Vector3(275.3986F, 0F, 0F), new Vector3(0.0835F, 0.0835F, 0.0835F));
                AddDisplayRule("TreebotBody", "FootFrontL", new Vector3(-0.00003F, 0.2441F, -0.14866F), new Vector3(270.8983F, 0F, 0F), new Vector3(0.20205F, 0.20205F, 0.20205F));
                AddDisplayRule("LoaderBody", "CalfL", new Vector3(0.10101F, 0.10896F, -0.05009F), new Vector3(286.7617F, 305.9382F, 3.19435F), new Vector3(0.10456F, 0.10456F, 0.10456F));
                AddDisplayRule("CrocoBody", "CalfL", new Vector3(-0.72054F, 1.36348F, -0.3729F), new Vector3(355.4709F, 323.8942F, 83.82096F), new Vector3(0.78694F, 0.78694F, 0.78694F));
                AddDisplayRule("CaptainBody", "CalfL", new Vector3(0F, 0.05716F, -0.09369F), new Vector3(287.3015F, 0F, 0F), new Vector3(0.10502F, 0.10502F, 0.10502F));
                AddDisplayRule("BrotherBody", "CalfL", BrotherInfection.green, new Vector3(0.00384F, 0.00536F, -0.03235F), new Vector3(14.82572F, 260.7474F, 350.3363F), new Vector3(0.04861F, 0.10534F, 0.10724F));
                AddDisplayRule("ScavBody", "CalfL", new Vector3(0.33272F, -0.17368F, -1.09799F), new Vector3(277.8127F, 180F, 165.8016F), new Vector3(1.08614F, 1.08614F, 1.08614F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "CalfL", new Vector3(-0.04687F, 0.03461F, 0.08856F), new Vector3(80.03226F, 0F, 32.95736F), new Vector3(0.07694F, 0.07694F, 0.07694F));
                }
                AddDisplayRule("RailgunnerBody", "CalfL", new Vector3(0.07292F, 0.00507F, 0.09758F), new Vector3(65.51882F, 247.9167F, 209.6704F), new Vector3(0.10736F, 0.10736F, 0.10736F));
                AddDisplayRule("VoidSurvivorBody", "ThighL", new Vector3(0.08283F, 0.31418F, 0.06681F), new Vector3(11.83692F, 314.669F, 281.4625F), new Vector3(0.09226F, 0.09226F, 0.09226F));
            };

            GameObject debuffedVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Death Ceremony/MarkedVFX.prefab");
            GameObject vfxOrigin   = debuffedVFX.transform.Find("Origin").gameObject;

            vfxOrigin.transform.localScale *= 3f;
            CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = debuffedVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>();
            RotateAroundAxis rotateAroundAxis = vfxOrigin.gameObject.AddComponent <RotateAroundAxis>();

            rotateAroundAxis.relativeTo        = Space.Self;
            rotateAroundAxis.rotateAroundAxis  = RotateAroundAxis.RotationAxis.X;
            rotateAroundAxis.fastRotationSpeed = 17f;
            rotateAroundAxis.speed             = RotateAroundAxis.Speed.Fast;
            rotateAroundAxis                   = vfxOrigin.gameObject.AddComponent <RotateAroundAxis>();
            rotateAroundAxis.relativeTo        = Space.Self;
            rotateAroundAxis.rotateAroundAxis  = RotateAroundAxis.RotationAxis.Z;
            rotateAroundAxis.fastRotationSpeed = 34f;
            rotateAroundAxis.speed             = RotateAroundAxis.Speed.Fast;
            ObjectScaleCurve fadeOut = vfxOrigin.AddComponent <ObjectScaleCurve>();

            fadeOut.overallCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(-20f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 0f, Mathf.Tan(160f * Mathf.Deg2Rad), 0f)
                }
            };
            fadeOut.useOverallCurveOnly = true;
            fadeOut.enabled             = false;
            fadeOut.timeMax             = 0.2f;
            tempVFX.exitBehaviours      = new MonoBehaviour[]
            {
                fadeOut
            };
            ObjectScaleCurve fadeIn = vfxOrigin.AddComponent <ObjectScaleCurve>();

            fadeIn.overallCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 0f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(70f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 1f, Mathf.Tan(-160f * Mathf.Deg2Rad), 0f)
                }
            };
            fadeIn.useOverallCurveOnly = true;
            fadeIn.enabled             = false;
            fadeIn.timeMax             = 0.2f;
            tempVFX.enterBehaviours    = new MonoBehaviour[]
            {
                fadeIn
            };
            CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo
            {
                prefab    = debuffedVFX,
                condition = (x) =>
                {
                    var component = x.GetComponent <MysticsItemsDeathCeremonyMark>();
                    if (component)
                    {
                        return(component.markTimer > 0f);
                    }
                    return(false);
                },
                radius = CustomTempVFXManagement.DefaultRadiusCall
            });

            damageShareOrbEffect = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Death Ceremony/DeathCeremonyOrbEffect.prefab");
            EffectComponent effectComponent = damageShareOrbEffect.AddComponent <EffectComponent>();

            effectComponent.positionAtReferencedTransform = false;
            effectComponent.parentToReferencedTransform   = false;
            effectComponent.applyScale = true;
            VFXAttributes vfxAttributes = damageShareOrbEffect.AddComponent <VFXAttributes>();

            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Low;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            OrbEffect orbEffect = damageShareOrbEffect.AddComponent <OrbEffect>();

            orbEffect.startVelocity1 = new Vector3(-10f, 0f, -10f);
            orbEffect.startVelocity2 = new Vector3(-10f, 10f, 10f);
            orbEffect.endVelocity1   = new Vector3(-10f, 0f, -10f);
            orbEffect.endVelocity2   = new Vector3(10f, 10f, 10f);
            orbEffect.movementCurve  = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 0f),
                    new Keyframe(1f, 1f)
                },
                preWrapMode  = WrapMode.Clamp,
                postWrapMode = WrapMode.Clamp
            };
            orbEffect.faceMovement = true;
            orbEffect.callArrivalIfTargetIsGone = false;
            DestroyOnTimer destroyOnTimer = damageShareOrbEffect.transform.Find("Trail").gameObject.AddComponent <DestroyOnTimer>();

            destroyOnTimer.duration = 0.5f;
            destroyOnTimer.enabled  = false;
            MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsOrbEffectOnArrivalDefaults onArrivalDefaults = damageShareOrbEffect.AddComponent <MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsOrbEffectOnArrivalDefaults>();
            onArrivalDefaults.orbEffect = orbEffect;
            onArrivalDefaults.transformsToUnparentChildren = new Transform[] {
                damageShareOrbEffect.transform
            };
            onArrivalDefaults.componentsToEnable = new MonoBehaviour[]
            {
                destroyOnTimer
            };
            MysticsItemsContent.Resources.effectPrefabs.Add(damageShareOrbEffect);

            CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal;
            GenericGameEvents.OnHitEnemy    += GenericGameEvents_OnHitEnemy;

            R2API.RecalculateStatsAPI.GetStatCoefficients += RecalculateStatsAPI_GetStatCoefficients;
        }
Пример #12
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration     = this.baseDuration / this.attackSpeedStat;
            this.animator     = base.GetModelAnimator();
            this.childLocator = base.GetModelChildLocator();

            if (this.childLocator)
            {
                Transform transform = this.childLocator.FindChild("HandL");

                if (transform && this.chargeEffectPrefab)
                {
                    this.chargeEffectInstance = UnityEngine.Object.Instantiate <GameObject>(this.chargeEffectPrefab, transform.position, transform.rotation);
                    this.chargeEffectInstance.transform.parent = transform;

                    ScaleParticleSystemDuration scaleParticleSystemDuration = this.chargeEffectInstance.GetComponent <ScaleParticleSystemDuration>();
                    ObjectScaleCurve            scaleCurve = this.chargeEffectInstance.GetComponent <ObjectScaleCurve>();

                    if (scaleParticleSystemDuration)
                    {
                        scaleParticleSystemDuration.newDuration = this.duration;
                    }
                    if (scaleCurve)
                    {
                        scaleCurve.timeMax = this.duration;
                    }
                }
            }

            this.PlayChannelAnimation();
            this.loopSoundInstanceId    = Util.PlayAttackSpeedSound(this.chargeSoundString, base.gameObject, this.attackSpeedStat);
            this.defaultCrosshairPrefab = base.characterBody.crosshairPrefab;

            if (this.crosshairOverridePrefab)
            {
                base.characterBody.crosshairPrefab = this.crosshairOverridePrefab;
            }

            if (NetworkServer.active)
            {
                base.characterBody.AddBuff(RoR2Content.Buffs.Slow50);
            }

            if (EntityStates.Huntress.ArrowRain.areaIndicatorPrefab)
            {
                this.areaIndicatorInstance = UnityEngine.Object.Instantiate <GameObject>(EntityStates.Huntress.ArrowRain.areaIndicatorPrefab);
                this.areaIndicatorInstance.transform.localScale = Vector3.zero;

                if (this.overrideAreaIndicatorMat)
                {
                    this.areaIndicatorInstance.GetComponentInChildren <MeshRenderer>().material = this.overrideAreaIndicatorMat;
                }
            }

            if (this.zooming)
            {
                this.defaultCameraParams             = base.cameraTargetParams.cameraParams;
                base.cameraTargetParams.cameraParams = Modules.CameraParams.channelCameraParamsPaladin;
            }
        }
Пример #13
0
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_DroneWires";
            SetItemTierWhenAvailable(ItemTier.Tier2);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Damage,
                ItemTag.CannotCopy
            };

            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Wires/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Wires/Icon.png");
            itemDisplayPrefab         = PrepareItemDisplayModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Wires/DisplayModel.prefab"));
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Chest", new Vector3(-0.0882F, 0.29957F, 0.10621F), new Vector3(24.65009F, 16.77799F, 135.6651F), new Vector3(0.07763F, 0.07608F, 0.09464F));
                AddDisplayRule("HuntressBody", "Chest", new Vector3(0.11016F, 0.19166F, 0.06043F), new Vector3(3.66903F, 357.0302F, 46.24356F), new Vector3(0.06181F, 0.06181F, 0.07285F));
                AddDisplayRule("Bandit2Body", "Chest", new Vector3(0.02937F, 0.2926F, -0.00376F), new Vector3(0F, 0F, 49.27628F), new Vector3(0.06534F, 0.07626F, 0.07902F));
                AddDisplayRule("ToolbotBody", "Chest", new Vector3(-0.44676F, 0.83563F, -0.35079F), new Vector3(0F, 255.7838F, 12.94845F), new Vector3(0.29993F, 0.29993F, 0.29993F));
                AddDisplayRule("EngiBody", "Chest", new Vector3(0.12126F, 0.34647F, 0.02248F), new Vector3(9.43959F, 353.3998F, 54.79713F), new Vector3(0.08793F, 0.10983F, 0.12737F));
                //AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.035F, 0.89075F, -1.47928F), new Vector3(0F, 90F, 303.695F), new Vector3(0.07847F, 0.07847F, 0.07847F));
                //AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.03562F, 1.40676F, -1.39837F), new Vector3(0F, 90F, 303.1705F), new Vector3(0.08093F, 0.09844F, 0.07912F));
                AddDisplayRule("MageBody", "Chest", new Vector3(0.04831F, 0.18725F, -0.00428F), new Vector3(0F, 0F, 60.53666F), new Vector3(0.07311F, 0.07311F, 0.06881F));
                AddDisplayRule("MercBody", "Chest", new Vector3(-0.05362F, 0.21034F, -0.00002F), new Vector3(0F, 0F, 117.922F), new Vector3(0.0773F, 0.0773F, 0.10484F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(0.17759F, 1.01678F, -0.22692F), new Vector3(343.6147F, 91.47517F, 0F), new Vector3(0.12892F, 0.22446F, 0.19628F));
                AddDisplayRule("LoaderBody", "Chest", new Vector3(0.2286F, 0.17001F, -0.14346F), new Vector3(0F, 0F, 101.2838F), new Vector3(0.07407F, 0.07407F, 0.07407F));
                AddDisplayRule("CrocoBody", "Neck", new Vector3(-0.44025F, 2.13047F, -1.0941F), new Vector3(11.69976F, 267.5576F, 69.92433F), new Vector3(0.78301F, 0.82242F, 0.76275F));
                AddDisplayRule("CaptainBody", "Chest", new Vector3(0.11944F, 0.24645F, 0.02558F), new Vector3(0F, 0F, 56.89931F), new Vector3(0.11927F, 0.11927F, 0.09405F));
                AddDisplayRule("BrotherBody", "chest", BrotherInfection.green, new Vector3(-0.02217F, 0.1268F, 0.00908F), new Vector3(38.70592F, 101.3755F, 273.0802F), new Vector3(0.29321F, 0.2044F, 0.2044F));
                AddDisplayRule("ScavBody", "Chest", new Vector3(-0.60161F, 5.1633F, -0.70479F), new Vector3(8.51487F, 288.6277F, 143.041F), new Vector3(1.72129F, 2.93378F, 2.41413F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.04666F, 0.03688F, -0.20783F), new Vector3(20.30298F, 90F, 90F), new Vector3(0.03316F, 0.03316F, 0.03316F));
                }
                AddDisplayRule("RailgunnerBody", "Backpack", new Vector3(0.00133F, -0.09389F, 0.00001F), new Vector3(359.581F, 90F, 90F), new Vector3(0.0655F, 0.0655F, 0.0655F));
                AddDisplayRule("VoidSurvivorBody", "Stomach", new Vector3(0.01209F, -0.01038F, -0.0797F), new Vector3(0F, 90F, 0F), new Vector3(0.03917F, 0.07464F, 0.0609F));
            };

            On.RoR2.CharacterBody.OnInventoryChanged += CharacterBody_OnInventoryChanged;

            MysticsRisky2Utils.Utils.CopyChildren(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Wires/SparkProjectile.prefab"), sparkProjectilePrefab);

            float sparkDuration = 4f;

            ProjectileController projectileController = sparkProjectilePrefab.AddComponent <ProjectileController>();

            projectileController.ghostPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Wires/SparkProjectileGhost.prefab");
            projectileController.ghostPrefab.AddComponent <ProjectileGhostController>();
            ObjectScaleCurve objectScaleCurve = projectileController.ghostPrefab.AddComponent <ObjectScaleCurve>();

            objectScaleCurve.overallCurve        = AnimationCurve.Linear(0f, 1f, 1f, 0f);
            objectScaleCurve.useOverallCurveOnly = true;
            objectScaleCurve.timeMax             = sparkDuration;
            projectileController.allowPrediction = true;
            sparkProjectilePrefab.AddComponent <ProjectileNetworkTransform>();
            sparkProjectilePrefab.AddComponent <TeamFilter>();
            ProjectileDamage projectileDamage = sparkProjectilePrefab.AddComponent <ProjectileDamage>();
            HitBoxGroup      hitBoxGroup      = sparkProjectilePrefab.AddComponent <HitBoxGroup>();

            hitBoxGroup.groupName = "MysticsItems_DroneWiresSpark";
            hitBoxGroup.hitBoxes  = new HitBox[]
            {
                sparkProjectilePrefab.transform.Find("HitBox").gameObject.AddComponent <HitBox>()
            };
            ProjectileSimple projectileSimple = sparkProjectilePrefab.AddComponent <ProjectileSimple>();

            projectileSimple.desiredForwardSpeed = 14f;
            projectileSimple.lifetime            = sparkDuration;
            ProjectileOverlapAttack projectileOverlapAttack = sparkProjectilePrefab.AddComponent <ProjectileOverlapAttack>();

            projectileOverlapAttack.damageCoefficient      = 1f;
            projectileOverlapAttack.overlapProcCoefficient = procCoefficient;
            projectileOverlapAttack.resetInterval          = 0.5f;
            sparkProjectilePrefab.layer = LayerIndex.projectile.intVal;

            MysticsItemsContent.Resources.projectilePrefabs.Add(sparkProjectilePrefab);

            {
                hitVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Wires/SparkHitVFX.prefab");
                var effectComponent = hitVFX.AddComponent <EffectComponent>();
                effectComponent.soundName  = "MysticsItems_Play_item_proc_droneWires";
                effectComponent.applyScale = true;
                var vfxAttributes = hitVFX.AddComponent <VFXAttributes>();
                vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
                vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
                hitVFX.AddComponent <DestroyOnTimer>().duration = 1f;

                MysticsItemsContent.Resources.effectPrefabs.Add(hitVFX);

                projectileOverlapAttack.impactEffect = hitVFX;
            }
        }
Пример #14
0
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_RiftLens";
            SetItemTierWhenAvailable(ItemTier.Lunar);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Utility,
                ItemTag.AIBlacklist,
                ItemTag.CannotCopy,
                ItemTag.OnStageBeginEffect
            };
            MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef());
            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Rift Lens/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Rift Lens/Icon.png");
            ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>();

            modelPanelParams.minDistance = 2;
            modelPanelParams.maxDistance = 6;
            itemDisplayPrefab            = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Head", new Vector3(0.1f, 0.25f, 0.15f), new Vector3(20f, 210f, 0f), new Vector3(0.06f, 0.06f, 0.06f));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.0009F, 0.2635F, 0.1117F), new Vector3(0F, 180F, 0F), new Vector3(0.03F, 0.03F, 0.03F));
                AddDisplayRule("Bandit2Body", "Head", new Vector3(0F, 0.057F, 0.135F), new Vector3(0F, 180F, 180F), new Vector3(0.028F, 0.028F, 0.028F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(0.409F, 3.049F, -1.067F), new Vector3(60F, 0F, 180F), new Vector3(0.3F, 0.3F, 0.3F));
                AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0.098F, 0.019F, 0.127F), new Vector3(1.506F, 213.327F, 354.045F), new Vector3(0.029F, 0.029F, 0.029F));
                AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.005F, 0.525F, 2.043F), new Vector3(0F, 180F, 0F), new Vector3(0.108F, 0.083F, 0.083F));
                AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.006F, 0.774F, 0.853F), new Vector3(0F, 177.859F, 0F), new Vector3(0.306F, 0.306F, 0.306F));
                AddDisplayRule("MageBody", "Head", new Vector3(0.048F, 0.06F, 0.117F), new Vector3(13.941F, 189.822F, 2.364F), new Vector3(0.026F, 0.026F, 0.026F));
                AddDisplayRule("MercBody", "Head", new Vector3(0.05F, 0.156F, 0.151F), new Vector3(10.716F, 202.078F, 355.897F), new Vector3(0.053F, 0.053F, 0.053F));
                AddDisplayRule("TreebotBody", "HeadCenter", new Vector3(-0.005F, 0.058F, -0.002F), new Vector3(85.226F, 270F, 270F), new Vector3(0.098F, 0.098F, 0.098F));
                AddDisplayRule("LoaderBody", "Head", new Vector3(0.051F, 0.125F, 0.134F), new Vector3(10.267F, 205.465F, 354.736F), new Vector3(0.047F, 0.04F, 0.048F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(-1.531F, 1.934F, 0.459F), new Vector3(14.526F, 104.513F, 346.531F), new Vector3(0.236F, 0.236F, 0.236F));
                AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.085F, 0.108F, 0.013F), new Vector3(69.075F, 70.114F, 350.542F), new Vector3(0.026F, 0.03F, 0.042F));
                AddDisplayRule("BrotherBody", "Head", BrotherInfection.blue, new Vector3(0.003F, -0.01F, 0.061F), new Vector3(349.888F, 70.121F, 339.729F), new Vector3(0.133F, 0.133F, 0.133F));
                AddDisplayRule("ScavBody", "Head", new Vector3(5.068F, 4.15F, -0.55F), new Vector3(46.576F, 301.45F, 310.155F), new Vector3(1.363F, 1.363F, 1.363F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "GunBarrel", new Vector3(0.00002F, 0.07266F, -0.32569F), new Vector3(0F, 180F, 0F), new Vector3(0.02325F, 0.02325F, 0.02325F));
                }
                AddDisplayRule("RailgunnerBody", "GunScope", new Vector3(-0.07466F, -0.14553F, 0.31781F), new Vector3(0F, 180F, 0F), new Vector3(0.02909F, 0.02909F, 0.02909F));
                AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(0.00001F, 0.17385F, 0.09392F), new Vector3(58.31651F, 180F, 180F), new Vector3(0.03831F, 0.03831F, 0.03831F));
            };

            MysticsItemsRiftChest component = riftChest.AddComponent <MysticsItemsRiftChest>();

            SfxLocator sfxLocator = riftChest.AddComponent <SfxLocator>();

            sfxLocator.openSound = "Play_env_riftchest_open";

            riftChest.AddComponent <GenericDisplayNameProvider>().displayToken = "MYSTICSITEMS_RIFTCHEST_NAME";

            PurchaseInteraction purchaseInteraction = riftChest.AddComponent <PurchaseInteraction>();

            purchaseInteraction.displayNameToken = "MYSTICSITEMS_RIFTCHEST_NAME";
            purchaseInteraction.contextToken     = "MYSTICSITEMS_RIFTCHEST_CONTEXT";

            ChestBehavior chestBehavior = riftChest.AddComponent <ChestBehavior>();

            chestBehavior.dropTable = Addressables.LoadAssetAsync <PickupDropTable>("RoR2/Base/Chest1/dtChest1.asset").WaitForCompletion();

            riftChest.transform.Find("InteractionCollider").gameObject.AddComponent <EntityLocator>().entity = riftChest;

            riftChest.transform.Find("RiftOrigin/Sprite").gameObject.AddComponent <Billboard>();

            ObjectScaleCurve objectScaleCurve = riftChest.transform.Find("RiftOrigin").gameObject.AddComponent <ObjectScaleCurve>();

            objectScaleCurve.useOverallCurveOnly = true;
            objectScaleCurve.overallCurve        = new AnimationCurve()
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f),
                    new Keyframe(1f, 0f)
                }
            };
            objectScaleCurve.timeMax = 0.5f;
            objectScaleCurve.enabled = false;

            //post processing
            GameObject ppHolder = Object.Instantiate(PrefabAPI.InstantiateClone(new GameObject("RiftLensPostProcessing"), "RiftLensPostProcessing", false), riftChest.transform);

            ppHolder.layer = LayerIndex.postProcess.intVal;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.isGlobal      = false;
            pp.weight        = 1f;
            pp.priority      = 50;
            pp.blendDistance = 10f;
            SphereCollider sphereCollider = ppHolder.AddComponent <SphereCollider>();

            sphereCollider.radius    = 5f;
            sphereCollider.isTrigger = true;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

            ppProfile.name = "ppRiftLens";
            LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>();

            lensDistortion.SetAllOverridesTo(true);
            lensDistortion.intensity.value = -30f;
            lensDistortion.scale.value     = 1f;
            ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>();

            colorGrading.colorFilter.value         = new Color32(178, 242, 255, 255);
            colorGrading.colorFilter.overrideState = true;
            pp.sharedProfile = ppProfile;
            PostProcessDuration ppDuration = pp.gameObject.AddComponent <PostProcessDuration>();

            ppDuration.ppVolume      = pp;
            ppDuration.ppWeightCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f, 0f, Mathf.Tan(-45f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 0f, Mathf.Tan(135f * Mathf.Deg2Rad), 0f)
                },
                preWrapMode  = WrapMode.Clamp,
                postWrapMode = WrapMode.Clamp
            };
            ppDuration.maxDuration  = 1;
            ppDuration.destroyOnEnd = true;
            ppDuration.enabled      = false;
            component.ppDuration    = ppDuration;

            riftChestSpawnCard      = ScriptableObject.CreateInstance <InteractableSpawnCard>();
            riftChestSpawnCard.name = "iscMysticsItems_UnstableRift";
            riftChestSpawnCard.directorCreditCost = 0;
            riftChestSpawnCard.forbiddenFlags     = NodeFlags.NoChestSpawn;
            riftChestSpawnCard.hullSize           = HullClassification.Human;
            riftChestSpawnCard.nodeGraphType      = MapNodeGroup.GraphType.Ground;
            riftChestSpawnCard.occupyPosition     = true;
            riftChestSpawnCard.orientToFloor      = false;
            riftChestSpawnCard.sendOverNetwork    = true;
            riftChestSpawnCard.prefab             = riftChest;

            GenericGameEvents.OnPopulateScene += (rng) =>
            {
                int riftsToSpawn = 0;
                foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList)
                {
                    if (characterMaster.teamIndex == TeamIndex.Player)
                    {
                        int thisItemCount = characterMaster.inventory.GetItemCount(itemDef);
                        if (thisItemCount > 0)
                        {
                            characterMaster.inventory.RemoveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, characterMaster.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff));
                            characterMaster.inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, baseRifts + riftsPerStack * (thisItemCount - 1));
                            riftsToSpawn += baseRifts.Value + riftsPerStack.Value * (thisItemCount - 1);
                        }
                    }
                }
                if (riftsToSpawn > 0)
                {
                    for (int i = 0; i < riftsToSpawn; i++)
                    {
                        GameObject riftChest = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(riftChestSpawnCard, new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.Random
                        }, rng));
                    }
                }
                MysticsItemsRiftLensBehaviour.CalculateCountdownForAll();
            };

            On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) =>
            {
                orig(self);
                self.AddItemBehavior <MysticsItemsRiftLensBehaviour>(self.inventory.GetItemCount(itemDef));
            };

            ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources;

            hudPanelPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/UI/HudModules/HudCountdownPanel"), "RiftLensHUDPanel");
            hudPanelPrefab.transform.Find("Juice/Container/CountdownTitleLabel").GetComponent <LanguageTextMeshController>().token = "OBJECTIVE_MYSTICSITEMS_RIFTLENS_FLAVOUR";
            var col = new Color32(0, 157, 255, 255);

            hudPanelPrefab.transform.Find("Juice/Container/Border").GetComponent <Image>().color = col;
            hudPanelPrefab.transform.Find("Juice/Container/CountdownLabel").GetComponent <HGTextMeshProUGUI>().color = col;

            PositionIndicator positionIndicator = riftPositionIndicator.AddComponent <PositionIndicator>();

            positionIndicator.insideViewObject              = riftPositionIndicator.transform.Find("InsideFrame").gameObject;
            positionIndicator.outsideViewObject             = riftPositionIndicator.transform.Find("OutsideFrame").gameObject;
            positionIndicator.alwaysVisibleObject           = riftPositionIndicator.transform.Find("Sprite").gameObject;
            positionIndicator.shouldRotateOutsideViewObject = true;
            positionIndicator.outsideViewRotationOffset     = 90f;

            GenericGameEvents.OnPlayerCharacterDeath += GenericGameEvents_OnPlayerCharacterDeath;
        }
Пример #15
0
        public override void OnLoad()
        {
            buffDef.name       = "MysticsItems_Deafened";
            buffDef.buffColor  = new Color32(255, 195, 112, 255);
            buffDef.isDebuff   = true;
            buffDef.iconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Buffs/Deafened.png");

            Equipment.Microphone.buffDef = buffDef;

            R2API.RecalculateStatsAPI.GetStatCoefficients += RecalculateStatsAPI_GetStatCoefficients;

            GameObject debuffedVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/DeafenedVFX.prefab");
            GameObject vfxOrigin   = debuffedVFX.transform.Find("Origin").gameObject;

            CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = debuffedVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>();
            RotateAroundAxis rotateAroundAxis = vfxOrigin.transform.Find("Ring").gameObject.AddComponent <RotateAroundAxis>();

            rotateAroundAxis.relativeTo        = Space.Self;
            rotateAroundAxis.rotateAroundAxis  = RotateAroundAxis.RotationAxis.X;
            rotateAroundAxis.fastRotationSpeed = 100f;
            rotateAroundAxis.speed             = RotateAroundAxis.Speed.Fast;
            rotateAroundAxis                   = vfxOrigin.transform.Find("Ring (1)").gameObject.AddComponent <RotateAroundAxis>();
            rotateAroundAxis.relativeTo        = Space.Self;
            rotateAroundAxis.rotateAroundAxis  = RotateAroundAxis.RotationAxis.Z;
            rotateAroundAxis.fastRotationSpeed = 50f;
            rotateAroundAxis.speed             = RotateAroundAxis.Speed.Fast;
            ObjectScaleCurve fadeOut = vfxOrigin.AddComponent <ObjectScaleCurve>();

            fadeOut.overallCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(-20f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 0f, Mathf.Tan(160f * Mathf.Deg2Rad), 0f)
                }
            };
            fadeOut.useOverallCurveOnly = true;
            fadeOut.enabled             = false;
            fadeOut.timeMax             = 0.6f;
            tempVFX.exitBehaviours      = new MonoBehaviour[]
            {
                fadeOut
            };
            ObjectScaleCurve fadeIn = vfxOrigin.AddComponent <ObjectScaleCurve>();

            fadeIn.overallCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 0f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(70f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 1f, Mathf.Tan(-160f * Mathf.Deg2Rad), 0f)
                }
            };
            fadeIn.useOverallCurveOnly = true;
            fadeIn.enabled             = false;
            fadeIn.timeMax             = 0.6f;
            tempVFX.enterBehaviours    = new MonoBehaviour[]
            {
                fadeIn
            };
            CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo
            {
                prefab    = debuffedVFX,
                condition = (x) => x.HasBuff(buffDef),
                radius    = CustomTempVFXManagement.DefaultRadiusCall
            });
        }