protected override bool OnCast(Entity source) { var proj = BombProjectile.Fire(source.GameObject); Effects.SpellCastEffect.Display(proj.Position, proj.Rotation, true); return(true); }
public override void AnimationHit() { BomberView v = (BomberView)view; BombProjectile bomb = pool.Spawn(curTarget.gameObject, 60, 5, this.gameObject); bomb.transform.position = v.bombPosition.position; bomb.transform.rotation = Quaternion.identity; }
//Function called externally to perform the main fire public override void FireWeapon(bool pressed_, bool held_, bool released_) { //If we're not pressing the fire button, nothing happens if (!pressed_) { return; } //If our current cooldown time is above 0 or there's no ammo, we can't fire if (this.ourBomb == null) { if (this.currentCooldown > 0 || (this.currentAmmo <= 0 && !this.unlimitedAmmo)) { return; } } //If we don't already have a bomb launched, we fire one if (this.ourBomb == null) { //Otherwise we create an instance of the fired projectile at our muzzle location GameObject projectile = GameObject.Instantiate(this.firedProjectile.gameObject, this.muzzleAudio.transform.position, this.muzzleAudio.transform.rotation); //Setting the projectile's fire data projectile.GetComponent <WeaponProjectile>().SetProjectileInfo(this.objectIDType); //If the projectile we fire is a bomb, we save the component reference if (projectile.GetComponent <BombProjectile>()) { this.ourBomb = projectile.GetComponent <BombProjectile>(); } //Setting our weapon cooldown this.currentCooldown = this.weaponCooldown; //Playing the muzzle's audio source this.muzzleAudio.ownerAudio.Play(); //Subtracting from our current ammo supply (if it's not unlimited) if (!this.unlimitedAmmo) { this.currentAmmo -= 1; } } //If we already have a bomb launched, we detonate it else { this.ourBomb.DetonateBomb(); this.ourBomb = null; } }