public static void Init() { string name = "Fun Guy"; string resourcePath = "NevernamedsItems/Resources/Companions/FunGuy/funguy_icon"; GameObject gameObject = new GameObject(); CompanionItem companionItem = gameObject.AddComponent <FunGuy>(); ItemBuilder.AddSpriteToObject(name, resourcePath, gameObject); string shortDesc = "Myc-inda Fella"; string longDesc = "This young fungun has become dissilusioned with the ways of the Gungeon. Or at least, it seems that way. It's unclear if it really knows what's going on."; companionItem.SetupItem(shortDesc, longDesc, "nn"); companionItem.quality = PickupObject.ItemQuality.C; companionItem.CompanionGuid = FunGuy.guid; FunGuy.BuildPrefab(); synergyFungusProj = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(86) as Gun).DefaultModule.projectiles[0]); synergyFungusProj.gameObject.MakeFakePrefab(); synergyFungusProj.SetProjectileSpriteRight("yellowtriangleproj_001", 19, 17, true, tk2dBaseSprite.Anchor.MiddleCenter, 9, 9); FungoRandomBullets orAddComponent = synergyFungusProj.gameObject.GetOrAddComponent <FungoRandomBullets>(); synergyFungusProj.baseData.speed *= 0.2f; synergyFungusProj.baseData.damage = 12.5f; PierceProjModifier pierce = synergyFungusProj.gameObject.AddComponent <PierceProjModifier>(); pierce.penetration = 1; pierce.penetratesBreakables = true; synergyFungusProj.gameObject.AddComponent <PierceDeadActors>(); synergyFungusProj.pierceMinorBreakables = true; synergyFungusProj.AnimateProjectile(new List <string> { "yellowtriangleproj_001", "yellowtriangleproj_002", "yellowtriangleproj_003", "yellowtriangleproj_004", }, 10, true, new List <IntVector2> { new IntVector2(19, 17), new IntVector2(19, 17), new IntVector2(19, 17), new IntVector2(19, 17), }, AnimateBullet.ConstructListOfSameValues(true, 4), AnimateBullet.ConstructListOfSameValues(tk2dBaseSprite.Anchor.MiddleCenter, 4), AnimateBullet.ConstructListOfSameValues(true, 4), AnimateBullet.ConstructListOfSameValues(false, 4), AnimateBullet.ConstructListOfSameValues <Vector3?>(null, 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(new IntVector2(9, 9), 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(new IntVector2(5, 3), 4), AnimateBullet.ConstructListOfSameValues <Projectile>(null, 4)); }
public override void PostProcessProjectile(Projectile projectile) { if (projectile.Owner is PlayerController) { PlayerController owner = projectile.Owner as PlayerController; if (owner != null) { if (owner.PlayerHasActiveSynergy("Hunter Spores")) { FungoRandomBullets bulletmod = projectile.GetComponent <FungoRandomBullets>(); if (bulletmod != null) { bulletmod.HasSynergyHunterSpores = true; } } if (owner.PlayerHasActiveSynergy("Myshellium")) { projectile.baseData.damage *= 2; } } } base.PostProcessProjectile(projectile); }
public static void Add() { Gun gun = ETGMod.Databases.Items.NewGun("Fungo Cannon", "fungocannon"); Game.Items.Rename("outdated_gun_mods:fungo_cannon", "nn:fungo_cannon"); var behav = gun.gameObject.AddComponent <FungoCannon>(); behav.preventNormalFireAudio = true; behav.preventNormalReloadAudio = true; gun.SetShortDescription("PLOOMPH"); gun.SetLongDescription("A mutated fungun from the Oubliette." + "\n\nThough horrific genetic anomalies have stripped it of it's face and legs, it still retains it's deadly spores."); gun.SetupSprite(null, "fungocannon_idle_001", 8); gun.SetAnimationFPS(gun.shootAnimation, 12); gun.SetAnimationFPS(gun.chargeAnimation, 6); gun.gunClass = GunClass.CHARGE; for (int i = 0; i < 20; 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 = 1f; mod.angleVariance = 360f; mod.numberOfShotsInClip = 5; 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.SetProjectileSpriteRight("enemystylespore_projectile", 14, 14, true, tk2dBaseSprite.Anchor.MiddleCenter, 14, 14); FungoRandomBullets orAddComponent = projectile.gameObject.GetOrAddComponent <FungoRandomBullets>(); projectile.baseData.speed *= 0.2f; projectile.baseData.damage *= 2f; if (mod != gun.DefaultModule) { mod.ammoCost = 0; } ProjectileModule.ChargeProjectile chargeProj = new ProjectileModule.ChargeProjectile { Projectile = projectile, ChargeTime = 0.5f, }; mod.chargeProjectiles = new List <ProjectileModule.ChargeProjectile> { chargeProj }; } gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.CUSTOM; gun.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("FungoCannon Bullets", "NevernamedsItems/Resources/CustomGunAmmoTypes/fungocannon_clipfull", "NevernamedsItems/Resources/CustomGunAmmoTypes/fungocannon_clipempty"); gun.reloadTime = 1.4f; gun.SetBaseMaxAmmo(200); gun.quality = PickupObject.ItemQuality.C; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode = tk2dSpriteAnimationClip.WrapMode.LoopSection; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 1; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].eventAudio = "Play_ENM_mushroom_cloud_01"; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].triggerEvent = true; ETGMod.Databases.Items.Add(gun, null, "ANY"); gun.barrelOffset.transform.localPosition = new Vector3(1.56f, 0.62f, 0f); FungoCannonID = gun.PickupObjectId; }