added fixed dash targets and can dash towards enemies to hit them, get a knockback or dash through if killed
This commit is contained in:
31
scenes/FixedDashTarget/FixedDashthroughTarget.cs
Normal file
31
scenes/FixedDashTarget/FixedDashthroughTarget.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Movementtests.interfaces;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class FixedDashthroughTarget : AnimatableBody3D, ITargetable, IStunnable
|
||||
{
|
||||
public Vector3 GetTargetGlobalPosition()
|
||||
{
|
||||
return GlobalPosition;
|
||||
}
|
||||
|
||||
private uint _defaultCollisionMask;
|
||||
public override void _Ready()
|
||||
{
|
||||
_defaultCollisionMask = CollisionMask;
|
||||
}
|
||||
|
||||
public bool IsStunned { get; set; }
|
||||
public float StunDuration { get; set; } = 0.1f;
|
||||
public void Stun()
|
||||
{
|
||||
_defaultCollisionMask = 0;
|
||||
GetTree().CreateTimer(StunDuration).Timeout += Unstun;
|
||||
}
|
||||
|
||||
public void Unstun()
|
||||
{
|
||||
_defaultCollisionMask = CollisionMask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user