3D bullet rotation

This commit is contained in:
Marco 2025-07-01 13:40:13 +02:00
commit 1a455251a9
43 changed files with 279 additions and 203 deletions

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Cirno.Scripts.Components;
using Cirno.Scripts.Utils;
using Godot;
using Godot.Collections;
@ -12,6 +13,8 @@ public partial class BulletResource : Resource
{
[Export]
public PackedScene BulletScene { get; set; }
[Export] public Texture2D BulletSprite { get; set; }
[Export] public float BulletSize { get; set; }
[Export] public PackedScene DestructionParticlesScene { get; set; }
[Export] public float BulletSpeed = 100f;
[Export] public Vector2 Direction = Vector2.Right;
@ -19,13 +22,8 @@ public partial class BulletResource : Resource
[Export] public float MaxDamage = 1;
[Export] public float Knockback = 1;
[Export] public float LifeTime = 10f;
[Export] public bool DestroyOnCollision = true;
[Export] public BulletOwner Owner = BulletOwner.None;
[Export] public DamageType DamageType = DamageType.Neutral;
[Export] public bool RotateSprite = false;
[Export] public bool Controllable = false;
[Export] public bool Freezable { get; set; } = true;
[Export] public bool Grazeable { get; set; } = true;
[Export] public float GrazeValue { get; set; } = 0.2f;
[Export] public BulletFlags Attributes { get; set; }
@ -51,13 +49,13 @@ public partial class BulletResource : Resource
RotationOffset = rotationOffset,
Modifier = Modifier,
LifeTime = LifeTime,
DestroyOnCollision = DestroyOnCollision,
DestroyOnCollision = Attributes.HasNoFlags(BulletFlags.Piercing),
DestructionParticlesScene = DestructionParticlesScene,
RotateSprite = RotateSprite,
Controllabe = Controllable,
Freezable = Freezable,
RotateSprite = Attributes.HasFlag(BulletFlags.Rotateable),
Controllabe = Attributes.HasFlag(BulletFlags.Controllable),
Freezable = Attributes.HasFlag(BulletFlags.Freezable),
TimeModifiers = TimeModifiers.Select(x => x).ToList(),
Grazeable = Grazeable,
Grazeable = Attributes.HasFlag(BulletFlags.Grazeable),
GrazeValue = GrazeValue,
Attributes = Attributes,
// TimeModifiers = TimeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().Select(m => new ModifierWrapper()