public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { if (launchCoolDownTimer <= 0) { launchCoolDownTimer = 1f; if (ActiveBullets.Count > 0) { foreach (Projectile bullet in ActiveBullets) { if (bullet) { bullet.SendInDirection(gun.CurrentAngle.DegreeToVector2(), false, true); bullet.baseData.speed *= 10000; //bullet.Speed *= 1000; bullet.UpdateSpeed(); BulletsToRemoveFromActiveBullets.Add(bullet); } } foreach (Projectile bullet in BulletsToRemoveFromActiveBullets) { ActiveBullets.Remove(bullet); } BulletsToRemoveFromActiveBullets.Clear(); } } base.OnReloadPressed(player, gun, bSOMETHING); }
public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { if (ActiveBullets.Count > 0) { foreach (Projectile bullet in ActiveBullets) { if (bullet) { Vector2 dirVec = UnityEngine.Random.insideUnitCircle; Vector2 bulletPosition = bullet.sprite.WorldCenter; Func <AIActor, bool> isValid = (AIActor a) => a && a.HasBeenEngaged && a.healthHaver && a.healthHaver.IsVulnerable; IntVector2 bulletPositionIntVector2 = bulletPosition.ToIntVector2(); AIActor closestToPosition = BraveUtility.GetClosestToPosition <AIActor>(GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(bulletPositionIntVector2).GetActiveEnemies(RoomHandler.ActiveEnemyType.All), bullet.sprite.WorldCenter, isValid, new AIActor[] { }); if (closestToPosition) { dirVec = closestToPosition.CenterPosition - bullet.transform.position.XY(); } bullet.SendInDirection(dirVec, false, true); if (!player.PlayerHasActiveSynergy("Pistols Requiem")) { BulletsToRemoveFromActiveBullets.Add(bullet); } } } foreach (Projectile bullet in BulletsToRemoveFromActiveBullets) { ActiveBullets.Remove(bullet); } BulletsToRemoveFromActiveBullets.Clear(); } base.OnReloadPressed(player, gun, bSOMETHING); }
public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { if (ActiveBullets.Count > 0) { foreach (Projectile bullet in ActiveBullets) { if (bullet) { Vector2 vector = player.CenterPosition; Vector2 normalized = (player.unadjustedAimPoint.XY() - vector).normalized; bullet.SendInDirection(normalized, false, true); bullet.baseData.speed *= 10000; //bullet.Speed *= 1000; bullet.UpdateSpeed(); BulletsToRemoveFromActiveBullets.Add(bullet); } } foreach (Projectile bullet in BulletsToRemoveFromActiveBullets) { ActiveBullets.Remove(bullet); } BulletsToRemoveFromActiveBullets.Clear(); } base.OnReloadPressed(player, gun, bSOMETHING); }
public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { if (ActiveBullets.Count > 0) { foreach (Projectile bullet in ActiveBullets) { if (bullet) { bullet.ReAimToNearestEnemy(); bullet.baseData.speed *= 7500; bullet.UpdateSpeed(); BulletsToRemoveFromActiveBullets.Add(bullet); } } foreach (Projectile bullet in BulletsToRemoveFromActiveBullets) { ActiveBullets.Remove(bullet); } BulletsToRemoveFromActiveBullets.Clear(); } if (gun.ClipShotsRemaining == 0 && gun.CurrentAmmo != 0 && canReleaseRing) { GameManager.Instance.StartCoroutine(this.DoRingBullets(Ringbullet, gun)); canReleaseRing = false; Invoke("HandleRingCooldown", 1f); } base.OnReloadPressed(player, gun, bSOMETHING); }
private void OnHitEnemy(Projectile self, SpeculativeRigidbody enemy, bool fatal) { if (ActiveBullets.Contains(self)) { if (enemy && enemy.gameActor) { float chance = 1f; if (enemy.healthHaver && enemy.healthHaver.IsBoss) { chance = 0.33f; } enemy.gameActor.DeleteOwnedBullets(chance); } } }
public override void PostProcessProjectile(Projectile projectile) { PlayerController player = projectile.Owner as PlayerController; if (player != null && player.PlayerHasActiveSynergy("Freehand")) { InstantTeleportToPlayerCursorBehav tp = projectile.gameObject.GetOrAddComponent <InstantTeleportToPlayerCursorBehav>(); } ActiveBullets.Add(projectile); projectile.specRigidbody.OnPreTileCollision += this.onhit; if (player.PlayerHasActiveSynergy("Stationary")) { projectile.OnHitEnemy += this.OnHitEnemy; } base.PostProcessProjectile(projectile); }
public override void PostProcessProjectile(Projectile projectile) { PlayerController player = projectile.Owner as PlayerController; if (player != null) { if (player.PlayerHasActiveSynergy("Advanced Ammomancy")) { if (projectile.gameObject.GetComponent <BooklletTimedReAim>()) { Destroy(projectile.gameObject.GetComponent <BooklletTimedReAim>()); } ActiveBullets.Add(projectile); } } base.PostProcessProjectile(projectile); }
/// <summary> /// This method is used to shoot in the direction of another Unit object /// This should only be called if the unit is inside of the fire radius /// </summary> /// <param name="u">The unit to shoot</param> /// <param name="gt">The game time in order to calculate the delate between shots</param> public void Shoot(Unit u, GameTime gt) { Vector2 distance = new Vector2(this.Position.X - u.Position.X, Position.Y - u.Position.Y); double timer = gt.ElapsedGameTime.TotalSeconds; remainingTime_ -= timer; if (remainingTime_ <= 0) { Bullet newBullet = new Bullet(50, this.AttackStrength, FIRE_RADIUS, 5, this.Position, BulletTexture); newBullet.Bounds = new BoundingSphere(new Vector3(newBullet.Position.X, newBullet.Position.Y, 0), (float)newBullet.Size / 2); newBullet.Destination = u.Position; ActiveBullets.Add(newBullet); newBullet = null; remainingTime_ = _DELAY_BETWEEN_SHOOTS; } }
public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { if (ActiveBullets.Count > 0) { foreach (Projectile bullet in ActiveBullets) { if (bullet) { bullet.ReAimToNearestEnemy(); if (!player.PlayerHasActiveSynergy("Pistols Requiem")) { BulletsToRemoveFromActiveBullets.Add(bullet); } } } foreach (Projectile bullet in BulletsToRemoveFromActiveBullets) { ActiveBullets.Remove(bullet); } BulletsToRemoveFromActiveBullets.Clear(); } base.OnReloadPressed(player, gun, bSOMETHING); }
public override void PostProcessProjectile(Projectile projectile) { ActiveBullets.Add(projectile); base.PostProcessProjectile(projectile); }
public override void PostProcessProjectile(Projectile projectile) { ActiveBullets.Add(projectile); projectile.specRigidbody.OnPreTileCollision += this.onhit; base.PostProcessProjectile(projectile); }