added a parry button and animation that lets player chose their enemy hit behaviour
This commit is contained in:
@@ -11,6 +11,11 @@ public partial class HeadSystem : Node3D
|
||||
public delegate void HitboxActivatedEventHandler();
|
||||
[Signal]
|
||||
public delegate void HitboxDeactivatedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void ParryboxActivatedEventHandler();
|
||||
[Signal]
|
||||
public delegate void ParryboxDeactivatedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void HitTargetEventHandler();
|
||||
@@ -80,6 +85,8 @@ public partial class HeadSystem : Node3D
|
||||
|
||||
[ExportGroup("First Person rig")]
|
||||
private Node3D _fpRig;
|
||||
private Node3D _rightHandedWeapon;
|
||||
private Node3D _leftHandedWeapon;
|
||||
private Node3D _fpDisplacedRig;
|
||||
private Vector3 _fpDisplacedRigInitialRotation;
|
||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||
@@ -110,6 +117,8 @@ public partial class HeadSystem : Node3D
|
||||
_animationTree = GetNode<AnimationTree>("AnimationTree");
|
||||
|
||||
_fpRig = GetNode<Node3D>("FPRig");
|
||||
_rightHandedWeapon = GetNode<Node3D>("FPRig/Sword");
|
||||
_leftHandedWeapon = GetNode<Node3D>("FPRig/Parry");
|
||||
_fpDisplacedRig = GetNode<Node3D>("FPRig/Sword");
|
||||
_fpDisplacedRigInitialRotation = _fpDisplacedRig.Rotation;
|
||||
|
||||
@@ -133,6 +142,10 @@ public partial class HeadSystem : Node3D
|
||||
{
|
||||
_animationTree.Set("parameters/OnHit/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||
}
|
||||
public void OnParry()
|
||||
{
|
||||
_animationTree.Set("parameters/OnParry/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);
|
||||
}
|
||||
public void OnStartDeathAnimation()
|
||||
{
|
||||
_isPlayingForcingAnim = true;
|
||||
@@ -162,6 +175,15 @@ public partial class HeadSystem : Node3D
|
||||
EmitSignalHitboxDeactivated();
|
||||
}
|
||||
|
||||
public void OnParryboxActivated()
|
||||
{
|
||||
EmitSignalHitboxActivated();
|
||||
}
|
||||
public void OnParryboxDeactivated()
|
||||
{
|
||||
EmitSignalHitboxDeactivated();
|
||||
}
|
||||
|
||||
private bool _footstepEmitted;
|
||||
private bool _isPlayingForcingAnim;
|
||||
|
||||
@@ -300,11 +322,11 @@ public partial class HeadSystem : Node3D
|
||||
|
||||
public void HideWeapon()
|
||||
{
|
||||
_fpRig.Visible = false;
|
||||
_rightHandedWeapon.Visible = false;
|
||||
}
|
||||
public void ShowWeapon()
|
||||
{
|
||||
_fpRig.Visible = true;
|
||||
_rightHandedWeapon.Visible = true;
|
||||
}
|
||||
|
||||
public float ComputeCameraInclineFactor(Vector3 direction)
|
||||
|
||||
Reference in New Issue
Block a user