// Token: 0x06000606 RID: 1542 RVA: 0x0001BC5C File Offset: 0x00019E5C
        protected void SetReady(bool ready)
        {
            Transform modelTransform = base.GetModelTransform();

            if (modelTransform)
            {
                PrintController component = modelTransform.GetComponent <PrintController>();
                component.paused = !ready;
                if (!ready)
                {
                    component.age = 0f;
                }
                ChildLocator component2 = modelTransform.GetComponent <ChildLocator>();
                if (component2)
                {
                    component2.FindChild("Purchased").gameObject.SetActive(ready);
                }
            }
            PurchaseInteraction component3 = base.GetComponent <PurchaseInteraction>();

            if (component3)
            {
                component3.SetAvailable(!ready);
            }
            HologramProjector component4 = base.GetComponent <HologramProjector>();

            if (component4)
            {
                component4.hologramPivot.gameObject.SetActive(!ready);
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        private void AddPickupNameToHologram(On.RoR2.Hologram.HologramProjector.orig_BuildHologram orig, HologramProjector self)
        {
            orig(self);

            var chestBehav = self.GetComponent <ChestBehavior>();

            if (ShouldIgnoreChestBehaviour(chestBehav))
            {
                return;
            }

            var       netId  = chestBehav.netId;
            PickupDef pickup = null;

            if (!NetworkChestSync.instance.TryGetPickup(netId, out pickup))
            {
                Debug.LogWarning($"Failed getting pickup for chest {netId}");
                return;
            }

            var contentObj = self.GetFieldValue <GameObject>("hologramContentInstance");

            if (!contentObj)
            {
                Debug.LogWarning($"No content instance for chest {netId}'s hologram projector");
                return;
            }

            var txtCopy = Instantiate(contentObj.transform.GetChild(2).gameObject);

            txtCopy.GetComponent <TextMeshPro>().text = GetStylizedPickupName(pickup);
            txtCopy.transform.SetParent(contentObj.transform, false);
            txtCopy.GetComponent <RectTransform>().anchoredPosition = new Vector2(pickupNameXPos, pickNameYPos);
        }