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

57 lines
1.2 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()
{
StartWalkman();
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);
}
}