血条的控制(每次5滴血)
function Start(){
animation.wrapMode = WrapMode.Loop;
var chujiao = player_.animation["chujiao"];
chujiao.wrapMode = WrapMode.Once;
var chuquan = player_.animation["chuquan"];
chuquan.wrapMode = WrapMode.Once;
}
function Update () {
//血量系统
HealthSystem();
if(target_ == null){
return;
}
//距离满足碰撞条件
var dis :float = Vector3.Distance(player_.transform.position,target_.position);
if(dis < attackRange)
{
if(dis >10)
{
player_.animation.CrossFade("pao");
}
else if(dis <= 10)
{
//Random.value 控制出拳还是出脚
if(!(player_.animation.IsPlaying("chujiao")||player_.animation.IsPlaying("chuquan")))
{
var x=Random.Range(0f,1f);
health -= 5;
}
if(x< 0.5)
{
if(!(player_.animation.IsPlaying("chujiao")||player_.animation.IsPlaying("chuquan")))
{
player_.animation.CrossFade("chuquan");//出拳
}
}
if(x >= 0.5)
{
if(!(player_.animation.IsPlaying("chujiao")||player_.animation.IsPlaying("chuquan")))
{
player_.animation.CrossFade("chujiao"); //出脚
target_.animation.CrossFade("zhongquanhuangdong");
}
}
}
//血量为0,挂
if(health <= 0)
{
target_.animation.CrossFade("guale");//玩家挂了
player_.animation.CrossFade("yaotou");//怪物很无奈
}
}
}
感谢楼主的无私分享!{:soso__11402694654016840197_7:} {:5_435:}{:5_435:}谢谢 学习学习 谢谢楼主分享,灰常感谢
感谢楼主的无私分享!{:soso__11402694654016840197_7:} 感谢楼主的无私分享! 很不错 楼主是超人 好帖就是要顶 真心顶
页:
[1]