コード例 #1
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Golden Revolver", "goldenrevolver");

            Game.Items.Rename("outdated_gun_mods:golden_revolver", "nn:golden_revolver");
            gun.gameObject.AddComponent <GoldenRevolver>();
            gun.SetShortDescription("Pop Pop");
            gun.SetLongDescription("A flashy weapon made entirely out of solid gold." + "\n\nNot to be confused with the AU gun, which is meant to be hidden. This gun is meant to be shown off.");

            gun.SetupSprite(null, "goldenrevolver_idle_001", 8);

            gun.SetAnimationFPS(gun.shootAnimation, 10);

            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(38) as Gun).gunSwitchGroup;
            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(38) as Gun, true, false);

            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 1f;
            gun.DefaultModule.cooldownTime        = 0.1f;
            gun.DefaultModule.angleVariance       = 5;
            gun.DefaultModule.numberOfShotsInClip = 6;
            gun.muzzleFlashEffects = (PickupObjectDatabase.GetById(38) as Gun).muzzleFlashEffects;
            gun.barrelOffset.transform.localPosition = new Vector3(1.25f, 0.75f, 0f);
            gun.SetBaseMaxAmmo(140);
            gun.ammo     = 140;
            gun.gunClass = GunClass.PISTOL;
            //BULLET STATS
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            AutoDoShadowChainOnSpawn chain = projectile.gameObject.AddComponent <AutoDoShadowChainOnSpawn>();

            chain.randomiseChainNum = true;
            chain.randomChainMin    = 0;
            chain.randomChainMax    = 5;
            chain.pauseLength       = 0.05f;

            gun.DefaultModule.projectiles[0] = projectile;

            gun.quality = PickupObject.ItemQuality.S;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            GoldenRevolverID = gun.PickupObjectId;
        }
コード例 #2
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Mini Monger", "minimonger");

            Game.Items.Rename("outdated_gun_mods:mini_monger", "nn:mini_monger");
            var behav = gun.gameObject.AddComponent <MiniMonger>();

            behav.preventNormalFireAudio    = true;
            behav.overrideNormalFireAudio   = "Play_ENM_demonwall_barf_01";
            behav.preventNormalReloadAudio  = true;
            behav.overrideNormalReloadAudio = "Play_ENM_demonwall_intro_01";
            gun.SetShortDescription("Great Wall");
            gun.SetLongDescription("A scale model of the fearsome Wallmonger, used as a mock-up during it's original construction." + "\n\nWhile the Wallmonger contains hundreds of tortured souls, this only contains two or three.");
            gun.AddPassiveStatModifier(PlayerStats.StatType.Curse, 1f, StatModifier.ModifyMethod.ADDITIVE);
            gun.SetupSprite(null, "minimonger_idle_001", 8);


            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].eventAudio   = "Play_ENM_demonwall_barf_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].triggerEvent = true;

            gun.SetAnimationFPS(gun.shootAnimation, 10);
            gun.SetAnimationFPS(gun.chargeAnimation, 5);

            for (int i = 0; i < 5; i++)
            {
                gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false);
            }

            //GUN STATS
            foreach (ProjectileModule mod in gun.Volley.projectiles)
            {
                mod.ammoCost            = 1;
                mod.shootStyle          = ProjectileModule.ShootStyle.Charged;
                mod.sequenceStyle       = ProjectileModule.ProjectileSequenceStyle.Random;
                mod.cooldownTime        = 2f;
                mod.angleVariance       = 15f;
                mod.numberOfShotsInClip = 4;
                Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(mod.projectiles[0]);
                mod.projectiles[0] = projectile;
                projectile.gameObject.SetActive(false);
                FakePrefab.MarkAsFakePrefab(projectile.gameObject);
                UnityEngine.Object.DontDestroyOnLoad(projectile);
                projectile.baseData.speed  *= 0.5f;
                projectile.baseData.damage *= 1.6f;
                AutoDoShadowChainOnSpawn chain = projectile.gameObject.GetOrAddComponent <AutoDoShadowChainOnSpawn>();
                chain.NumberInChain = 5;
                chain.pauseLength   = 0.1f;
                projectile.SetProjectileSpriteRight("pillarocket_subprojectile", 5, 5, true, tk2dBaseSprite.Anchor.MiddleCenter, 3, 3);

                if (mod != gun.DefaultModule)
                {
                    mod.ammoCost = 0;
                }
                ProjectileModule.ChargeProjectile chargeProj = new ProjectileModule.ChargeProjectile
                {
                    Projectile = projectile,
                    ChargeTime = 1f,
                };
                mod.chargeProjectiles = new List <ProjectileModule.ChargeProjectile> {
                    chargeProj
                };
            }
            gun.reloadTime = 2f;
            gun.SetBaseMaxAmmo(50);
            gun.gunClass = GunClass.SHOTGUN;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 3;

            gun.DefaultModule.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType = "Punishment Ray Lasers";

            gun.quality = PickupObject.ItemQuality.A;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            MiniMongerID = gun.PickupObjectId;
        }