public void Awake() { holdoutZoneController = GetComponent <HoldoutZoneController>(); animationCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 0f), new Keyframe(0.5f, 1f), new Keyframe(1f, 0f) }, preWrapMode = WrapMode.Clamp, postWrapMode = WrapMode.Clamp }; sphereSearch = new SphereSearch { mask = LayerIndex.entityPrecise.mask, origin = transform.position, queryTriggerInteraction = QueryTriggerInteraction.Collide, radius = 0f }; teamMask = TeamMask.AllExcept(TeamIndex.Player); }
private static void FixLunarTp() { GameObject lunarTeleporter = Resources.Load <GameObject>("prefabs/networkedobjects/TeleporterLunar"); GameObject teleporter = Resources.Load <GameObject>("prefabs/networkedobjects/Teleporter1"); TeleporterInteraction lunarInteraction = lunarTeleporter.GetComponent <TeleporterInteraction>(); HoldoutZoneController teleporterZoneController = teleporter.GetComponent <HoldoutZoneController>(); HoldoutZoneController lunarZoneController = lunarTeleporter.AddComponent <HoldoutZoneController>(); OutsideInteractableLocker lunarInteractableLocker = lunarTeleporter.AddComponent <OutsideInteractableLocker>(); EntityStateMachine lunarStateMachine = lunarTeleporter.AddComponent <EntityStateMachine>(); EntityStateMachine stateMachine = teleporter.GetComponent <EntityStateMachine>(); LanguageAPI.Add("TELEPORTERLUNAR_HOLDOUT_TOKEN", "Observe."); lunarZoneController.baseChargeDuration = teleporterZoneController.baseChargeDuration; lunarZoneController.baseRadius = 100000; lunarZoneController.inBoundsObjectiveToken = "TELEPORTERLUNAR_HOLDOUT_TOKEN"; lunarZoneController.outOfBoundsObjectiveToken = teleporterZoneController.outOfBoundsObjectiveToken; lunarZoneController.radiusIndicator = null; lunarZoneController.radiusSmoothTime = teleporterZoneController.radiusSmoothTime; lunarZoneController.enabled = true; lunarInteractableLocker.updateInterval = 0.1f; lunarInteractableLocker.lockPrefab = Resources.Load <GameObject>("prefabs/networkedobjects/PurchaseLock"); lunarStateMachine.customName = "Main"; lunarStateMachine.initialStateType = stateMachine.initialStateType; lunarStateMachine.mainStateType = stateMachine.mainStateType; lunarStateMachine.commonComponents = stateMachine.commonComponents; lunarStateMachine.networkIndex = -1; lunarInteraction.mainStateMachine = lunarStateMachine; lunarInteraction.outsideInteractableLocker = lunarInteractableLocker; foreach (CombatDirector combatDirector in lunarTeleporter.GetComponents <CombatDirector>()) { if (combatDirector.customName == "Monsters") { combatDirector.expRewardCoefficient = 0.1f; combatDirector.minSeriesSpawnInterval = 0.5f; combatDirector.maxSeriesSpawnInterval = 0.5f; combatDirector.minRerollSpawnInterval = 2; combatDirector.maxRerollSpawnInterval = 4; combatDirector.creditMultiplier = 6; combatDirector.spawnDistanceMultiplier = 1.5f; combatDirector.shouldSpawnOneWave = false; combatDirector.targetPlayers = true; combatDirector.skipSpawnIfTooCheap = true; combatDirector.resetMonsterCardIfFailed = true; combatDirector.maximumNumberToSpawnBeforeSkipping = 6; combatDirector.eliteBias = 2; } else if (combatDirector.customName == "Boss") { } } }
public void Start() { holdoutZoneController = GetComponent <HoldoutZoneController>(); if (NetworkServer.active) { ShouldBeActive = false; rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); if (dropTable) { dropPickup = dropTable.GenerateDrop(rng); } } else { new RequestZoneShouldBeActive(gameObject.GetComponent <NetworkIdentity>().netId).Send(NetworkDestination.Server); } holdoutZoneController.onCharged = new HoldoutZoneController.HoldoutZoneControllerChargedUnityEvent(); holdoutZoneController.onCharged.AddListener(zone => Unearth()); instance = this; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_TreasureMap"; SetItemTierWhenAvailable(ItemTier.Tier3); itemDef.tags = new ItemTag[] { ItemTag.Utility, ItemTag.AIBlacklist, ItemTag.CannotCopy }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Treasure Map/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Treasure Map/Icon.png"); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 3; modelPanelParams.maxDistance = 6; itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "LowerArmR", new Vector3(-0.084F, 0.183F, -0.006F), new Vector3(83.186F, 36.557F, 131.348F), new Vector3(0.053F, 0.053F, 0.053F)); AddDisplayRule("HuntressBody", "Muzzle", new Vector3(-0.527F, -0.032F, -0.396F), new Vector3(0.509F, 134.442F, 184.268F), new Vector3(0.042F, 0.042F, 0.042F)); AddDisplayRule("Bandit2Body", "MuzzleShotgun", new Vector3(0.014F, -0.07F, -0.668F), new Vector3(0F, 180F, 180F), new Vector3(0.04F, 0.04F, 0.04F)); AddDisplayRule("ToolbotBody", "Head", new Vector3(0.198F, 3.655F, -0.532F), new Vector3(304.724F, 180F, 180F), new Vector3(0.448F, 0.448F, 0.448F)); AddDisplayRule("EngiBody", "WristDisplay", new Vector3(0.01F, -0.001F, 0.007F), new Vector3(86.234F, 155.949F, 155.218F), new Vector3(0.065F, 0.065F, 0.065F)); AddDisplayRule("MageBody", "LowerArmR", new Vector3(0.116F, 0.188F, 0.008F), new Vector3(88.872F, 20.576F, 290.58F), new Vector3(0.074F, 0.074F, 0.074F)); AddDisplayRule("MercBody", "LowerArmR", new Vector3(-0.01F, 0.144F, -0.116F), new Vector3(277.017F, 64.808F, 295.358F), new Vector3(0.072F, 0.072F, 0.072F)); AddDisplayRule("TreebotBody", "HeadBase", new Vector3(-0.013F, 0.253F, -0.813F), new Vector3(1.857F, 5.075F, 0.053F), new Vector3(0.13F, 0.143F, 0.294F)); AddDisplayRule("LoaderBody", "MechLowerArmR", new Vector3(-0.01F, 0.544F, -0.144F), new Vector3(275.35F, 95.995F, 266.284F), new Vector3(0.095F, 0.095F, 0.095F)); AddDisplayRule("CrocoBody", "UpperArmR", new Vector3(1.735F, -0.575F, 0.196F), new Vector3(281.472F, 180.072F, 89.927F), new Vector3(0.868F, 0.868F, 0.868F)); AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.066F, 0.087F, 0.011F), new Vector3(76.759F, 135.292F, 224.52F), new Vector3(0.059F, 0.053F, 0.059F)); AddDisplayRule("BrotherBody", "HandR", BrotherInfection.red, new Vector3(0.051F, -0.072F, 0.004F), new Vector3(44.814F, 122.901F, 267.545F), new Vector3(0.063F, 0.063F, 0.063F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Chest", new Vector3(-0.10307F, 0.44329F, -0.26101F), new Vector3(0F, 0F, 0F), new Vector3(0.05402F, 0.05402F, 0.05402F)); } AddDisplayRule("RailgunnerBody", "GunRoot", new Vector3(0.00726F, -0.15201F, 0.07672F), new Vector3(270F, 180F, 0F), new Vector3(0.05025F, 0.05025F, 0.05025F)); AddDisplayRule("VoidSurvivorBody", "ForeArmL", new Vector3(0.06352F, 0.24419F, 0.00664F), new Vector3(69.26795F, 34.44471F, 302.5876F), new Vector3(0.05926F, 0.05926F, 0.05926F)); }; MysticsRisky2Utils.Utils.CopyChildren(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Treasure Map/TreasureMapZone.prefab"), zonePrefab); HoldoutZoneController holdoutZone = zonePrefab.AddComponent <HoldoutZoneController>(); holdoutZone.baseRadius = radius; holdoutZone.baseChargeDuration = unearthTime; holdoutZone.radiusSmoothTime = 1f; holdoutZone.radiusIndicator = zonePrefab.transform.Find("Visuals/Sphere").gameObject.GetComponent <Renderer>(); holdoutZone.inBoundsObjectiveToken = "OBJECTIVE_MYSTICSITEMS_CHARGE_TREASUREMAPZONE"; holdoutZone.outOfBoundsObjectiveToken = "OBJECTIVE_MYSTICSITEMS_CHARGE_TREASUREMAPZONE_OOB"; holdoutZone.applyHealingNova = true; holdoutZone.applyFocusConvergence = true; holdoutZone.playerCountScaling = 0f; // Charge by 1 second regardless of how many players are charging the zone holdoutZone.dischargeRate = 0f; holdoutZone.enabled = false; MysticsItemsTreasureMapZone captureZone = zonePrefab.AddComponent <MysticsItemsTreasureMapZone>(); captureZone.itemDef = itemDef; captureZone.dropTable = Addressables.LoadAssetAsync <PickupDropTable>("RoR2/Base/GoldChest/dtGoldChest.asset").WaitForCompletion(); captureZone.dropTransform = zonePrefab.transform.Find("DropPivot"); HologramProjector hologramProjector = zonePrefab.AddComponent <HologramProjector>(); hologramProjector.displayDistance = holdoutZone.baseRadius; hologramProjector.hologramPivot = zonePrefab.transform.Find("HologramPivot"); hologramProjector.hologramPivot.transform.localScale *= 2f; hologramProjector.disableHologramRotation = false; captureZone.hologramProjector = hologramProjector; Decal decal = zonePrefab.transform.Find("Decal").gameObject.AddComponent <Decal>(); decal.RenderMode = Decal.DecalRenderMode.Deferred; Material decalMaterial = new Material(LegacyShaderAPI.Find("Decalicious/Deferred Decal")); decal.Material = decalMaterial; decalMaterial.name = "MysticsItems_TreasureMapDecal"; Texture decalTexture = Main.AssetBundle.LoadAsset <Texture>("Assets/Items/Treasure Map/texTreasureMapDecal.png"); decalMaterial.SetTexture("_MainTex", decalTexture); decalMaterial.SetTexture("_MaskTex", decalTexture); decalMaterial.SetFloat("_AngleLimit", 0.6f); decalMaterial.SetFloat("_DecalLayer", 1f); decalMaterial.SetFloat("_DecalBlendMode", 0f); decalMaterial.SetColor("_Color", new Color32(70, 10, 10, 255)); decalMaterial.SetColor("_EmissionColor", Color.black); decal.Fade = 1f; decal.DrawAlbedo = true; decal.UseLightProbes = true; decal.DrawNormalAndGloss = false; decal.HighQualityBlending = false; { decal.GetComponent <MeshFilter>().sharedMesh = LegacyResourcesAPI.Load <Mesh>("DecalCube"); MeshRenderer component = decal.GetComponent <MeshRenderer>(); component.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; component.receiveShadows = false; component.materials = new Material[0]; component.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes; component.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; } decal.gameObject.transform.localScale = Vector3.one * 10f; HG.ArrayUtils.ArrayAppend(ref captureZone.toggleObjects, decal.gameObject); On.RoR2.HoldoutZoneController.ChargeHoldoutZoneObjectiveTracker.ShouldBeFlashing += (orig, self) => { if (self.sourceDescriptor.master) { HoldoutZoneController holdoutZoneController = (HoldoutZoneController)self.sourceDescriptor.source; if (holdoutZoneController && holdoutZoneController.gameObject.GetComponent <MysticsItemsTreasureMapZone>()) { var teleporterInteraction = TeleporterInteraction.instance; if (teleporterInteraction && teleporterInteraction.isCharged) { return(true); } return(false); } } return(orig(self)); }; zoneSpawnCard = ScriptableObject.CreateInstance <SpawnCard>(); zoneSpawnCard.name = "iscMysticsItems_TreasureMapZone"; zoneSpawnCard.prefab = zonePrefab; zoneSpawnCard.directorCreditCost = 0; zoneSpawnCard.sendOverNetwork = true; zoneSpawnCard.hullSize = HullClassification.Human; zoneSpawnCard.nodeGraphType = RoR2.Navigation.MapNodeGroup.GraphType.Ground; zoneSpawnCard.requiredFlags = RoR2.Navigation.NodeFlags.None; zoneSpawnCard.forbiddenFlags = RoR2.Navigation.NodeFlags.None; zoneSpawnCard.occupyPosition = false; GenericGameEvents.OnPopulateScene += (rng) => { DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(zoneSpawnCard, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Random }, rng)); }; ghostMaterial = LegacyResourcesAPI.Load <Material>("Materials/matGhostEffect"); soundEventDef = ScriptableObject.CreateInstance <NetworkSoundEventDef>(); soundEventDef.eventName = "MysticsItems_Play_env_treasuremap"; MysticsItemsContent.Resources.networkSoundEventDefs.Add(soundEventDef); effectPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Treasure Map/UnearthEffect.prefab"); EffectComponent effectComponent = effectPrefab.AddComponent <EffectComponent>(); VFXAttributes vfxAttributes = effectPrefab.AddComponent <VFXAttributes>(); vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium; vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Medium; effectPrefab.AddComponent <DestroyOnTimer>().duration = 1f; ShakeEmitter shakeEmitter = effectPrefab.AddComponent <ShakeEmitter>(); shakeEmitter.shakeOnStart = true; shakeEmitter.shakeOnEnable = false; shakeEmitter.duration = 0.3f; shakeEmitter.radius = 25f; shakeEmitter.scaleShakeRadiusWithLocalScale = false; shakeEmitter.wave = new Wave { amplitude = 3f, frequency = 200f }; shakeEmitter.amplitudeTimeDecay = true; MysticsItemsContent.Resources.effectPrefabs.Add(effectPrefab); TeleporterInteraction.onTeleporterChargedGlobal += TeleporterInteraction_onTeleporterChargedGlobal; }
public void OnFinish(HoldoutZoneController holdoutZone) { EndRound(); }
public void OnFinish(HoldoutZoneController holdoutZone) { this.outer.SetNextState(new RiftCompleteState()); }
public override void OnLoad() { equipmentDef.name = "MysticsItems_SirenPole"; ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Warning System", 90f); equipmentDef.canDrop = true; ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Warning System", false); ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Warning System", false); equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Siren Pole/Model.prefab")); equipmentDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Siren Pole/Icon.png"); foreach (var mat in equipmentDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterials) { HopooShaderToMaterial.Standard.Apply(mat); HopooShaderToMaterial.Standard.Gloss(mat); } itemDisplayPrefab = PrepareItemDisplayModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Siren Pole/ItemDisplayModel.prefab")); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Chest", new Vector3(0.17606F, 0.10938F, -0.13135F), new Vector3(0.29792F, 101.7337F, 14.83983F), new Vector3(0.07862F, 0.07862F, 0.07862F)); AddDisplayRule("HuntressBody", "Head", new Vector3(0.09063F, 0.20626F, -0.04851F), new Vector3(305F, 0F, 0F), new Vector3(0.019F, 0.019F, 0.019F)); AddDisplayRule("HuntressBody", "Head", new Vector3(-0.09086F, 0.20552F, -0.04818F), new Vector3(305F, 0F, 0F), new Vector3(0.019F, 0.019F, 0.019F)); AddDisplayRule("Bandit2Body", "Chest", new Vector3(-0.14208F, 0.31664F, -0.2016F), new Vector3(41.46172F, 268.9803F, 180F), new Vector3(0.0478F, 0.0478F, 0.0478F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(-1.82578F, 2.33771F, -1.55785F), new Vector3(0F, 36.0168F, 0F), new Vector3(0.349F, 0.349F, 0.349F)); AddDisplayRule("EngiBody", "Chest", new Vector3(-0.08444F, 0.34718F, -0.26302F), new Vector3(10.10721F, 23.50117F, 4.36377F), new Vector3(0.047F, 0.047F, 0.047F)); AddDisplayRule("MageBody", "Chest", new Vector3(0.1608F, 0.06538F, -0.13697F), new Vector3(8.71729F, 3.87203F, 0.58771F), new Vector3(0.05396F, 0.05396F, 0.05396F)); AddDisplayRule("MercBody", "HandR", new Vector3(0.17621F, 0.22065F, 0F), new Vector3(0F, 0F, 101.9694F), new Vector3(0.08846F, 0.08846F, 0.08846F)); AddDisplayRule("TreebotBody", "PlatformBase", new Vector3(0.57548F, 1.38046F, -0.57101F), new Vector3(0F, 33.34396F, 0F), new Vector3(0.16617F, 0.16617F, 0.16617F)); AddDisplayRule("LoaderBody", "MechHandL", new Vector3(0.31421F, 0.28839F, 0.14368F), new Vector3(9.63979F, 331.6965F, 84.84715F), new Vector3(0.12826F, 0.12826F, 0.12703F)); AddDisplayRule("CrocoBody", "Head", new Vector3(-4.57107F, 4.06093F, 0.00616F), new Vector3(283.0015F, 97.09286F, 178.9819F), new Vector3(1.08323F, 1.08323F, 1.08323F)); AddDisplayRule("CaptainBody", "Chest", new Vector3(0.26173F, 0.18196F, 0.04468F), new Vector3(0F, 304.076F, 0F), new Vector3(0.09072F, 0.09072F, 0.09072F)); AddDisplayRule("ScavBody", "Backpack", new Vector3(0.93854F, 9.81353F, 0.67947F), new Vector3(23.62728F, 47.52236F, 14.61215F), new Vector3(1.66171F, 1.66171F, 1.66171F)); AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0.00002F, -0.72671F, 0.39234F), new Vector3(47.37738F, -0.00013F, 0.0009F), new Vector3(0.42601F, 0.42601F, 0.42601F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "AntennaL", new Vector3(-0.00958F, 0.16798F, 0.00024F), new Vector3(0F, 91.3699F, 0F), new Vector3(0.0678F, 0.0678F, 0.0678F)); } AddDisplayRule("RailgunnerBody", "Backpack", new Vector3(-0.19222F, -0.15375F, 0.0742F), new Vector3(0F, 90F, 0F), new Vector3(0.09801F, 0.09801F, 0.09801F)); AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(0.47319F, 0.1069F, 0.00462F), new Vector3(-0.00001F, 180F, 259.7787F), new Vector3(0.08856F, 0.09671F, 0.08856F)); }; MysticsItemsSirenPoleController sirenPoleController = inWorldPrefab.AddComponent <MysticsItemsSirenPoleController>(); sirenPoleController.poleTransform = inWorldPrefab.transform.Find("PoleTransform"); HoldoutZoneController holdoutZoneController = inWorldPrefab.AddComponent <HoldoutZoneController>(); holdoutZoneController.baseRadius = baseRadius.Value; holdoutZoneController.baseChargeDuration = chargeTime.Value; holdoutZoneController.radiusSmoothTime = 0.3f; holdoutZoneController.radiusIndicator = inWorldPrefab.transform.Find("RadiusIndicator").gameObject.GetComponent <Renderer>(); holdoutZoneController.inBoundsObjectiveToken = "OBJECTIVE_MYSTICSITEMS_CHARGE_SIRENPOLE"; holdoutZoneController.outOfBoundsObjectiveToken = "OBJECTIVE_MYSTICSITEMS_CHARGE_SIRENPOLE"; holdoutZoneController.applyHealingNova = true; holdoutZoneController.applyFocusConvergence = true; holdoutZoneController.playerCountScaling = 0f; holdoutZoneController.dischargeRate = 0f; holdoutZoneController.enabled = false; sirenPoleController.holdoutZoneController = holdoutZoneController; On.RoR2.HoldoutZoneController.ChargeHoldoutZoneObjectiveTracker.ShouldBeFlashing += (orig, self) => { if (self.sourceDescriptor.master) { HoldoutZoneController holdoutZoneController2 = (HoldoutZoneController)self.sourceDescriptor.source; if (holdoutZoneController2 && holdoutZoneController.gameObject.GetComponent <MysticsItemsSirenPoleController>()) { return(false); } } return(orig(self)); }; CombatDirector phaseCombatDirector = inWorldPrefab.AddComponent <CombatDirector>(); phaseCombatDirector.customName = "WeakMonsters"; phaseCombatDirector.expRewardCoefficient = 0.1f; phaseCombatDirector.minSeriesSpawnInterval = 0.5f; phaseCombatDirector.maxSeriesSpawnInterval = 0.5f; phaseCombatDirector.minRerollSpawnInterval = 2f; phaseCombatDirector.maxRerollSpawnInterval = 4f; phaseCombatDirector.moneyWaveIntervals = new RangeFloat[] { }; phaseCombatDirector.teamIndex = TeamIndex.Monster; phaseCombatDirector.creditMultiplier = 1f; phaseCombatDirector.spawnDistanceMultiplier = 1f; phaseCombatDirector.shouldSpawnOneWave = true; phaseCombatDirector.targetPlayers = false; phaseCombatDirector.skipSpawnIfTooCheap = false; phaseCombatDirector.resetMonsterCardIfFailed = true; phaseCombatDirector.maximumNumberToSpawnBeforeSkipping = 5; phaseCombatDirector.eliteBias = 1f; phaseCombatDirector.ignoreTeamSizeLimit = true; phaseCombatDirector.fallBackToStageMonsterCards = false; phaseCombatDirector.monsterSpawnTimer = 0f; phaseCombatDirector.enabled = false; sirenPoleController.waveCombatDirector = phaseCombatDirector; TeleporterInteraction teleporterInteraction = inWorldPrefab.AddComponent <TeleporterInteraction>(); teleporterInteraction.enabled = false; ShakeEmitter shakeEmitter = inWorldPrefab.AddComponent <ShakeEmitter>(); shakeEmitter.duration = 0.2f; shakeEmitter.amplitudeTimeDecay = true; shakeEmitter.radius = 20f; shakeEmitter.shakeOnStart = true; shakeEmitter.shakeOnEnable = false; shakeEmitter.wave.frequency = 8f; shakeEmitter.wave.amplitude = 5f; shakeEmitter = inWorldPrefab.AddComponent <ShakeEmitter>(); shakeEmitter.duration = 0.2f; shakeEmitter.amplitudeTimeDecay = true; shakeEmitter.radius = 60f; shakeEmitter.shakeOnStart = false; shakeEmitter.shakeOnEnable = true; shakeEmitter.wave.frequency = 8f; shakeEmitter.wave.amplitude = 5f; sirenPoleController.waveShakeEmitter = shakeEmitter; inWorldPrefab.AddComponent <GenericDisplayNameProvider>().displayToken = "MYSTICSITEMS_SIRENPOLE_NAME"; inWorldPrefab.AddComponent <ProxyInteraction>(); inWorldPrefab.transform.Find("PoleTransform/InteractionCollider").gameObject.AddComponent <EntityLocator>().entity = inWorldPrefab; onTeleporterBeginChargingGlobalHook = new ILHook( typeof(MysticsItemsSirenPoleController).GetMethod("RunOnTeleporterBeginChargingGlobal"), il => { ILCursor c = new ILCursor(il); c.Emit(OpCodes.Ldsfld, typeof(TeleporterInteraction).GetField("onTeleporterBeginChargingGlobal", Main.bindingFlagAll)); c.Emit(OpCodes.Ldarg, 1); c.Emit(OpCodes.Callvirt, typeof(System.Action <TeleporterInteraction>).GetMethodCached("Invoke")); } ); onTeleporterChargedGlobalHook = new ILHook( typeof(MysticsItemsSirenPoleController).GetMethod("RunOnTeleporterChargedGlobal"), il => { ILCursor c = new ILCursor(il); c.Emit(OpCodes.Ldsfld, typeof(TeleporterInteraction).GetField("onTeleporterChargedGlobal", Main.bindingFlagAll)); c.Emit(OpCodes.Ldarg, 1); c.Emit(OpCodes.Callvirt, typeof(System.Action <TeleporterInteraction>).GetMethodCached("Invoke")); } ); On.RoR2.TeleporterInteraction.Awake += (orig, self) => { if (!self.GetComponent <MysticsItemsSirenPoleController>()) { orig(self); } }; On.RoR2.TeleporterInteraction.IdleToChargingState.OnEnter += (orig, self) => { MysticsItemsSirenPoleController.ForceEnd(); orig(self); }; On.RoR2.Language.GetLocalizedStringByToken += Language_GetLocalizedStringByToken; }
private void UpdateThingies(On.RoR2.HoldoutZoneController.orig_FixedUpdate orig, HoldoutZoneController self) { orig(self); if ((GetCountFromPlayers(ItemDef, true) <= 0)) { return; } ; //ART ATTACK //Makes current calculated radius a float between 1 and 0, then keeps updating the old smoothTransition float intToFloat = (newCalculatedRadius > 0f) ? 1f : 0f; float smoothTransition = Mathf.MoveTowards(currentValue, intToFloat, rampupTime * Time.fixedDeltaTime); if (currentValue < 0f && smoothTransition > 0f) { //we play a cool sound here indicating the zone is getting bigger } //Current Value now goes to the color thing, if this isnt on a fixed update, it wont draw the teleporter radius! currentValue = smoothTransition; #if DEBUG TurboEdition._logger.LogWarning("currentValue: " + currentValue); TurboEdition._logger.LogWarning("smoothTransition: " + smoothTransition); #endif }
private void OnDisable(HoldoutZoneController self) { self.calcColor -= ChangeColor; self.calcRadius -= ChangeRadius; }
private void OnEnable(HoldoutZoneController self) { self.calcColor += ChangeColor; self.calcRadius += ChangeRadius; }