+ SPUM 캐릭터 프리팹 값 초기화 + NavMesh 재설정 + KitchenController sotPosition 변경 + 손님용 TestMove 스크립트 추가
40 lines
845 B
C#
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;
|
|
}
|
|
}
|