OldBlueWater/BlueWater/Assets/02.Scripts/TestMove.cs
NTG f35a8a441f 02.Tycoon_video 영상용 씬 추가
+ SPUM 캐릭터 프리팹 값 초기화
+ NavMesh 재설정
+ KitchenController sotPosition 변경
+ 손님용 TestMove 스크립트 추가
2024-03-07 13:34:10 +09:00

40 lines
845 B
C#

using System;
using UnityEngine;
using UnityEngine.AI;
public class TestMove : MonoBehaviour
{
public NavMeshAgent agent;
public Animator animator;
private void Awake()
{
agent = GetComponent<NavMeshAgent>();
animator = transform.GetChild(0).GetComponent<Animator>();
}
private void Update()
{
if (agent.velocity != Vector3.zero)
{
animator.SetFloat("RunState", 0.5f);
}
else
{
animator.SetFloat("RunState", 0f);
}
var localScale = animator.transform.localScale;
if (agent.velocity.x >= 0)
{
localScale.x = -Mathf.Abs(localScale.x);
}
else
{
localScale.x = Mathf.Abs(localScale.x);
}
animator.transform.localScale = localScale;
}
}