/// <summary> /// Load the ammo /// </summary> public override void Load() { RifleAmmo rifleAmmo = GameResources.GetInstance().Get <RifleAmmo>(); rifleHolder.AddChild(rifleAmmo); this.WeaponAmmo = rifleAmmo; }
/// <summary> /// Shoot the ammo /// </summary> /// <param name="elapsedTime">Time elasped between the pression and the release of the button</param> public override void Shoot(int elapsedTime) { Vector2 direction = GetMouseDirection(); this.Load(); rifleHolder.RemoveChild(WeaponAmmo); GetTree().GetRoot().AddChild(WeaponAmmo); WeaponAmmo.SetGlobalPosition(rifleHolder.GlobalPosition); RifleAmmo rifleAmmo = WeaponAmmo as RifleAmmo; rifleAmmo.Launch(direction, STRENGTH_FACTOR); }