protected virtual void Update() { if (IsAttacking) { _fogManager.TakeTime(Stats.FogCorruptionPerSecond * Time.deltaTime); _playerBeingAttacked.Corrupt(Stats.CorruptionPerSecond * Time.deltaTime); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == Tag.Fog.ToString()) { IsInFog = true; } if (other.tag == Tag.Enemy.ToString()) { var enemy = other.GetComponent <Enemy>(); enemy.Attack(this); } if (other.tag == Tag.Bullet.ToString()) { // Bullet hit var bullet = other.GetComponent <Bullet>(); if (bullet != null && bullet.Owner == BulletOwner.Enemy && !bullet.DespawnPending) { // Player was hit by a enemy bullet FogCorruption += 0.05f; _fogManager.TakeTime(bullet.Damage); bullet.Hit(transform); } } if (other.tag == Tag.Powerup.ToString()) { var powerup = other.GetComponent <Powerup>(); if (powerup != null && !powerup.Used) { powerup.Use(); switch (powerup.Type) { case PowerupType.FireRate: Stats.FireRate -= 0.05f; if (Stats.FireRate < 0.15f) { Stats.FireRate = 0.15f; } break; case PowerupType.Damage: default: Stats.BulletDamage += _gameplaySettings.PowerupStatIncrease; break; } } } }