cirnogodot/Scripts/Components/BulletInfo.cs

58 lines
2.3 KiB
C#
Raw Normal View History

2025-06-03 10:11:09 +02:00
using System.Collections.Generic;
2026-01-31 10:23:10 +01:00
using Cirno.Scripts.Actors._3D;
2025-06-03 10:11:09 +02:00
using Cirno.Scripts.Resources;
2025-09-24 16:51:47 +02:00
using Cirno.Scripts.Utils;
2026-02-28 18:44:23 +01:00
using Cirno.Scripts.Weapons;
2025-06-03 10:11:09 +02:00
using Godot;
namespace Cirno.Scripts.Components;
public class BulletInfo(BulletResource originalBulletResource)
{
public BulletResource OriginalBulletResource { get; set; } = originalBulletResource;
public Vector2 Position { get; set; }
public Vector2 Direction { get; set; }
public float Speed { get; set; }
public float LifeTime { get; set; }
2025-09-24 16:51:47 +02:00
public bool DestroyOnCollision => Attributes.HasNoFlags(BulletFlags.Piercing);
2025-06-03 10:11:09 +02:00
public BulletOwner Owner { get; set; }
public DamageType DamageType { get; set; }
public float Damage { get; set; }
public float Knockback { get; set; }
public int BulletCount { get; set; }
public float RotationSpeed { get; set; }
public float RotationOffset { get; set; }
//public double Time { get; set; }
public float Spread { get; set; }
2025-09-24 16:51:47 +02:00
public bool RotateSprite => Attributes.HasFlag(BulletFlags.Rotateable);
public bool Controllabe => Attributes.HasFlag(BulletFlags.Controllable);
public bool Freezable => Attributes.HasFlag(BulletFlags.Freezable);
2025-06-03 10:11:09 +02:00
public PackedScene BulletScene { get; set; }
public PackedScene DestructionParticlesScene { get; set; }
public IBulletModifier Modifier { get; set; }
public List<TimeModifier> TimeModifiers { get; set; } = new List<TimeModifier>();
2025-09-24 16:51:47 +02:00
public bool Grazeable => Attributes.HasFlag(BulletFlags.Grazeable);
2025-06-03 10:11:09 +02:00
public float GrazeValue { get; set; }
public BulletFlags Attributes { get; set; }
#region Laser
public bool IsLaser { get; set; }
2026-01-31 10:23:10 +01:00
public LaserConfig LaserConfig { get; set; } // For 3D lasers
// 2D Laser properties (legacy support)
public float SpawnDelay { get; set; } = 0.3f;
public float PreFireTime { get; set; } = 0.5f;
public float LethalTime { get; set; } = 1.5f;
public Color PreFireColor { get; set; } = new Color(1, 0, 0, 0.5f);
public Color LethalColor { get; set; } = new Color(1, 0, 0, 1.0f);
2025-06-03 10:11:09 +02:00
#endregion
2026-02-28 18:44:23 +01:00
// Runtime: reference to the Weapon instance that fired this bullet.
// This is NOT a Resource and will not be serialized; it simply lets
// hit handlers attribute kills to a particular weapon instance.
public Weapon3D SourceWeapon { get; set; }
2025-06-03 10:11:09 +02:00
}