标签:大神 说明 size uri 老师 yourself current UNC ant
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
using UnityEngine;
using System.Collections; public class TestMyTrail : MonoBehaviour { private Animator animator; void Start () { animator = GetComponent<Animator>(); } void OnGUI() { if (GUI.Button(new Rect(0, 0, 50, 50), "攻击")) { animator.SetTrigger("Attack"); } } } |
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
using UnityEngine;
using System.Collections; public class TestMyTrail : MonoBehaviour { public WeaponTrail myTrail; private Animator animator; private float t = 0.033f; private float tempT = 0; private float animationIncrement = 0.003f; void Start () { animator = GetComponent<Animator>(); } void LateUpdate() { t = Mathf.Clamp(Time.deltaTime, 0, 0.066f); if (t > 0) { while (tempT < t) { tempT += animationIncrement; if (myTrail.time > 0) { myTrail.Itterate(Time.time - t + tempT); } else { myTrail.ClearTrail(); } } tempT -= t; if (myTrail.time > 0) { myTrail.UpdateTrail(Time.time, t); } } } void OnGUI() { if (GUI.Button(new Rect(0, 0, 50, 50), "攻击")) { animator.SetTrigger("Attack"); } } } |
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
void Start ()
{ animator = GetComponent<Animator>(); // 默认没有拖尾效果 myTrail.SetTime(0.0f, 0.0f, 1.0f); } public void heroAttack() { //设置拖尾时长 myTrail.SetTime(2.0f, 0.0f, 1.0f); //开始进行拖尾 myTrail.StartTrail(0.5f, 0.4f); } public void heroIdle() { //清除拖尾 myTrail.ClearTrail(); } |
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://www.cnblogs.com/captainbed
标签:大神 说明 size uri 老师 yourself current UNC ant
原文地址:https://www.cnblogs.com/sjwics/p/10220483.html