插件(一)武器拖尾效果

刚好有空,就有兴趣看了看U3D的武器拖尾功能,没想到有插件。下载地址:

Pocket+RPG+Weapon+Trails.unitypackage

http://download.csdn.net/detail/l364244206/5085651

 

PocketRPG Trails的例子演示效果

插件(一)武器拖尾效果_第1张图片

左刀挥动

插件(一)武器拖尾效果_第2张图片

双刀效果

 

PocketRPG的例子中已经有实现拖尾效果的脚本及说明文档,我只是将自己实际使用时遇到的问题与使用步骤更详细的写下来。

 

WeaponTrail

插件(一)武器拖尾效果_第3张图片

实现拖尾效果的脚本。

参数:

Height:拖尾效果的高度,对应武器的长度

Time:拖尾效果残留事件

Always Up:

Min Distance:

Time Transition Speed:

Desired Time:

Start Color:开始颜色

End Color:结束时颜色


使用(PocketRPG文档的ReadMe中有提及)

1.Calling StartTrail(float timeToTweenTo,floatfadeInTime) andFadeOut(float fadeTime)will fade in andfade out the trail respectively.

调用StartTrail和FadeOut函数去实现渐显示和渐消失的效果。时间参数以1秒为一个单位。

2.Calling SetTime(float trailTime, floattimeToTweenTo,float tweenSpeed)can change the length of thetrailinstantly, giving you a little more control.

调用SetTime函数去改变拖尾长度

3.The WeaponTrail can be built bycallingItterate(floatitterateTime) andUpdateTrail(floatcurrentTime, floatdeltaTime). These functions are calledbyAnimationController, however if you don't want to useAnimationController youcan call these yourself.

调用Itterate和Update函数去更新拖尾效果,目前还不明白这两个函数的参数怎样添好,幸运的是,PocketRpg的开发者做了AnimationController脚本去代替我们调用这两个函数使拖尾效果更好。



AnimationController

控制动作,使拖尾效果更好

参数:

Gather Delta Time Automatic:


使用

1.调用AddTrail函数去添加受影响的WeapontTrail对象。

2.调用PlayAnimation函数去切换动作。

-----------------------------------------------------------------------------------------

应用:

为了有一个不错的效果,还是用到源码包中的拖尾材质

 
并把这两个主要脚本引用到自己的项目中:
插件(一)武器拖尾效果
 
WeaponTrail添加到武器的对象上。并添加如下组件。如图:

 插件(一)武器拖尾效果_第4张图片



然后将AnimationController组件添加到人物的对象上:

  插件(一)武器拖尾效果_第5张图片

下面就可以写代码测试下啦:
插件(一)武器拖尾效果_第6张图片
  运行看看:
插件(一)武器拖尾效果  插件(一)武器拖尾效果_第7张图片
参考:http://blog.csdn.net/xv_ly15/article/details/8509781

你可能感兴趣的:(插件,unity3d,武器拖尾效果)