mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:55:35 +00:00
76 lines
No EOL
2.2 KiB
C#
76 lines
No EOL
2.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Cirno.Scripts.Components;
|
|
using Godot;
|
|
using Godot.Collections;
|
|
|
|
namespace Cirno.Scripts.Resources;
|
|
|
|
[GlobalClass]
|
|
public partial class WeaponResource : Resource
|
|
{
|
|
[Export]
|
|
public string Name { get; set; }
|
|
|
|
[Export] public BulletResource BulletData { get; private set; }
|
|
|
|
//[Export]
|
|
//public PackedScene BulletScene { get; set; }
|
|
|
|
//[Export] public PackedScene DestructionParticlesScene { get; set; }
|
|
|
|
[Export] public double RateOfFire = 0.4f;
|
|
|
|
[Export] public int BulletCapacity = 20;
|
|
|
|
[Export] public double ReloadTime = 1.0f;
|
|
|
|
[Export] public bool AutoReload = true;
|
|
|
|
[Export] public bool InfiniteAmmo = true;
|
|
|
|
[Export] public int BulletsPerShot = 1;
|
|
|
|
[Export] public float SpreadAngle = 0f;
|
|
[Export] public float RandomSpread = 0f;
|
|
|
|
[Export] public string ItemKey;
|
|
|
|
#region Bullet spawn data
|
|
|
|
[Export] public string AmmoKey;
|
|
//[Export] public float BulletSpeed = 100f;
|
|
//[Export] public float BulletDamage = 1;
|
|
//[Export] public float LifeTime = 10f;
|
|
[Export] private float _rotationOffset = 0f;
|
|
//[Export] private BulletOwner owner = BulletOwner.None;
|
|
//[Export] private DamageType _damageType = DamageType.Neutral;
|
|
//[Export] private Resource _modifier;
|
|
//[Export] private Array<Resource> _timeModifiers;
|
|
|
|
#endregion
|
|
|
|
public BulletInfo MakeBullet(Vector2 position)
|
|
{
|
|
return BulletData.MakeBullet(position, BulletsPerShot, SpreadAngle, _rotationOffset);
|
|
|
|
// return new BulletInfo()
|
|
// {
|
|
// Position = position,
|
|
// Direction = Vector2.Right,
|
|
// Speed = BulletSpeed,
|
|
// Owner = owner,
|
|
// DamageType = _damageType,
|
|
// Damage = BulletDamage,
|
|
// BulletCount = BulletsPerShot,
|
|
// Spread = SpreadAngle,
|
|
// BulletScene = BulletScene,
|
|
// RotationOffset = _rotationOffset,
|
|
// Modifier = _modifier as IBulletModifier,
|
|
// LifeTime = LifeTime,
|
|
// DestructionParticlesScene = DestructionParticlesScene,
|
|
// TimeModifiers = _timeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().ToList() ??
|
|
// new List<TimeModifier>()
|
|
// };
|
|
}
|
|
} |