Exemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration = FindItem.baseDuration / this.attackSpeedStat;
            base.PlayCrossfade("Body", "SitRummage", "Sit.playbackRate", this.duration, 0.1f);
            Util.PlaySound(FindItem.sound, base.gameObject);

            if (base.isAuthority)
            {
                WeightedSelection <List <PickupIndex> > weightedSelection = new WeightedSelection <List <PickupIndex> >(8);
                weightedSelection.AddChoice(Run.instance.availableTier3DropList.Where(new Func <PickupIndex, bool>(this.PickupIsNonBlacklistedItem)).ToList <PickupIndex>(), FindItem.tier3Chance);

                List <PickupIndex> list = weightedSelection.Evaluate(UnityEngine.Random.value);
                this.dropPickup = list[UnityEngine.Random.Range(0, list.Count)];

                PickupDef pickupDef = PickupCatalog.GetPickupDef(this.dropPickup);
                if (pickupDef != null)
                {
                    ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
                    if (itemDef != null)
                    {
                        this.itemsToGrant = 0;

                        switch (itemDef.tier)
                        {
                        case ItemTier.Tier1:
                            this.itemsToGrant = FindItem.tier1Count;
                            break;

                        case ItemTier.Tier2:
                            this.itemsToGrant = FindItem.tier2Count;
                            break;

                        case ItemTier.Tier3:
                            this.itemsToGrant = FindItem.tier3Count;
                            break;

                        default:
                            this.itemsToGrant = 1;
                            break;
                        }
                    }
                }
            }

            Transform transform = base.FindModelChild("PickupDisplay");

            this.pickupDisplay = transform.GetComponent <PickupDisplay>();
            this.pickupDisplay.SetPickupIndex(this.dropPickup, false);
        }
Exemplo n.º 2
0
 public override void OnEnter()
 {
     base.OnEnter();
     effectComponent = GetComponent <EffectComponent>();
     pickupDisplay   = GetComponent <PickupDisplay>();
     if (effectComponent)
     {
         if (pickupDisplay)
         {
             pickupDisplay.SetPickupIndex(new PickupIndex((int)effectComponent.effectData.genericUInt), false);
         }
         if (rigidbody)
         {
             var force = Vector3.up;
             force = Quaternion.AngleAxis(45f, Vector3.forward) * force;
             force = Quaternion.AngleAxis(effectComponent.effectData.genericFloat, Vector3.up) * force;
             rigidbody.AddForce(force * 400f);
         }
     }
 }
Exemplo n.º 3
0
        public override void OnLoad()
        {
            base.OnLoad();
            equipmentDef.name = "MysticsItems_GateChalice";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Gate Chalice", 60f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Gate Chalice", false);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Gate Chalice", false);
            equipmentDef.isLunar           = true;
            equipmentDef.colorIndex        = ColorCatalog.ColorIndex.LunarItem;
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Gate Chalice/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Gate Chalice/Icon.png");

            Material mat = equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").gameObject.GetComponent <MeshRenderer>().sharedMaterial;

            HopooShaderToMaterial.Standard.Apply(mat);
            HopooShaderToMaterial.Standard.Gloss(mat, 0.5f);
            HopooShaderToMaterial.Standard.Emission(mat, 0.02f, new Color(48f / 255f, 127f / 255f, 255f / 255f));
            foreach (Transform lightTransform in equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").Find("Lights"))
            {
                SetScalableChildEffect(equipmentDef.pickupModelPrefab, lightTransform.gameObject);
                FlickerLight flickerLight = lightTransform.gameObject.AddComponent <FlickerLight>();
                flickerLight.light    = lightTransform.gameObject.GetComponent <Light>();
                flickerLight.sinWaves = new Wave[] {
                    new Wave {
                        amplitude = 0.3f,
                        frequency = 4f
                    },
                    new Wave {
                        amplitude = 0.6f,
                        frequency = 2f
                    },
                    new Wave {
                        amplitude = 0.9f,
                        frequency = 1f
                    }
                };
            }
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.09F, 0.1F, -0.102F), new Vector3(5.862F, 140.357F, 1.915F), new Vector3(0.059F, 0.059F, 0.059F));
                AddDisplayRule("HuntressBody", "Pelvis", new Vector3(-0.082F, -0.111F, 0.085F), new Vector3(0.679F, 36.762F, 188.148F), new Vector3(0.047F, 0.047F, 0.048F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.096F, 0.027F, -0.151F), new Vector3(337.162F, 337.663F, 11.532F), new Vector3(0.04F, 0.04F, 0.04F));
                AddDisplayRule("ToolbotBody", "Hip", new Vector3(-1.239F, 0.577F, -1.044F), new Vector3(0F, 180F, 180F), new Vector3(0.349F, 0.349F, 0.349F));
                AddDisplayRule("EngiBody", "Pelvis", new Vector3(-0.178F, 0.078F, 0.157F), new Vector3(11.745F, 186.295F, 185.936F), new Vector3(0.047F, 0.047F, 0.047F));
                AddDisplayRule("MageBody", "Pelvis", new Vector3(-0.128F, -0.131F, 0.024F), new Vector3(6.286F, 3.408F, 167.572F), new Vector3(0.044F, 0.044F, 0.044F));
                AddDisplayRule("MercBody", "Chest", new Vector3(0F, 0.193F, -0.286F), new Vector3(71.925F, 180F, 0F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(-0.485F, 0.701F, -0.803F), new Vector3(26.173F, 24.306F, 86.838F), new Vector3(0.061F, 0.061F, 0.061F));
                AddDisplayRule("LoaderBody", "Pelvis", new Vector3(-0.216F, -0.016F, -0.022F), new Vector3(342.363F, 183.205F, 159.555F), new Vector3(0.045F, 0.045F, 0.045F));
                AddDisplayRule("CrocoBody", "SpineStomach1", new Vector3(0.845F, 0.495F, 1.289F), new Vector3(74.633F, 327.618F, 247.859F), new Vector3(0.361F, 0.361F, 0.361F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(-0.195F, 0.128F, 0.126F), new Vector3(336.504F, 156.734F, 358.159F), new Vector3(0.041F, 0.041F, 0.041F));
                AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(0F, 0F, -1.503F), new Vector3(90F, 0F, 0F), new Vector3(2.281F, 2.281F, 2.281F));
                AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.069F), new Vector3(0F, 0F, 0F), new Vector3(0.267F, 0.267F, 0.267F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Pelvis", new Vector3(0.19432F, 0.18834F, -0.17385F), new Vector3(343.5044F, 339.549F, 357.2065F), new Vector3(0.05181F, 0.05181F, 0.05181F));
                }
                AddDisplayRule("RailgunnerBody", "Pelvis", new Vector3(0.14878F, -0.03065F, 0.10522F), new Vector3(354.5591F, 180F, 180F), new Vector3(0.05639F, 0.05639F, 0.05639F));
                AddDisplayRule("VoidSurvivorBody", "Hand", new Vector3(-0.03581F, 0.28639F, -0.00539F), new Vector3(0F, 0F, 4.98446F), new Vector3(0.09781F, 0.09781F, 0.09781F));
            };

            visualEffectOnUse = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceOnUseEffect", false);
            EffectComponent effectComponent = visualEffectOnUse.AddComponent <EffectComponent>();

            effectComponent.soundName = "Play_env_teleporter_active_button";
            effectComponent.positionAtReferencedTransform = true;
            effectComponent.applyScale      = true;
            effectComponent.disregardZScale = true;
            VFXAttributes vfxAttributes = visualEffectOnUse.AddComponent <VFXAttributes>();

            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Low;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            visualEffectOnUse.AddComponent <DestroyOnTimer>().duration = 2f;

            GameObject     massSparks     = PrefabAPI.InstantiateClone(new GameObject(), "MassSparks", false);
            ParticleSystem particleSystem = massSparks.AddComponent <ParticleSystem>();

            massSparks.GetComponent <ParticleSystemRenderer>().material = Object.Instantiate(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ActivateRadarTowerEffect").transform.Find("MassSparks").gameObject.GetComponent <ParticleSystemRenderer>().material);
            particleSystem.useAutoRandomSeed = true;
            ParticleSystem.MainModule mainModule = particleSystem.main;
            mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
            mainModule.scalingMode     = ParticleSystemScalingMode.Local;
            mainModule.startLifetime   = 5f;
            mainModule.duration        = 1f;
            mainModule.playOnAwake     = true;
            ParticleSystem.MinMaxCurve particleSpeed = mainModule.startSpeed;
            particleSpeed.mode         = ParticleSystemCurveMode.TwoConstants;
            particleSpeed.constantMin  = 10f;
            particleSpeed.constantMax  = 1000f;
            mainModule.startSize       = 0.1f;
            mainModule.startColor      = new Color(48f / 255f, 127f / 255f, 255f / 255f);
            mainModule.gravityModifier = 0.3f;
            mainModule.maxParticles    = 20;
            ParticleSystem.EmissionModule emissionModule = particleSystem.emission;
            emissionModule.enabled          = true;
            emissionModule.rateOverTime     = 10;
            emissionModule.rateOverDistance = 0;
            emissionModule.SetBursts(new ParticleSystem.Burst[]
            {
                new ParticleSystem.Burst
                {
                    time           = 0f,
                    count          = 20f,
                    cycleCount     = 1,
                    repeatInterval = 0.01f,
                    probability    = 1f
                }
            });
            ParticleSystem.ShapeModule shapeModule = particleSystem.shape;
            shapeModule.shapeType = ParticleSystemShapeType.Sphere;
            massSparks.transform.SetParent(visualEffectOnUse.transform);

            MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectOnUse);

            visualEffectTeleportOut    = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceTeleportOutEffect", false);
            effectComponent            = visualEffectTeleportOut.AddComponent <EffectComponent>();
            vfxAttributes              = visualEffectTeleportOut.AddComponent <VFXAttributes>();
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium;
            visualEffectTeleportOut.AddComponent <DestroyOnTimer>().duration = 4f;

            GameObject ppHolder = PrefabAPI.InstantiateClone(new GameObject(), "PP", false);

            ppHolder.layer = LayerIndex.postProcess.intVal;
            ppHolder.AddComponent <MysticsItemsGateChalicePPController>().time = 3f;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.isGlobal = true;
            pp.weight   = 0f;
            pp.priority = 50;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

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

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

            colorGrading.colorFilter.value         = new Color(97f / 255f, 163f / 255f, 239f / 255f);
            colorGrading.colorFilter.overrideState = true;
            pp.sharedProfile = ppProfile;
            ppHolder.transform.SetParent(visualEffectTeleportOut.transform);

            MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectTeleportOut);

            SceneExitController sceneExitController = sceneExitControllerObject.AddComponent <SceneExitController>();

            sceneExitController.useRunNextStageScene = true;
            sceneExitControllerObject.AddComponent <MysticsItemsGateChaliceSceneExit>();

            itemDestroyEffectPrefab = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceItemDestroyEffect", false);
            EntityStateMachine entityStateMachine = itemDestroyEffectPrefab.AddComponent <EntityStateMachine>();

            entityStateMachine.initialStateType = entityStateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(MysticsItemsGateChaliceItemDestroyEffect));
            PickupDisplay pickupDisplay = itemDestroyEffectPrefab.AddComponent <PickupDisplay>();
            Rigidbody     rigidbody     = itemDestroyEffectPrefab.AddComponent <Rigidbody>();

            rigidbody.useGravity       = false;
            rigidbody.drag             = 2f;
            effectComponent            = itemDestroyEffectPrefab.AddComponent <EffectComponent>();
            effectComponent.applyScale = true;
            effectComponent.soundName  = "Play_moonBrother_phase4_itemSuck_returnSingle";
            vfxAttributes = itemDestroyEffectPrefab.AddComponent <VFXAttributes>();
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.High;
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            Highlight highlight = itemDestroyEffectPrefab.AddComponent <Highlight>();

            pickupDisplay.highlight  = highlight;
            highlight.highlightColor = Highlight.HighlightColor.pickup;
            MysticsItemsContent.Resources.effectPrefabs.Add(itemDestroyEffectPrefab);
        }
Exemplo n.º 4
0
        private void PickupDisplay_SetPickupIndex(On.RoR2.PickupDisplay.orig_SetPickupIndex orig, PickupDisplay self, PickupIndex newPickupIndex, bool newHidden)
        {
            if (NetworkServer.active)
            {
                if (isCurrentStageBazaar())
                {
                    List <BazaarItem> bazaarItems = bazaar.GetBazaarItems();
                    for (int i = 0; i < bazaarItems.Count; i++)
                    {
                        if (bazaarItems[i].genericPickupController.pickupDisplay == self)
                        {
                            orig(self, bazaarItems[i].pickupIndex, newHidden);
                            return;
                        }
                    }
                }
            }

            orig(self, newPickupIndex, newHidden);
        }
Exemplo n.º 5
0
        public override void OnLoad()
        {
            equipmentDef.name = "MysticsItems_ArchaicMask";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Legendary Mask", 140f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Legendary Mask", true);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Legendary Mask", true);
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Archaic Mask/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Archaic Mask/Icon.png");
            MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef());

            SetScalableChildEffect(equipmentDef.pickupModelPrefab, "Mask/Effects/Point Light");
            SetScalableChildEffect(equipmentDef.pickupModelPrefab, "Mask/Effects/Fire");
            Material matArchaicMaskFire = equipmentDef.pickupModelPrefab.transform.Find("Mask/Effects/Fire").gameObject.GetComponent <Renderer>().sharedMaterial;

            HopooShaderToMaterial.CloudRemap.Apply(
                matArchaicMaskFire,
                Main.AssetBundle.LoadAsset <Texture>("Assets/Equipment/Archaic Mask/texRampArchaicMaskFire.png")
                );
            HopooShaderToMaterial.CloudRemap.Boost(matArchaicMaskFire, 0.5f);
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            MysticsRisky2Utils.Utils.CopyChildren(equipmentDef.pickupModelPrefab, unlockInteractablePrefab);

            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Head", new Vector3(-0.001F, 0.253F, 0.124F), new Vector3(0.055F, 269.933F, 20.48F), new Vector3(0.147F, 0.147F, 0.147F));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.001F, 0.221F, 0.039F), new Vector3(0.073F, 269.903F, 25.101F), new Vector3(0.119F, 0.119F, 0.121F));
                AddDisplayRule("Bandit2Body", "Head", new Vector3(0F, 0.047F, 0.102F), new Vector3(0F, 270F, 0F), new Vector3(0.097F, 0.097F, 0.097F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(0.321F, 3.4F, -0.667F), new Vector3(0F, 90F, 56.608F), new Vector3(0.933F, 0.933F, 0.933F));
                AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0F, 0F, 0.117F), new Vector3(0F, 270F, 0F), new Vector3(0.12F, 0.12F, 0.12F));
                AddDisplayRule("MageBody", "Head", new Vector3(0F, 0.05F, 0.104F), new Vector3(0F, 270F, 0F), new Vector3(0.07F, 0.07F, 0.07F));
                AddDisplayRule("MercBody", "Head", new Vector3(0F, 0.135F, 0.117F), new Vector3(0F, 270F, 11.977F), new Vector3(0.123F, 0.123F, 0.123F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(0.2F, 0.873F, 0.344F), new Vector3(0F, 295.888F, 344.74F), new Vector3(0.283F, 0.283F, 0.283F));
                AddDisplayRule("LoaderBody", "Head", new Vector3(0F, 0.097F, 0.116F), new Vector3(0F, 270F, 4.685F), new Vector3(0.117F, 0.117F, 0.117F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(0.012F, 4.425F, 1.271F), new Vector3(355.778F, 271.534F, 2.51F), new Vector3(0.973F, 0.973F, 0.973F));
                AddDisplayRule("CaptainBody", "Head", new Vector3(0F, 0.064F, 0.12F), new Vector3(0F, 270F, 0F), new Vector3(0.104F, 0.107F, 0.118F));
                AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(-0.26641F, -0.48169F, 0.74377F), new Vector3(9.57747F, 91.16208F, 178.8642F), new Vector3(2.78505F, 2.78505F, 2.78505F));
                AddDisplayRule("EquipmentDroneBody", "HeadCenter", new Vector3(0F, -0.507F, -0.381F), new Vector3(0F, 270F, 270F), new Vector3(0.965F, 0.965F, 0.965F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Head", new Vector3(-0.0039F, 0.15803F, -0.07916F), new Vector3(356.8718F, 270F, 87.82172F), new Vector3(0.14049F, 0.14049F, 0.14049F));
                }
                AddDisplayRule("RailgunnerBody", "Head", new Vector3(0F, 0.04792F, 0.09549F), new Vector3(0F, 270F, 352.3218F), new Vector3(0.10505F, 0.10505F, 0.10505F));
                AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(-0.06693F, -1.12064F, -0.77318F), new Vector3(90F, 0F, 0F), new Vector3(0.5795F, 0.5795F, 0.5795F));
            };

            crosshairPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/WoodSpriteIndicator"), "MysticsItems_ArchaicMaskIndicator", false);
            Object.Destroy(crosshairPrefab.GetComponentInChildren <Rewired.ComponentControls.Effects.RotateAroundAxis>());
            crosshairPrefab.GetComponentInChildren <SpriteRenderer>().sprite             = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Archaic Mask/Crosshair.png");
            crosshairPrefab.GetComponentInChildren <SpriteRenderer>().color              = new Color(190f / 255f, 65f / 255f, 255f / 255f);
            crosshairPrefab.GetComponentInChildren <SpriteRenderer>().transform.rotation = Quaternion.identity;
            crosshairPrefab.GetComponentInChildren <TMPro.TextMeshPro>().color           = new Color(190f / 255f, 65f / 255f, 255f / 255f);
            while (crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.length > 0)
            {
                crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.RemoveKey(0);
            }
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(0f, 2f);
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(0.5f, 1f);
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(1f, 1f);

            MysticsItemsArchaicMaskUnlockInteraction unlockInteraction = unlockInteractablePrefab.AddComponent <MysticsItemsArchaicMaskUnlockInteraction>();

            unlockInteraction.effects = unlockInteractablePrefab.transform.Find("Mask/Effects").gameObject;

            ParticleSystem particleSystem = unlockInteraction.effects.GetComponentInChildren <ParticleSystem>();

            ParticleSystem.MainModule particleSystemMain = particleSystem.main;
            particleSystemMain.startLifetime = 3.5f;

            unlockInteractablePrefab.AddComponent <GenericDisplayNameProvider>().displayToken = "EQUIPMENT_" + equipmentDef.name.ToUpper(System.Globalization.CultureInfo.InvariantCulture) + "_NAME";

            Highlight highlight = unlockInteractablePrefab.AddComponent <Highlight>();

            highlight.targetRenderer = unlockInteractablePrefab.GetComponentInChildren <Renderer>();
            highlight.highlightColor = Highlight.HighlightColor.interactive;

            GameObject entityLocatorHolder = unlockInteractablePrefab.transform.Find("EntityLocatorHolder").gameObject;

            entityLocatorHolder.layer = LayerIndex.pickups.intVal;
            SphereCollider sphereCollider = entityLocatorHolder.AddComponent <SphereCollider>();

            sphereCollider.radius    = 1.5f;
            sphereCollider.isTrigger = true;
            entityLocatorHolder.AddComponent <EntityLocator>().entity = unlockInteractablePrefab;

            MysticsRisky2Utils.Utils.CopyChildren(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Archaic Mask/ForcedPickup.prefab"), forcedPickupPrefab);
            GenericPickupController genericPickupController = forcedPickupPrefab.AddComponent <GenericPickupController>();

            forcedPickupPrefab.AddComponent <Highlight>();
            PickupDisplay pickupDisplay = forcedPickupPrefab.transform.Find("PickupDisplay").gameObject.AddComponent <PickupDisplay>();

            pickupDisplay.spinSpeed    = 0f;
            pickupDisplay.verticalWave = new Wave {
                amplitude = 0f
            };
            pickupDisplay.coloredParticleSystems  = new ParticleSystem[] { };
            genericPickupController.pickupDisplay = pickupDisplay;
            forcedPickupPrefab.transform.Find("PickupTrigger").gameObject.layer = LayerIndex.pickups.intVal;
            forcedPickupPrefab.transform.Find("PickupTrigger").gameObject.AddComponent <EntityLocator>().entity = forcedPickupPrefab;
            forcedPickupPrefab.AddComponent <MysticsItemsArchaicMaskForcedPickup>();

            On.RoR2.SceneDirector.PopulateScene += (orig, self) =>
            {
                orig(self);
                if (SceneCatalog.GetSceneDefForCurrentScene().baseSceneName == "wispgraveyard")
                {
                    Vector3 position = Vector3.zero;
                    Vector3 rotation = Vector3.zero;
                    int     variant  = Random.Range(0, 2);
                    switch (variant)
                    {
                    case 0:
                        position = new Vector3(78.64633f, 42.3367f, 35.37148f);
                        rotation = new Vector3(4.26f, 150f, 20f);
                        break;

                    case 1:
                        position = new Vector3(-350.1f, 7.494953f, -72.9473f);
                        rotation = new Vector3(0f, 270f, 30f);
                        break;
                    }
                    GameObject obj = Object.Instantiate(unlockInteractablePrefab, position, Quaternion.Euler(rotation));
                    NetworkServer.Spawn(obj);
                }
            };

            UseTargetFinder(TargetFinderType.Enemies, crosshairPrefab);
        }
Exemplo n.º 6
0
 // Use this for initialization
 void Awake()
 {
     textMesh = GetComponent<TextMesh>();
     instance = this;
 }