added: new maru model and downed animation

This commit is contained in:
Chris
2025-10-20 13:47:16 -04:00
parent aa3c51f06e
commit 6d57b7bb56
8 changed files with 512 additions and 14 deletions

View File

@@ -0,0 +1,44 @@
using System;
using UnityEngine;
namespace Reset.Units{
public class UnitAnimation : UnitComponent{
public Animator modelAnimator;
// Temporary
private float inputMagnitude;
void Start(){
}
void Update(){
try {
// Temporary
inputMagnitude = Mathf.MoveTowards(inputMagnitude, GetComponent<PlayerControls>().rawMoveInput.magnitude * 2f, 6f * Time.deltaTime);
modelAnimator.SetFloat("Move Direction X", Unit.Movement.GetResolvedDirectionLocal().x * inputMagnitude);
modelAnimator.SetFloat("Move Direction Y", Unit.Movement.GetResolvedDirectionLocal().y * inputMagnitude);
} catch (Exception e) {
Debug.LogError($"Failed in setting X and Y move direction floats: {e.Message}");
}
}
public void SendTriggerToAnimator(string trigger){
if (!modelAnimator) {
Debug.LogError($"There is no animator set to recieve the trigger '{trigger}' on unit {name}.", gameObject);
return;
}
try {
modelAnimator.SetTrigger(trigger);
}
catch (Exception e)
{
Debug.LogError($"Failed to send trigger to Animator: {e.Message}");
}
}
}
}