Esempio n. 1
0
    private new void Start()
    {
        base.Start();
        MaxHealth = Health;

        var healthChunk = MaxHealth / 3;

        for (int i = 0; i < 3; ++i)
        {
            _healthChunks.Push(new HealthChunk {
                Health = healthChunk, MaxHealth = healthChunk
            });
        }

        _currentHealth = _healthChunks.Pop();

        Gravity = 0.0f;
        RandomlySelectAttackPoint();
        _moveTrigger = Time.time + _delayBetweenMoves;

        transform.GetComponent <VerticalHeavyAttack>().OnComplete += ResumeBasicAttack;
        transform.GetComponent <VerticalHeavyAttack>().ApplyDamageModifierForWeakSpot += ApplyDamageModifier;
        transform.GetComponent <VerticalHeavyAttack>().ShakeCamera += GenerateCameraShake;

        transform.GetComponent <HorizontalHeavyAttack>().OnComplete       += ResumeBasicAttack;
        transform.GetComponent <HorizontalHeavyAttack>().ToggleFacingLock += ToggleFacingLock;
        transform.GetComponent <HorizontalHeavyAttack>().ApplyDamageModifierForWeakSpot += ApplyDamageModifier;
        transform.GetComponent <HorizontalHeavyAttack>().ShakeCamera += GenerateCameraShake;

        _weakspotExplosion = transform.Find("ExplosionOrigin");
        if (_weakspotExplosion == null)
        {
            throw new MissingComponentException("Baddie Boss was missing a weakspot explosion");
        }

        _camShake = GameMasterV2.Instance.GetComponent <CameraShake>();
        if (_camShake == null)
        {
            throw new MissingComponentException("Weapon.cs: No CameraShake found on game master");
        }

        ResetAttackDelay();

        DeathSpot.GetComponent <SimpleCollider>().enabled = false;
    }
Esempio n. 2
0
 private void UpdateHeathbar()
 {
     if (_currentHealth.Health <= 0)
     {
         if (_healthChunks.Count == 0)
         {
             BaddieHudManager.Instance.HideHealthBar(_chunkIndex);
             Health = 0.0f;
             return;
         }
         else
         {
             print("adding new current health!");
             _currentHealth = _healthChunks.Pop();
             BaddieHudManager.Instance.HideHealthBar(_chunkIndex);
             ++_chunkIndex;
         }
     }
     print("Updating chunk: " + _chunkIndex + " with " + _currentHealth.Health + "/" + _currentHealth.MaxHealth);
     BaddieHudManager.Instance.SetHealthStatus(_chunkIndex, _currentHealth.Health, _currentHealth.MaxHealth);
 }