private IEnumerator DoSpeedChange() { float realTime = 1f; realTime *= UnityEngine.Random.Range(0.5f, 1f); realTime *= self.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.RangeMultiplier); float elapsed = 0f; while (elapsed < realTime) { elapsed += BraveTime.DeltaTime; float t = Mathf.Clamp01(elapsed / realTime); float speedMod = Mathf.Lerp(initialSpeed, 0, t); self.baseData.speed = speedMod; self.UpdateSpeed(); if (!self) { break; } yield return(null); } BulletLifeTimer timer = self.gameObject.AddComponent <BulletLifeTimer>(); timer.secondsTillDeath = 7f; }
private void Uncouple() { if (extantLink != null) { SpawnManager.Despawn(extantLink.gameObject); extantLink = null; } if (bolaProjectileA) { if (bolaProjectileA.baseData.speed < 0) { bolaProjectileA.baseData.speed *= -1; bolaProjectileA.UpdateSpeed(); } bolaProjectileA.OverrideMotionModule = null; BulletLifeTimer timer = bolaProjectileA.gameObject.AddComponent <BulletLifeTimer>(); timer.secondsTillDeath = 30; } if (bolaProjectileB) { if (bolaProjectileB.baseData.speed < 0) { bolaProjectileB.baseData.speed *= -1; bolaProjectileB.UpdateSpeed(); } bolaProjectileB.OverrideMotionModule = null; BulletLifeTimer timer = bolaProjectileB.gameObject.AddComponent <BulletLifeTimer>(); timer.secondsTillDeath = 30; } }
public static void Init() { string itemName = "Ultraviolet Guon Stone"; //The name of the item string resourceName = "NevernamedsItems/Resources/GuonStones/ultravioletguonstone_icon"; //Refers to an embedded png in the project. Make sure to embed your resources! GameObject obj = new GameObject(); var item = obj.AddComponent <UltraVioletGuonStone>(); ItemBuilder.AddSpriteToObject(itemName, resourceName, obj); string shortDesc = "Beyond the Pale"; string longDesc = "A jittery crystal from a realm beyond the Gungeon." + "\n\nErratically jumps to different orbits."; ItemBuilder.SetupItem(item, shortDesc, longDesc, "nn"); item.quality = PickupObject.ItemQuality.C; BuildPrefab(); item.OrbitalPrefab = orbitalPrefab; BuildSynergyPrefab(); item.HasAdvancedUpgradeSynergy = true; item.AdvancedUpgradeSynergy = "Ultravioleter Guon Stone"; item.AdvancedUpgradeOrbitalPrefab = UltraVioletGuonStone.upgradeOrbitalPrefab.gameObject; xenochromePrefab = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(86) as Gun).DefaultModule.projectiles[0]); xenochromePrefab.gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(xenochromePrefab.gameObject); UnityEngine.Object.DontDestroyOnLoad(xenochromePrefab); xenochromePrefab.baseData.damage = 20f; xenochromePrefab.baseData.speed = 0f; xenochromePrefab.AnimateProjectile(new List <string> { "thinline_pinkproj_001", "thinline_pinkproj_002", "thinline_pinkproj_003", "thinline_pinkproj_004", "thinline_pinkproj_005", "thinline_pinkproj_006", }, 10, true, new List <IntVector2> { new IntVector2(10, 10), new IntVector2(10, 10), new IntVector2(10, 10), new IntVector2(10, 10), new IntVector2(10, 10), new IntVector2(10, 10), }, AnimateBullet.ConstructListOfSameValues(true, 6), AnimateBullet.ConstructListOfSameValues(tk2dBaseSprite.Anchor.MiddleCenter, 6), AnimateBullet.ConstructListOfSameValues(true, 6), AnimateBullet.ConstructListOfSameValues(false, 6), AnimateBullet.ConstructListOfSameValues <Vector3?>(null, 6), AnimateBullet.ConstructListOfSameValues <IntVector2?>(null, 6), AnimateBullet.ConstructListOfSameValues <IntVector2?>(null, 6), AnimateBullet.ConstructListOfSameValues <Projectile>(null, 6)); BulletLifeTimer timer = xenochromePrefab.gameObject.AddComponent <BulletLifeTimer>(); timer.secondsTillDeath = 2; ExplosiveModifier splode = xenochromePrefab.gameObject.AddComponent <ExplosiveModifier>(); splode.doExplosion = true; splode.explosionData = StaticExplosionDatas.explosiveRoundsExplosion; splode.IgnoreQueues = true; }
private void OnCollision(CollisionData tileCollision) { this.m_projectile.baseData.speed *= 0f; this.m_projectile.UpdateSpeed(); this.m_hitNormal = tileCollision.Normal.ToAngle(); PhysicsEngine.PostSliceVelocity = new Vector2?(default(Vector2)); SpeculativeRigidbody specRigidbody = this.m_projectile.specRigidbody; specRigidbody.OnCollision -= this.OnCollision; BulletLifeTimer orAddComponent = m_projectile.gameObject.GetOrAddComponent <BulletLifeTimer>(); orAddComponent.secondsTillDeath = 20; }
public void BlankModHook(Action <SilencerInstance, BlankModificationItem, Vector2, PlayerController> orig, SilencerInstance silencer, BlankModificationItem bmi, Vector2 centerPoint, PlayerController user) { orig(silencer, bmi, centerPoint, user); //ETGModConsole.Log("Blank hook ran"); if (user.HasPickupID(NeutroniumAmmoletID)) { //ETGModConsole.Log("HasID"); Projectile projectile2 = ((Gun)ETGMod.Databases.Items["black_hole_gun"]).DefaultModule.projectiles[0]; GameObject gameObject = SpawnManager.SpawnProjectile(projectile2.gameObject, centerPoint, Quaternion.identity, true); Projectile component = gameObject.GetComponent <Projectile>(); if (component != null) { component.Owner = user; component.Shooter = user.specRigidbody; component.baseData.speed = 0f; component.baseData.range *= 100; BulletLifeTimer timer = component.gameObject.AddComponent <BulletLifeTimer>(); timer.secondsTillDeath = 7f; user.DoPostProcessProjectile(component); } } }
public static void Add() { Gun gun = ETGMod.Databases.Items.NewGun("Gunjurer's Staff", "gunjurerswand"); Game.Items.Rename("outdated_gun_mods:gunjurer's_staff", "nn:gunjurers_staff"); var behav = gun.gameObject.AddComponent <GunjurersStaff>(); behav.preventNormalFireAudio = true; behav.preventNormalReloadAudio = true; behav.overrideNormalReloadAudio = "Play_ENM_wizardred_chant_01"; gun.SetShortDescription("Do you believe in magic?"); gun.SetLongDescription("The lost wand of an Apprentice Gunjurer, cruelly slain by a Gungeoneer while out of his mentor's sight for but a moment..."); gun.SetupSprite(null, "gunjurerswand_idle_001", 8); gun.SetAnimationFPS(gun.shootAnimation, 10); gun.SetAnimationFPS(gun.chargeAnimation, 4); gun.gunSwitchGroup = (PickupObjectDatabase.GetById(35) as Gun).gunSwitchGroup; gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false); gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode = tk2dSpriteAnimationClip.WrapMode.LoopSection; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 2; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].eventAudio = "Play_ENM_wizardred_shoot_01"; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].triggerEvent = true; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[0].eventAudio = "Play_ENM_wizard_charge_01"; gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[0].triggerEvent = true; //GUN STATS gun.DefaultModule.ammoCost = 1; gun.DefaultModule.shootStyle = ProjectileModule.ShootStyle.Charged; gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Ordered; gun.muzzleFlashEffects.type = VFXPoolType.None; gun.reloadTime = 1.5f; gun.DefaultModule.cooldownTime = 0.5f; gun.DefaultModule.numberOfShotsInClip = 3; gun.barrelOffset.transform.localPosition = new Vector3(1.31f, 0.5f, 0f); gun.SetBaseMaxAmmo(45); gun.ammo = 45; gun.gunClass = GunClass.CHARGE; //BULLET STATS Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]); projectile.gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(projectile.gameObject); UnityEngine.Object.DontDestroyOnLoad(projectile); projectile.baseData.damage = 0f; projectile.baseData.force = 0f; projectile.baseData.speed = 0.001f; NoCollideBehaviour nocollide = projectile.gameObject.AddComponent <NoCollideBehaviour>(); nocollide.worksOnEnemies = true; nocollide.worksOnProjectiles = true; projectile.sprite.renderer.enabled = false; BulletLifeTimer timer = projectile.gameObject.AddComponent <BulletLifeTimer>(); timer.eraseInsteadOfDie = true; timer.secondsTillDeath = 1.5f; projectile.specRigidbody.CollideWithTileMap = false; SpawnGunjurerBulletScriptOnSpawn script = projectile.gameObject.AddComponent <SpawnGunjurerBulletScriptOnSpawn>(); ProjectileModule.ChargeProjectile chargeProj = new ProjectileModule.ChargeProjectile { Projectile = projectile, ChargeTime = 0.8f, }; gun.DefaultModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile> { chargeProj }; gun.quality = PickupObject.ItemQuality.A; //B ETGMod.Databases.Items.Add(gun, null, "ANY"); GunjurersStaffID = gun.PickupObjectId; }
public static void Add() { Gun gun = ETGMod.Databases.Items.NewGun("Killithid Tendril", "killithidtendril"); Game.Items.Rename("outdated_gun_mods:killithid_tendril", "nn:killithid_tendril"); var behav = gun.gameObject.AddComponent <KillithidTendril>(); behav.preventNormalFireAudio = true; behav.preventNormalReloadAudio = true; behav.overrideNormalFireAudio = "Play_ENM_squidface_cast_01"; behav.overrideNormalReloadAudio = "Play_ENM_squidface_chant_01"; gun.SetShortDescription("Wiggle Wiggle"); gun.SetLongDescription("A tadpole of the Killithid species, capable of opening up portals to it's home dimension." + "\n\nWhile currently dormant, one day it will become active and burrow into the head of a sapient humanoid, eat their brain, and turn them into another Killithid."); gun.SetupSprite(null, "killithidtendril_idle_001", 8); gun.SetAnimationFPS(gun.shootAnimation, 10); gun.gunSwitchGroup = (PickupObjectDatabase.GetById(35) as Gun).gunSwitchGroup; gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false); //GUN STATS gun.DefaultModule.ammoCost = 1; gun.DefaultModule.shootStyle = ProjectileModule.ShootStyle.SemiAutomatic; gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Ordered; gun.reloadTime = 1f; gun.DefaultModule.cooldownTime = 0.4f; gun.muzzleFlashEffects.type = VFXPoolType.None; gun.DefaultModule.numberOfShotsInClip = 200; gun.barrelOffset.transform.localPosition = new Vector3(0.93f, 0.56f, 0f); gun.SetBaseMaxAmmo(200); gun.ammo = 200; gun.gunClass = GunClass.SILLY; Projectile subproj = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]); subproj.gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(subproj.gameObject); UnityEngine.Object.DontDestroyOnLoad(subproj); subproj.baseData.damage = 8f; subproj.SetProjectileSpriteRight("enemystyleproj", 10, 10, true, tk2dBaseSprite.Anchor.MiddleCenter, 8, 8); subProjectile = subproj; //BULLET STATS Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]); projectile.gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(projectile.gameObject); UnityEngine.Object.DontDestroyOnLoad(projectile); projectile.baseData.damage = 15f; projectile.baseData.speed = 0; RandomRoomPosBehaviour roompos = projectile.gameObject.AddComponent <RandomRoomPosBehaviour>(); BulletLifeTimer lifespan = projectile.gameObject.AddComponent <BulletLifeTimer>(); lifespan.secondsTillDeath = 15f; PierceProjModifier piercing = projectile.gameObject.AddComponent <PierceProjModifier>(); piercing.penetration = 100; piercing.penetratesBreakables = true; SpawnProjModifier firing = projectile.gameObject.AddComponent <SpawnProjModifier>(); firing.InFlightSourceTransform = projectile.transform; firing.projectileToSpawnInFlight = subProjectile; firing.PostprocessSpawnedProjectiles = true; firing.spawnProjectilesInFlight = true; firing.spawnProjecitlesOnDieInAir = false; firing.spawnOnObjectCollisions = false; firing.inFlightAimAtEnemies = true; firing.usesComplexSpawnInFlight = true; firing.numToSpawnInFlight = 1; firing.inFlightSpawnCooldown = 1; projectile.baseData.force *= 1.2f; projectile.hitEffects.alwaysUseMidair = true; projectile.hitEffects.overrideMidairDeathVFX = EasyVFXDatabase.YellowLaserCircleVFX; projectile.AnimateProjectile(new List <string> { "goopyproj_001", "goopyproj_002", "goopyproj_003", "goopyproj_004", }, 10, true, new List <IntVector2> { new IntVector2(16, 16), new IntVector2(20, 20), new IntVector2(24, 24), new IntVector2(20, 20), }, 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(16, 16), 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(null, 4), AnimateBullet.ConstructListOfSameValues <Projectile>(null, 4)); gun.DefaultModule.projectiles[0] = projectile; gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.CUSTOM; gun.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("KillithidTendril Bullets", "NevernamedsItems/Resources/CustomGunAmmoTypes/killithidtendril_clipfull", "NevernamedsItems/Resources/CustomGunAmmoTypes/killithidtendril_clipempty"); gun.quality = PickupObject.ItemQuality.B; ETGMod.Databases.Items.Add(gun, null, "ANY"); KillithidTendrilID = gun.PickupObjectId; }
private void PostProcessProjectile(Projectile sourceProjectile, float effectChanceScalar) { if (sourceProjectile.GetComponent <MoonrockProjectile>()) { return; } if (sourceProjectile is InstantDamageOneEnemyProjectile) { return; } if (sourceProjectile is InstantlyDamageAllProjectile) { return; } if (sourceProjectile.GetComponent <ArtfulDodgerProjectileController>()) { return; } PlayerController owner = sourceProjectile.ProjectilePlayerOwner(); int amtOfOrbiters = UnityEngine.Random.Range(0, 4); if (amtOfOrbiters > 0) { for (int i = 0; i < amtOfOrbiters; i++) { GameObject gameObject = SpawnManager.SpawnProjectile(moonrockProjectile.gameObject, sourceProjectile.sprite.WorldCenter, Quaternion.Euler(0f, 0f, (base.Owner.CurrentGun == null) ? 0f : base.Owner.CurrentGun.CurrentAngle), true); Projectile component = gameObject.GetComponent <Projectile>(); if (component != null) { component.Owner = owner; component.Shooter = owner.specRigidbody; component.baseData.damage *= owner.stats.GetStatValue(PlayerStats.StatType.Damage); component.baseData.speed *= owner.stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed); component.baseData.force *= owner.stats.GetStatValue(PlayerStats.StatType.KnockbackMultiplier); component.UpdateSpeed(); component.specRigidbody.CollideWithTileMap = true; BulletLifeTimer timer = component.gameObject.GetOrAddComponent <BulletLifeTimer>(); timer.secondsTillDeath = 30f; OrbitProjectileMotionModule orbitProjectileMotionModule = new OrbitProjectileMotionModule(); orbitProjectileMotionModule.lifespan = 50; orbitProjectileMotionModule.MinRadius = 0.5f; orbitProjectileMotionModule.MaxRadius = 2; orbitProjectileMotionModule.usesAlternateOrbitTarget = true; orbitProjectileMotionModule.OrbitGroup = -5; orbitProjectileMotionModule.alternateOrbitTarget = sourceProjectile.specRigidbody; if (component.OverrideMotionModule != null && component.OverrideMotionModule is HelixProjectileMotionModule) { orbitProjectileMotionModule.StackHelix = true; orbitProjectileMotionModule.ForceInvert = (component.OverrideMotionModule as HelixProjectileMotionModule).ForceInvert; } component.OverrideMotionModule = orbitProjectileMotionModule; component.gameObject.GetOrAddComponent <MoonrockProjectile>(); owner.DoPostProcessProjectile(component); } } } }