ElectricityBusinessHall_Dig.../Assets/Resources/Scripts/Function/WorkerPathManager.cs

63 lines
1.3 KiB
C#

using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 营业员走走停停
/// </summary>
public class WorkerPathManager : MonoBehaviour
{
public CinemachineDollyCart cartman;
public CinemachineDollyCart cartwoman;
// Start is called before the first frame update
void Start()
{
if (cartman != null)
{
StartWalkman();
}
if (cartwoman!=null)
{
StartWalkwoman();
}
}
// Update is called once per frame
void Update()
{
}
private void StartWalkman()
{
cartman.m_Speed = 0.9f;
cartman.GetComponentInChildren<Animator>().SetBool("walk", true);
Invoke("Stopman", 10);
}
private void StartWalkwoman()
{
cartwoman.m_Speed = 0.9f;
cartwoman.GetComponentInChildren<Animator>().SetBool("walk", true);
Invoke("Stopwoman", 7);
}
private void Stopman()
{
cartman.m_Speed = 0f;
cartman.GetComponentInChildren<Animator>().SetBool("walk", false);
Invoke("StartWalkman", 3);
}
private void Stopwoman() {
cartwoman.m_Speed = 0f;
cartwoman.GetComponentInChildren<Animator>().SetBool("walk", false);
Invoke("StartWalkwoman", 2);
}
}