mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 12:05:54 +00:00
Bullet resource
This commit is contained in:
parent
76221ca7a6
commit
07f6e58ebd
19 changed files with 236 additions and 50 deletions
46
Scripts/Resources/BulletResource.cs
Normal file
46
Scripts/Resources/BulletResource.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cirno.Scripts.Components;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class BulletResource : Resource
|
||||
{
|
||||
[Export]
|
||||
public PackedScene BulletScene { get; set; }
|
||||
[Export] public PackedScene DestructionParticlesScene { get; set; }
|
||||
[Export] public float BulletSpeed = 100f;
|
||||
[Export] public float BulletDamage = 1;
|
||||
[Export] public float LifeTime = 10f;
|
||||
[Export] public BulletOwner Owner = BulletOwner.None;
|
||||
[Export] public DamageType DamageType = DamageType.Neutral;
|
||||
|
||||
[Export]
|
||||
public Resource Modifier;
|
||||
[Export] public Array<Resource> TimeModifiers;
|
||||
|
||||
public BulletInfo MakeBullet(Vector2 position, int count = 1, float spread = 0f, float rotationOffset = 0f)
|
||||
{
|
||||
return new BulletInfo()
|
||||
{
|
||||
Position = position,
|
||||
Direction = Vector2.Right,
|
||||
Speed = BulletSpeed,
|
||||
Owner = Owner,
|
||||
DamageType = DamageType,
|
||||
Damage = BulletDamage,
|
||||
BulletCount = count,
|
||||
Spread = spread,
|
||||
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>()
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue