public override void FireWeapon() { StandardBullet _clone = (StandardBullet)_bulletScene.Instance(); Node _sceneRoot = GetTree().Root.GetChild(0); _sceneRoot.AddChild(_clone); _clone.GlobalTransform = GlobalTransform; _clone.Scale = new Vector3(4, 4, 4); _clone.BulletDamage = damage; AmmoInWeapon--; Playernode.CreateSound(gunFireSound); }
override protected void fire(Vector3 dir) { if (shotTime <= Time.time) { audio.Play(); GameObject go = Instantiate(shot, whichCan ? cannon1.position : cannon2.position, gun.rotation) as GameObject; StandardBullet sb = go.GetComponent <StandardBullet>(); sb.direction = dir; sb.damage = att[1]; sb.Go(); whichCan = !whichCan; shotTime = Time.time + att[3]; } }
void FireAmmo(Vector3 target) { GameObject ammo = SpawnAmmo(transform.position); if (ammo != null) { ammo.transform.rotation = Quaternion.Euler(0, 0, calculate_angle(enemyAIChasing.target.position, this.transform.position) * Mathf.Rad2Deg); ammo.transform.position += Vector3.up * 0.1f; StandardBullet bulletScript = ammo.GetComponent <StandardBullet>(); Ammo ammoScript = ammo.GetComponent <Ammo>(); ammoScript.piercing = false; ammoScript.damageInflicted = 1; bulletScript.StartTravelBullet(target, weaponVelocity); } }
void FireAmmo() { Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); GameObject ammo = SpawnAmmo(transform.position); ammo.transform.position += Vector3.up * 0.1f; if (ammo != null) { StandardBullet bulletScript = ammo.GetComponent <StandardBullet>(); Ammo ammoScript = ammo.GetComponent <Ammo>(); ammoScript.piercing = false; ammoScript.damageInflicted = weapon.damage; bulletScript.StartTravelBullet(mousePosition, weaponVelocity); } }
public void FireBullet() { if (_useRaycast) { _nodeRaycast.LookAt(_currentKinematic.GlobalTransform.origin + new Vector3(0, _playerHeight, 0), new Vector3(0, 1, 0)); _nodeRaycast.ForceRaycastUpdate(); if (_nodeRaycast.IsColliding()) { Godot.Object _body = _nodeRaycast.GetCollider(); if (_body.HasMethod("BulletHit")) { _callback = GD.FuncRef(_body, "BulletHit"); _callback.CallFunc(_TurretDamageRaycast, _nodeRaycast.GetCollisionPoint()); } _ammoInTurret--; } } else { StandardBullet _clone = (StandardBullet)_bulletScene.Instance(); Node _sceneRoot = GetTree().Root.GetChild(0); _sceneRoot.AddChild(_clone); _clone.GlobalTransform = GetNode <Spatial>("Head/Barrel_End").GlobalTransform; _clone.Scale = new Vector3(10, 10, 5); _clone.BulletDamage = _TurretDamageBullet; _clone.BulletSpeed = 5; _clone.Gravity = -0.1f; _ammoInTurret--; } _nodeFlashOne.Visible = true; _nodeFlashTwo.Visible = true; _flashTimer = _flashTime; _fireTimer = _fireTime; if (_ammoInTurret <= 0) { _ammoReloadTimer = _ammoReloadTime; } }
public void seek(Transform _target, int p) { SoundManagerScript.playsound("standardshoot"); bullet = new StandardBullet(p); target = _target; }