public override bool Use(Vector2 direction) { if (base.Use(direction)) { GameObject p = RefProjectileManager.FetchLightning(); if (p) { p.GetComponent <Lightning>().Activate(firePoint, this, direction, LightningChainTimes, Range * RefProjectileManager.GetComponent <TileMap>().TileSize); // Play the sound SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Weapon_Attack_4); return(true); } } return(false); }
protected override void combinedUse(Weapon other, params object[] details) { // Destroy the projectile // -- Find Projectile Projectile projectile = details.OfType <Projectile>().Select(o => o).FirstOrDefault(); #region Flying Sword if (other is Crossbow) { // Check if we can launch a flying sword if (gameObject.activeSelf) { // Launch a Flying Sword var flyingsword = RefProjectileManager.FetchFlyingSword().GetComponent <FlyingSword>(); var parent = GetComponentInParent <RPGPlayer>(); if (flyingsword && parent) { flyingsword.Activate(transform, this, parent.CurrentDirection, Range * RefProjectileManager.GetComponent <TileMap>().TileSize); } // Play the sound SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Combo_PiercingSword); } } #endregion #region Big Sword else if (other is Wand) { // Set the sword to be larger setBigSword(true); // Play the sound SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Combo_Enchant); } #endregion }
public override bool Use(Vector2 direction) { if (base.Use(direction)) { Projectile toShoot = null; // Decide which type of arrow to shoot if (empowered) { // Fetch an Empowered Arrow toShoot = RefProjectileManager.FetchEmpoweredArrow().GetComponent <EmpoweredArrow>(); // Play the sound SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Weapon_Attack_1); // Turn off the empowerment setEmpowered(false); } else { // Fetch an Arrow toShoot = RefProjectileManager.FetchArrow().GetComponent <Arrow>(); // Play the sound SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Weapon_Attack_3); } // Error Checking if (toShoot != null) { toShoot.Activate(firePoint, this, direction, Range * RefProjectileManager.GetComponent <TileMap>().TileSize); return(true); } } return(false); }
protected override void combinedUse(Weapon other, params object[] details) { // Destroy the projectile // -- Find Projectile Projectile projectile = null; foreach (var o in details) { // We found it if (o is Projectile) { // Store it projectile = o as Projectile; break; } } #region Arrow Barrage if (other is Crossbow) { // Spawn Barrage of Arrows float barrageLeftAngle = (180 - BarrageFOV) * 0.5f; // Dictates where we should start shooting from float degreeOfDifference = BarrageFOV / BarrageArrows; // Get the angle in degrees between each arrow's direction var parent = GetComponentInParent <RPGPlayer>(); // Handle to thhe weapon's parent to get user direction // We got a handle to the parent? if (parent != null) { // Determine the Right Vector where we start shooting from Vector2 right = new Vector2(parent.CurrentDirection.y, -parent.CurrentDirection.x); // Shoot every arrow we need to shoot for (int i = 0; i < BarrageArrows; i++) { // Fetch an arrow var arrow = RefProjectileManager.FetchArrow().GetComponent <Arrow>(); // If we are able to get an arrow if (arrow) { // Determine the angle of this shot float arrowAngle = barrageLeftAngle + (degreeOfDifference * i); // Get a rotation to calculate the direction vector Quaternion rot = Quaternion.AngleAxis(arrowAngle, new Vector3(0.0f, 0.0f, 1.0f)); // Calculate the direction vector Vector2 dir = (rot * right).normalized; //Debug.DrawLine(firePoint.position, firePoint.position + (Vector3)(dir * BarrageRange), Color.red, 5.0f); // Shoot the arrow arrow.Activate(firePoint, this, dir, Quaternion.FromToRotation(Vector2.up, dir), BarrageRange * RefProjectileManager.GetComponent <TileMap>().TileSize); } } } SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Combo_ArrowBarrage); } #endregion #region Big Shield else if (other is Wand) { // Activate the large shield if (bigShieldTimer <= 0.0f) { // Start the timer bigShieldTimer = (float)TimeManager.GetDeltaTime(TimeManager.TimeType.Game); // Trigger the Shield anim.SetBool(animBigShield, true); // Play the sound SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Combo_Enchant); } } #endregion }