Quantcast
Channel: Questions in topic: "die"
Viewing all articles
Browse latest Browse all 115

How do i stop player to move when dead

$
0
0
Hi. Does anyone know to stop player from moving and shooting? Here's my script for my health bar: var curHealth = 300; var healthTexture : Texture2D; var explode:Transform; var canMove = true; function Start () { animation["MyCharacterRig|Die"].wrapMode = WrapMode.Once; animation["MyCharacterRig|Die"].layer = 1; } function Update () { if (curHealth <=0 ) { animation.CrossFade("MyCharacterRig|Die"); } } function OnTriggerEnter( hit : Collider ) { if(hit.gameObject.tag == "enemyProjectile") { animation.Play("MyCharacterRig|Hit"); Instantiate(explode, transform.position, transform.rotation); } if(hit.gameObject.tag == "enemyProjectile") { curHealth -= 15; } if(curHealth < 0) { curHealth = 0; } if (curHealth <= 0) { yield WaitForSeconds(1.3); Application.LoadLevel(2); } } function OnGUI() { GUI.DrawTexture(Rect(10,10,curHealth,30), healthTexture); } i did make it looked like he's dead but when the dead animation is playing i can still move and shoot .

Viewing all articles
Browse latest Browse all 115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>