资源简介
在我的一篇博文里会介绍如何使用unity制作刀光特效,工程中包含代码,游戏模型,场景资源
代码片段和文件信息
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// This is the PocketRPG Animation Controller... It is necessary to run PocketRPG trails
// THIS REPLACES METHODS LIKE ANIMATION.PLAY AND ANIMATION.CROSSFADE... YOU CANNOT USE THOSE IN CONJUNCTION WITH THESE TRAILS UNLESS YOU ARE HAPPY WITH frameRATE DEPENDANT ANIMATION
// PocketRPG trails run faster than the framerate... (default is 300 frames a second)... that is how they are so smooth (30fps trails are rather jerky)
// This code was written by Evan Greenwood (of Free Lives) and used in the game PocketRPG by Tasty Poison Games.
// But you can use this how you please... Make great games... that‘s what this is about.
// This code is provided as is. Please discuss this on the Unity Forums if you need help.
[RequireComponent(typeof(Animation))]
[AddComponentMenu(“PocketRPG/Animation Controller“)]
public class AnimationController : MonoBehaviour
{
private AnimationState currentState;
private float currentStateTime = 0;
private List fadingStates;
private float animationFadeTime = 0.15f;
protected List trails;
protected float t = 0.033f;
protected float m = 0;
protected Vector3 lastEulerAngles = Vector3.zero;
protected Vector3 lastPosition = Vector3.zero;
protected Vector3 eulerAngles = Vector3.zero;
protected Vector3 position = Vector3.zero;
private float tempT = 0;
public bool gatherDeltaTimeAutomatically = true; // ** You may want to set the deltaTime yourself for personal slow motion effects
//
protected float animationIncrement = 0.003f; // ** This sets the number of time the controller samples the animation for the weapon trails
//
//
void Awake ()
{
trails = new List ();
fadingStates = new List ();
currentState = null;
GetComponent().Stop ();
lastPosition = transform.position;
lastEulerAngles = transform.eulerAngles;
//
GetComponent().playAutomatically = false; // ** The Animation component must not be conflicting with the AnimationController
GetComponent().Stop();
}
void Start(){
GetComponent().Stop(); // ** The Animation component must not be conflicting with the AnimationController
}
//
public void SetDeltaTime (float deltaTime)
{
t = deltaTime; // ** This is for forcing the deltaTime of the Animation Controller for personal slow motion effects
}
public void SetAnimationSampleRate(int samplesPerSecond){
animationIncrement = 1f / samplesPerSecond;
}
//
protected virtual void LateUpdate ()
{
if (gatherDeltaTimeAutomatically){
t = Mathf.Clamp (Time.deltaTime 0 0.066f);
}
//
RunAnimations ();
//
}
//
public void AddTrail (WeaponTrail trail)
{
trails.Add (trail);
}
//
public void PlayAnimation (AnimationState state)
{
// ** This function is exactly like the Unity Animation.Play() method
//
for (int i = 0; i < fadingStates.Count; i++) {
fadingStates[i].weight = 0;
fadi
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-12-14 17:41 KnifeRay\
文件 42613 2016-12-14 17:37 KnifeRay\KnifeRay.zip
文件 174 2016-12-14 17:41 KnifeRay\KnifeRay.zip.me
目录 0 2016-12-13 21:56 KnifeRay\MyText\
文件 191 2016-12-13 21:43 KnifeRay\MyText.me
目录 0 2016-12-13 21:46 KnifeRay\MyText\Attacks\
文件 191 2016-12-13 21:46 KnifeRay\MyText\Attacks.me
文件 3461 2011-12-16 06:15 KnifeRay\MyText\Attacks\WeaponTrail.mat
文件 138 2016-12-13 21:46 KnifeRay\MyText\Attacks\WeaponTrail.mat.me
文件 71685 2011-12-16 06:14 KnifeRay\MyText\Attacks\weaponTrail02.psd
文件 1271 2016-12-13 21:46 KnifeRay\MyText\Attacks\weaponTrail02.psd.me
目录 0 2016-12-13 22:53 KnifeRay\MyText\Prefabs\
文件 191 2016-12-13 21:45 KnifeRay\MyText\Prefabs.me
文件 28668 2016-12-13 22:53 KnifeRay\MyText\Prefabs\SwordGild.prefab
文件 179 2016-12-13 21:43 KnifeRay\MyText\Prefabs\SwordGild.prefab.me
目录 0 2016-12-14 13:39 KnifeRay\MyText\Scenes\
文件 191 2016-12-13 21:45 KnifeRay\MyText\Scenes.me
文件 73948 2016-12-14 13:39 KnifeRay\MyText\Scenes\BladeMaster Example.unity
文件 174 2016-12-13 21:44 KnifeRay\MyText\Scenes\BladeMaster Example.unity.me
目录 0 2016-12-13 22:11 KnifeRay\MyText\sc
文件 191 2016-12-13 21:56 KnifeRay\MyText\sc
文件 6867 2016-12-13 17:24 KnifeRay\MyText\sc
文件 221 2016-12-13 17:23 KnifeRay\MyText\sc
文件 1100 2016-12-13 22:46 KnifeRay\MyText\sc
文件 262 2016-12-13 22:11 KnifeRay\MyText\sc
文件 7328 2016-12-13 22:35 KnifeRay\MyText\sc
文件 221 2016-12-13 17:23 KnifeRay\MyText\sc
目录 0 2016-12-13 22:39 KnifeRay\Pla
文件 191 2016-12-13 17:24 KnifeRay\Pla
文件 1580752 2012-07-02 13:25 KnifeRay\Pla
文件 5731 2016-12-13 22:39 KnifeRay\Pla
............此处省略172个文件信息
- 上一篇:区块链架构及应用-PPT
- 下一篇:F5101考试学习指导英译中
评论
共有 条评论