mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 08:25:53 +00:00
Shooting
This commit is contained in:
parent
1229613def
commit
341f76d885
17 changed files with 156 additions and 55 deletions
|
|
@ -36,17 +36,17 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
[Signal]
|
||||
public delegate void OnDestroyEventHandler();
|
||||
|
||||
private AudioStreamPlayer2D _grazeSound;
|
||||
private GpuParticles2D _grazeParticles;
|
||||
private AudioStreamPlayer3D _grazeSound;
|
||||
private GpuParticles3D _grazeParticles;
|
||||
|
||||
private CollisionShape2D _collisionShape2D;
|
||||
private CollisionShape3D _collisionShape;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_grazeSound = GetNodeOrNull<AudioStreamPlayer2D>("AudioStreamPlayer2D");
|
||||
_grazeParticles = GetNodeOrNull<GpuParticles2D>("GrazeParticles");
|
||||
_grazeSound = GetNodeOrNull<AudioStreamPlayer3D>("AudioStreamPlayer");
|
||||
_grazeParticles = GetNodeOrNull<GpuParticles3D>("GrazeParticles");
|
||||
|
||||
_collisionShape2D = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
_collisionShape = GetNode<CollisionShape3D>("CollisionShape");
|
||||
}
|
||||
|
||||
public void Initialize(BulletInfo bulletInfo, GameManager gameManager)
|
||||
|
|
@ -77,12 +77,12 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
{
|
||||
Enabled = true;
|
||||
Show();
|
||||
if (this._collisionShape2D is null)
|
||||
if (this._collisionShape is null)
|
||||
{
|
||||
_collisionShape2D = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
_collisionShape = GetNode<CollisionShape3D>("CollisionShape");
|
||||
}
|
||||
|
||||
_collisionShape2D.SetDeferred(CollisionShape2D.PropertyName.Disabled, false);
|
||||
_collisionShape.SetDeferred(CollisionShape3D.PropertyName.Disabled, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -96,12 +96,12 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
Hide();
|
||||
}
|
||||
|
||||
if (this._collisionShape2D is null)
|
||||
if (this._collisionShape is null)
|
||||
{
|
||||
_collisionShape2D = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
_collisionShape = GetNode<CollisionShape3D>("CollisionShape2D");
|
||||
}
|
||||
|
||||
_collisionShape2D.SetDeferred(CollisionShape2D.PropertyName.Disabled, true);
|
||||
_collisionShape.SetDeferred(CollisionShape2D.PropertyName.Disabled, true);
|
||||
}
|
||||
|
||||
public void Graze()
|
||||
|
|
@ -209,7 +209,9 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
ControlBullet(delta);
|
||||
}
|
||||
|
||||
//this.Position += ((float)(Speed * delta) * _direction);
|
||||
var newPos2D = ((float)(Speed * delta) * _direction);
|
||||
|
||||
this.Position += new Vector3(newPos2D.X, 0, newPos2D.Y);
|
||||
}
|
||||
|
||||
private void ControlBullet(double delta)
|
||||
|
|
@ -232,7 +234,7 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
Destroy();
|
||||
}
|
||||
|
||||
private void _on_body_entered(Node2D body)
|
||||
private void _on_body_entered(Node3D body)
|
||||
{
|
||||
if (body.IsInGroup("Solid"))
|
||||
{
|
||||
|
|
@ -247,7 +249,7 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
// }
|
||||
}
|
||||
|
||||
private void _on_area_entered(Area2D area)
|
||||
private void _on_area_entered(Area3D area)
|
||||
{
|
||||
if (area.IsInGroup("Solid"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue