Advertisement
Guest User

ZombieController

a guest
Oct 25th, 2012
1,169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma strict
  2.  
  3. var ZombieIntelligence : ZombieAI ;
  4. var animator : Animator ;
  5.  
  6. function Start () {
  7.     ZombieIntelligence = gameObject.GetComponent ( ZombieAI ) ;
  8.     animator = GetComponent ( Animator ) ;
  9. }
  10.  
  11. function Update () {
  12.     if ( ZombieIntelligence.Zombie.Kombat.State.Walking )
  13.     {
  14.         //animation.Play ( "walk" );   
  15.     }else if ( ZombieIntelligence.Zombie.Kombat.State.Attacking )
  16.     {
  17.         //animation.Play ( "attack1" ) ;
  18.         //animation["attack1"].wrapMode = WrapMode.Loop ;
  19.         if ( Mathf.Ceil ( animator.GetFloat ( "CoolDown" ) ) == 0 )
  20.         {
  21.            
  22.             animator.SetBool ( "Attacking", true ) ;
  23.             animator.SetFloat ( "CoolDown", 3 ) ;
  24.         }else {
  25.             animator.SetBool ( "Attacking", false ) ;
  26.         }
  27.         //animator.SetBool ( "Attacking", false );
  28.     }else if ( ZombieIntelligence.Zombie.Kombat.State.Running )
  29.     {
  30.         //animation.Play ( "walk" ) ;
  31.     }else if ( ZombieIntelligence.Zombie.Kombat.State.Dying )
  32.     {
  33.         //animation.Play ( "ZombieDeath" ) ;
  34.     }
  35.    
  36.     if ( animator.GetFloat ( "CoolDown" ) > 0 )
  37.     {
  38.         animator.SetFloat ( "CoolDown", animator.GetFloat ( "CoolDown") - ( 1 * Time.deltaTime ) ) ;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement