Ejemplo n.º 1
0
 void Update()
 {
     timeDead -= Time.deltaTime;
     isDead    = pHC.IsDead();
     stealth   = false;
     if (!isDead && timeDead <= 0)
     {
         ch_animator.SetBool("IsDead", false);
         moveDirection.x   = joystickController.Horizontal();
         moveDirection.z   = joystickController.Vertical();
         rotateDirection.x = rotationController.Horizontal();
         rotateDirection.z = rotationController.Vertical();
         InputDecider();
         MovementManager();
         longShoot  = rotationController.LongShoot();
         quickShoot = rotationController.QuickShoot();
         timeLeft  -= Time.deltaTime;
         if (longShoot || (needShoot && timeLeft <= 0))
         {
             Shoot();
             needShoot = false;
         }
         if (quickShoot)
         {
             FindClosestEnemy();
             timeLeft  = 0.3f;
             needShoot = true;
         }
     }
     if (isDead)
     {
         frags++;
         fragsUI.text = "Frags: " + frags.ToString();
         timeDead     = 3f;
         ch_animator.Play("Dead");
     }
 }