Here is my second problem:
- Any target I have, miraculously, instantiates an “Impact” effect after my player performs a combo attack on that target (somehow, I got an impact strike back from a static cube (after a combo attack), let alone my AI enemies)
This one is as direct as the name says, and I will post my ‘PlayerImpactState.cs’, as I believe it can be a potential suspect script:
using UnityEngine;
public class PlayerImpactState : PlayerBaseState
{
private readonly int ImpactHash = Animator.StringToHash("Impact");
private readonly float CrossFadeDuration = 0.3f;
private float duration = 1.0f;
public PlayerImpactState(PlayerStateMachine stateMachine) : base(stateMachine) {}
public override void Enter()
{
stateMachine.Animator.CrossFadeInFixedTime(ImpactHash, CrossFadeDuration);
}
public override void Tick(float deltaTime)
{
Move(deltaTime);
// Impact duration:
duration -= deltaTime;
// If the impact duration is over, return the player to locomotion (which takes care of him, be it if he's in FreeLook or Targeting State):
if (duration <= 0) {
ReturnToLocomotion();
}
}
public override void Exit() {}
}