Exemplo n.º 1
0
        private static void CreateGurrenLagannSpecialProjectile()
        {
            gigaDrillProjectilePrefab = CloneProjectilePrefab("Sawmerang", "GurrenLagannSpecialProjectile");
            ProjectileController projectileController = gigaDrillProjectilePrefab.GetComponent <ProjectileController>();

            projectileController.ghostPrefab = shadesGhostPrefab;
            projectileController.startSound  = "";

            ProjectileOverlapAttack overlapAttack = gigaDrillProjectilePrefab.GetComponent <ProjectileOverlapAttack>();

            overlapAttack.damageCoefficient      = 1.0f;
            overlapAttack.overlapProcCoefficient = GurrenLagannInitGigaDrillBreak.procCoefficient;

            BoomerangProjectile          boomerangProjectile          = gigaDrillProjectilePrefab.GetComponent <BoomerangProjectile>();
            GurrenLagannShadesProjectile gurrenLagannShadesProjectile = gigaDrillProjectilePrefab.AddComponent <GurrenLagannShadesProjectile>();

            gurrenLagannShadesProjectile.canHitWorld     = true;
            gurrenLagannShadesProjectile.crosshairPrefab = boomerangProjectile.crosshairPrefab;
            gurrenLagannShadesProjectile.impactSpark     = boomerangProjectile.impactSpark;
            gurrenLagannShadesProjectile.canConstrict    = true;

            var collider = gigaDrillProjectilePrefab.GetComponent <BoxCollider>();

            collider.size = new Vector3(6.0f, 1.0f, 6.0f);

            var hitbox = gigaDrillProjectilePrefab.GetComponentInChildren <HitBox>();

            hitbox.transform.localScale = new Vector3(8.0f, 3.0f, 8.0f);

            TTGL_SurvivorPlugin.DestroyImmediate(boomerangProjectile);
        }
Exemplo n.º 2
0
        private static void CreateYokoRiflePiercingProjectile()
        {
            yokoPiercingRoundPrefab = CloneProjectilePrefab("MageLightningboltExpanded", "YokoRiflePiercingProjectile");
            ProjectileController projectileController = yokoPiercingRoundPrefab.GetComponent <ProjectileController>();

            projectileController.ghostPrefab = CreateGhostPrefab("YokoRiflePierceEffect");
            projectileController.startSound  = "";

            yokoPiercingRoundPrefab.AddComponent <ScaleProjectileController>();

            ProjectileOverlapAttack overlapAttack = yokoPiercingRoundPrefab.GetComponent <ProjectileOverlapAttack>();

            overlapAttack.damageCoefficient = 1.0f;

            SphereCollider sphereCollider = yokoPiercingRoundPrefab.GetComponent <SphereCollider>();

            sphereCollider.radius = 0.5f;

            HitBox hitBox = yokoPiercingRoundPrefab.GetComponentInChildren <HitBox>();

            hitBox.transform.localScale = new Vector3(1f, 1f, 1f);
        }
Exemplo n.º 3
0
        public override void OnLoad()
        {
            equipmentDef.name = "MysticsItems_Microphone";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Vintage Microphone", 60f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Vintage Microphone", true);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Vintage Microphone", false);
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Microphone/Icon.png");

            var modelPanelParams = equipmentDef.pickupModelPrefab.GetComponent <ModelPanelParameters>();

            modelPanelParams.minDistance = 5;
            modelPanelParams.maxDistance = 15;
            HopooShaderToMaterial.Standard.Gloss(equipmentDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 1f, 15f);
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.131F, 0.101F, -0.106F), new Vector3(353.789F, 220.459F, 176.094F), new Vector3(0.024F, 0.024F, 0.024F));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.065F, 0.139F, 0.087F), new Vector3(57.427F, 169.25F, 159.351F), new Vector3(0.011F, 0.011F, 0.012F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.097F, 0.048F, -0.129F), new Vector3(4.954F, 282.723F, 159.07F), new Vector3(0.029F, 0.029F, 0.029F));
                AddDisplayRule("ToolbotBody", "HandR", new Vector3(-0.01F, 0.981F, -0.167F), new Vector3(58.56F, 268.579F, 264.86F), new Vector3(0.378F, 0.378F, 0.378F));
                AddDisplayRule("EngiBody", "HandL", new Vector3(0.015F, 0.18F, -0.04F), new Vector3(70.126F, 294.778F, 9.124F), new Vector3(0.047F, 0.047F, 0.047F));
                AddDisplayRule("MageBody", "Head", new Vector3(-0.095F, 0.108F, -0.047F), new Vector3(358.993F, 354.776F, 177.852F), new Vector3(0.016F, 0.016F, 0.016F));
                AddDisplayRule("MercBody", "HandL", new Vector3(0.021F, 0.127F, 0.013F), new Vector3(356.714F, 344.677F, 266.091F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("TreebotBody", "WeaponPlatformEnd", new Vector3(-0.044F, -0.068F, 0.154F), new Vector3(339.636F, 327.135F, 61.693F), new Vector3(0.05F, 0.05F, 0.05F));
                AddDisplayRule("LoaderBody", "MechHandL", new Vector3(0.052F, 0.271F, 0.005F), new Vector3(0.351F, 159.123F, 281.328F), new Vector3(0.052F, 0.05F, 0.052F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(-0.543F, 4.565F, -0.104F), new Vector3(284.494F, 3.244F, 267.429F), new Vector3(0.333F, 0.333F, 0.333F));
                AddDisplayRule("CaptainBody", "HandR", new Vector3(0.002F, 0.155F, -0.014F), new Vector3(53.771F, 271.897F, 272.032F), new Vector3(0.041F, 0.041F, 0.041F));
                AddDisplayRule("ScavBody", "HandL", new Vector3(0.469F, 2.35F, -0.273F), new Vector3(305.162F, 137.483F, 278.565F), new Vector3(0.883F, 0.883F, 0.883F));
                AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.453F), new Vector3(0F, 90F, 0F), new Vector3(0.265F, 0.265F, 0.265F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Head", new Vector3(-0.12632F, 0.03962F, -0.03585F), new Vector3(339.427F, 188.6309F, 0F), new Vector3(0.03139F, 0.03139F, 0.03139F));
                }
                AddDisplayRule("RailgunnerBody", "GunScope", new Vector3(0F, 0.18265F, 0.3376F), new Vector3(0F, 270F, 243.3805F), new Vector3(0.02478F, 0.02478F, 0.02478F));
                AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.11444F, 0.29135F, 0.09171F), new Vector3(30.82122F, 341.6345F, 328.628F), new Vector3(0.03418F, 0.03418F, 0.03418F));
            };

            wavePrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/MicrophoneSoundwaveGhost.prefab");
            wavePrefab.AddComponent <ProjectileGhostController>();

            MysticsRisky2Utils.Utils.CopyChildren(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/MicrophoneSoundwave.prefab"), waveProjectile);
            MicrophoneSoundwaveProjectile msp = waveProjectile.AddComponent <MicrophoneSoundwaveProjectile>();

            msp.colorCurve = new AnimationCurve[]
            {
                new AnimationCurve {
                    keys = new Keyframe[] { new Keyframe(0f, 255f) }
                },
                new AnimationCurve {
                    keys = new Keyframe[] { new Keyframe(0f, 195f) }
                },
                new AnimationCurve {
                    keys = new Keyframe[] { new Keyframe(0f, 112f) }
                },
                new AnimationCurve {
                    keys = new Keyframe[] {
                        new Keyframe(0f, 0f),
                        new Keyframe(0.5f, 255f),
                        new Keyframe(1f, 0f)
                    }
                }
            };
            ProjectileController projectileController = waveProjectile.AddComponent <ProjectileController>();

            projectileController.ghostPrefab     = wavePrefab;
            projectileController.allowPrediction = true;
            waveProjectile.AddComponent <ProjectileNetworkTransform>();
            waveProjectile.AddComponent <TeamFilter>();
            ProjectileDamage projectileDamage = waveProjectile.AddComponent <ProjectileDamage>();

            projectileDamage.damageType = DamageType.Stun1s;
            HitBoxGroup hitBoxGroup = waveProjectile.AddComponent <HitBoxGroup>();

            hitBoxGroup.groupName = "MicrophoneSoundwave";
            hitBoxGroup.hitBoxes  = new HitBox[]
            {
                waveProjectile.transform.Find("Hitbox").gameObject.AddComponent <HitBox>()
            };
            ProjectileOverlapAttack projectileOverlapAttack = waveProjectile.AddComponent <ProjectileOverlapAttack>();

            projectileOverlapAttack.damageCoefficient      = 0f;
            projectileOverlapAttack.overlapProcCoefficient = 0f;
            ProjectileInflictTimedBuff projectileInflictTimedBuff = waveProjectile.AddComponent <ProjectileInflictTimedBuff>();

            projectileInflictTimedBuff.duration = duration.Value;

            MysticsItemsContent.Resources.projectilePrefabs.Add(waveProjectile);

            for (int i = 0; i < shotsPerCast; i++)
            {
                GameObject waveProjectileScaled = PrefabAPI.InstantiateClone(waveProjectile, waveProjectile.name + "Scaled" + i);
                waveProjectileScaled.transform.localScale = Vector3.one * 30f * ((i + 1f) / (float)shotsPerCast);
                if (i > 0)
                {
                    waveProjectileScaled.GetComponent <MicrophoneSoundwaveProjectile>().colorCurve[3].AddKey(new Keyframe(0.5f * (i / (float)shotsPerCast), 0f));
                }
                waveProjectilesScaled.Add(waveProjectileScaled);
                MysticsItemsContent.Resources.projectilePrefabs.Add(waveProjectileScaled);
            }

            sound           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            sound.eventName = "MysticsItems_Play_item_use_microphone";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(sound);
        }
Exemplo n.º 4
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;
            }
        }