ShanxiKnowledgeBase/SXElectricalInspection/Assets/Art/8.23/GameAssets/Animations/爬杆/Script/ClimbControl.cs

62 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
public class ClimbControl : MonoBehaviour
{
public float startTime = 115;
private PlayableDirector Director;
void Start()
{
Director = transform.GetComponent<PlayableDirector>();
Director.Stop();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
StartAtTime(startTime);
}
if (Input.GetKeyDown(KeyCode.F))
{
Director.Stop();
}
}
private void StartAtTime(float time)
{
Director.initialTime = time;
Director.Play();
//if (Director != null)
//{
// if (scale < 0.01f)
// {
// hasStopped = true;
// time = Director.time;
// Director.playableGraph.GetRootPlayable(0).SetSpeed(scale);
// }
// else
// {
// if (hasStopped == true)
// {
// //ÓÉÍ£Ö¹´¥·¢
// Director.Stop();
// Director.initialTime = time;
// Director.Play();
// }
// else
// {
// time = Director.time;
// Director.Stop();
// Director.initialTime = time;
// Director.Play();
// }
// hasStopped = false;
// Director.playableGraph.GetRootPlayable(0).SetSpeed(scale);
// }
//}
}
}