(公有,不属于任何脚本,也不用继承MonoBehaviour,所以也没有Awake函数,获取引用实在构造器
中实现的)
中实现的)
用于敌人动画中参数的设置,其中缓冲参数的作用是让敌人动作转变时更平滑
添加脚本DoneAnimatorSetup
using UnityEngine;
using System.Collections;
public class DoneAnimatorSetup
{
public float speedDampTime = 0.1f; // Damping time for the Speed parameter.
public float angularSpeedDampTime = 0.7f; // Damping time for the AngularSpeed parameter
public float angleResponseTime = 0.6f; // Response time for turning an angle into angularSpeed.
private Animator anim; // Reference to the animator component.
private DoneHashIDs hash; // Reference to the HashIDs script.
// Constructor
public DoneAnimatorSetup(Animator animator, DoneHashIDs hashIDs)
{
anim = animator;
hash = hashIDs;
}
public void Setup(float speed, float angle)
{
// Angular speed is the number of degrees per second.
float angularSpeed = angle / angleResponseTime;
// Set the mecanim parameters and apply the appropriate damping to them.
anim.SetFloat(hash.speedFloat, speed, speedDampTime, Time.deltaTime);
anim.SetFloat(hash.angularSpeedFloat, angularSpeed, angularSpeedDampTime, Time.deltaTime);
}
}
参数(公有)
速度缓冲时间
角速度缓冲时间
把角度转为角速度的反应时间
(私有)