コード例 #1
0
    // Use this for initialization
    private void Start()
    {
        HealthBarUtils.SetMaxPlayerHealth(maxPlayerHealth);
        float playerMaxHealth = HealthBarUtils.GetMaxHealth();

        witchBossBlackHoleDamage = playerMaxHealth;
        boyBossBurpDamage        = playerMaxHealth;
        myBody.freezeRotation    = true;
    }
コード例 #2
0
 private void PlayerDied()
 {
     if (HealthBarUtils.GetCurrentHealthBarValue() <= 0)
     {
         anim.SetBool(santaDyingAnimName, true);
         timeLeftUntilDeath -= Time.deltaTime;
         if (timeLeftUntilDeath < 0)
         {
             Time.timeScale = 0.0f;
             alive          = false;
         }
     }
 }
コード例 #3
0
    private void DecreaseHealth(Collider2D other)
    {
        string bulletType = other.gameObject.name as string;

        // sanitize bullet names
        bulletType = bulletType.Replace("(Clone)", "");

        switch (bulletType)
        {
        case "Axe":
            HealthBarUtils.DecreaseHealthBarValue(axeDamage);
            break;

        case "WitchBullet":
            HealthBarUtils.DecreaseHealthBarValue(witchBossBulletDamage);
            break;

        case "WitchGranade":
            HealthBarUtils.DecreaseHealthBarValue(witchBossGranadeDamage);
            break;

        case "BlackHole":
            if (!other.usedByEffector)
            {
                HealthBarUtils.DecreaseHealthBarValue(witchBossBlackHoleDamage);
            }
            break;

        case "Granade":
            HealthBarUtils.DecreaseHealthBarValue(flyingBoyGranadeDamage);
            break;

        case "BoyBullet":
            HealthBarUtils.DecreaseHealthBarValue(boyBossBulletDamage);
            break;

        case "BoyBurpBullet":
            HealthBarUtils.DecreaseHealthBarValue(boyBossBurpDamage);
            break;

        default:
            break;
        }
    }