Unity射击游戏插件中武器的各种状态

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_15267341/article/details/82459345

 1   冲刺时,抢要横放在自己面前,下面这两个代码块是在武器身上WeaponBehavior.cs脚本

animation["RifleSprinting"].speed = -1.4f;
animation.CrossFade("RifleSprinting", 0.35f,PlayMode.StopAll);
animation["RifleSprinting"].speed = -1.4f;
animation.CrossFade("RifleSprinting", 0.35f,PlayMode.StopAll);


2   装弹动画

 

weaponMesh.animation.Rewind("Reload");
weaponMesh.animation["Reload"].speed = 1.15f;
weaponMesh.animation.CrossFade("Reload", 0.35f,PlayMode.StopAll);

 



3   开火武器动画

weaponMesh.animation.Rewind("Fire");
weaponMesh.animation["Fire"].speed = fireAnimSpeed;
weaponMesh.animation.CrossFade("Fire", 0.35f,PlayMode.StopAll);

 

4  开发播放声音

firefx.PlayOneShot(firefx.clip, 0.9f / firefx.volume);

5   开发发子弹

if(Physics.Raycast(mainCamTransform.position, direction, out hit, range, bulletMask)){
		HitObject(hit, direction);
}

 

FR:海涛高软(Hunk Xu)  
QQ技术交流群:386476712

展开阅读全文

没有更多推荐了,返回首页