protected void attack() { GameObject bullet = Instantiate(owner.bullet, owner.ActiveWeapon.transform.position, Quaternion.identity); BulletStateMachine stateMachine = bullet.GetComponent <BulletStateMachine>(); stateMachine.hasKnockback = true; stateMachine.SendBullet(owner.ActiveWeapon.transform.forward.normalized * bulletAcceleration, owner.attackDamage); owner.bulletsShotSinceReload++; EventSystem.Current.FireEvent(new PlaySoundEvent(owner.transform.position, owner.GunSound, 1f, 0.9f, 1.1f)); }
private void attack() { GameObject bullet = Instantiate(owner.bullet, owner.gun.transform.position, Quaternion.identity); BulletStateMachine stateMachine = bullet.GetComponent <BulletStateMachine>(); stateMachine.SendBullet(owner.gun.transform.forward.normalized * bulletAcceleration, owner.attackDamage); owner.bulletsShotSinceReload++; EventSystem.Current.FireEvent(new PlaySoundEvent(owner.transform.position, owner.GunSound, 1f, 0.9f, 1.1f)); if (owner.bulletsShotSinceReload >= owner.bulletsBeforeReload && owner.DoingKnockback == false) { owner.bulletsShotSinceReload = 0; owner.Transition <BondeRangedReloadState>(); } // Debug.Log("pew"); }