123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Events;
- using System;
- public class AnimateModel : MonoBehaviour
- {
- [SerializeField]
- private Animation modelBaseAnimation;
- [SerializeField]
- private UnityEvent walkingFinished;
- private bool isWalking = false;
- public void PlayModelAnim()
- {
- modelBaseAnimation.Stop();
- modelBaseAnimation.Play("Armature|RunWay03");
- isWalking = true;
- }
- public void StopAnimModel()
- {
- modelBaseAnimation.Stop();
- }
- private void Update()
- {
- if (modelBaseAnimation.isPlaying == false && isWalking)
- {
- isWalking = false;
- walkingFinished.Invoke();
- }
- }
- public void SetWalking(bool walking)
- {
- isWalking = walking;
- }
- }
|