コード例 #1
0
 void Update()
 {
     if (isAlive)
     {
         if (Input.GetKey(fire) && Time.time - prevFire > fireInterval)
         {
             Bullet b = Instantiate(
                 bullet,
                 transform.position,
                 Quaternion.Euler(0f, 0f, 135f - getAngle()))
                        .GetComponent <Bullet>();
             b.parent           = transform;
             b.phase            = (int)Title.mode * phase;
             b.transform.parent = transform.parent;
             prevFire           = Time.time;
         }
         Move();
         if (hitPoint <= 0)
         {
             isAlive = false;
             StartCoroutine("onDied");
             PlayerStats.ApplayEarnedExp(score / 10);
             PlayerStats.AddCash(score);
         }
         CalcScore();
         hpBar.value = (float)hitPoint / maxHitPoint * 100;
         if (simulateOnDamage)
         {
             OnDamaged(0);
             simulateOnDamage = false;
         }
         if (levelup)
         {
             maxHitPoint += 100;
             hitPoint    += (int)hpBar.value;
             levelup      = false;
             killingLevel++;
         }
     }
 }