58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class VideoPlayer : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
Animator animator;
|
|
void Start()
|
|
{
|
|
animator = GetComponent<Animator>();
|
|
//人物获取场景脚本
|
|
}
|
|
//人物碰撞
|
|
void OnCollisionEnter(Collision collision)
|
|
{
|
|
//if (collision.gameObject.name == "Sphere")
|
|
//{
|
|
// var Message = "进入碰撞,碰撞名称:" + collision.gameObject.name;
|
|
// collision.gameObject.GetComponent<TargetScript>().Log(Message);
|
|
//}
|
|
}
|
|
|
|
float timer = 1f;
|
|
int ticks = 0;
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
timer -= Time.deltaTime;
|
|
while (timer <= 0)
|
|
{
|
|
#region 动画封装
|
|
//起步
|
|
//快速骑
|
|
animator.speed = 1;
|
|
var currentInfo = animator.GetCurrentAnimatorStateInfo(0);
|
|
if (currentInfo.normalizedTime > 0.2 && currentInfo.normalizedTime < 0.6f)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
animator.Play("all", 0, 0.2f);
|
|
}
|
|
//慢速骑 修改播放速度
|
|
|
|
//拐弯
|
|
|
|
//喝水
|
|
|
|
#endregion
|
|
ticks++;
|
|
timer += 1f;
|
|
}
|
|
|
|
}
|
|
}
|