mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Destroyable props
This commit is contained in:
parent
93469062a1
commit
44ebc70448
52 changed files with 1387 additions and 18428 deletions
|
|
@ -26,8 +26,6 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
|
||||
private List<ModifierWrapper> _modifiers = new();
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
public bool IsGrazed { get; set; } = false;
|
||||
|
||||
public bool IsFrozen { get; private set; } = false;
|
||||
|
|
@ -49,11 +47,10 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
_collisionShape = GetNode<CollisionShape3D>("CollisionShape");
|
||||
}
|
||||
|
||||
public void Initialize(BulletInfo bulletInfo, GameManager gameManager)
|
||||
public void Initialize(BulletInfo bulletInfo)
|
||||
{
|
||||
_bulletInfo = bulletInfo;
|
||||
|
||||
_gameManager = gameManager;
|
||||
|
||||
|
||||
_elapsedTime = 0f;
|
||||
|
||||
|
|
@ -163,12 +160,12 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
|
||||
public void FacePlayer()
|
||||
{
|
||||
if (_gameManager.Player != null)
|
||||
{
|
||||
//_direction = (_gameManager.PlayerPosition.Value - this.GlobalPosition).Normalized();
|
||||
RotateBullet(0); // quick hack to rotate lasers
|
||||
//LookAt(player.GlobalPosition);
|
||||
}
|
||||
// if (_gameManager.Player != null)
|
||||
// {
|
||||
// //_direction = (_gameManager.PlayerPosition.Value - this.GlobalPosition).Normalized();
|
||||
// RotateBullet(0); // quick hack to rotate lasers
|
||||
// //LookAt(player.GlobalPosition);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -236,6 +233,16 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
|
||||
private void _on_body_entered(Node3D body)
|
||||
{
|
||||
if (body.IsInGroup("Destroyable") && body is IDestructible destructible &&
|
||||
CanHit(BulletOwner, destructible.BulletGroup))
|
||||
{
|
||||
// hit
|
||||
destructible.Hit(Damage, DamageType);
|
||||
|
||||
RequestCollisionDestruction();
|
||||
return;
|
||||
}
|
||||
|
||||
if (body.IsInGroup("Solid"))
|
||||
{
|
||||
//Debug.WriteLine("Collision");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public interface IBullet
|
|||
|
||||
public delegate void OnDestroyEventHandler();
|
||||
|
||||
public void Initialize(BulletInfo bulletInfo, GameManager gameManager);
|
||||
public void Initialize(BulletInfo bulletInfo);
|
||||
|
||||
public void Enable();
|
||||
public void Disable(bool hideSprite = true);
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public partial class Weapon3D : Node3D
|
|||
GetBulletStrengthMultiplier(bulletData.Damage, bulletData.OriginalBulletResource.MaxDamage, 20);
|
||||
}
|
||||
|
||||
bullet.Initialize(bulletData, _gameManager);
|
||||
bullet.Initialize(bulletData);
|
||||
|
||||
//bullet.SetDirection(ShootDirection);
|
||||
bullet.SetDirection(spreadDirection);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue