コード例 #1
0
ファイル: GameManager.cs プロジェクト: rzpjunior/zombievirus
 private void PlayerShoot()
 {
     if (isShoot)
     {
         isShoot = false;
         int bulletCount = machineGun.ValidateShoot();
         if (bulletCount > 0)
         {
             var        ray = m_mainCamera.ViewportPointToRay(m_PosTolerance);
             RaycastHit hit;
             if (Physics.Raycast(ray, out hit))
             {
                 Zombie zombie = hit.transform.GetComponent <Zombie>();
                 if (zombie != null)
                 {
                     if (zombie.TakeDamage())
                     {
                         m_TotalKilledZombie++;
                         m_PlayerScore += SCORE_PER_ZOMBIE;
                         ui.UpdatePlayerScore(m_PlayerScore.ToString());
                     }
                 }
             }
         }
     }
 }