public void Damage(int amount) { Health -= amount; if (Health < MaxHealth * 0.5f) { CurrentDestruction = DestructionLevel.PARTIAL; tiny_flames.SetActive(true); if (mesh_renderer != null) { mesh_renderer.material = damaged_1; } } if (Health < MaxHealth * 0.25f) { CurrentDestruction = DestructionLevel.SEVERE; medium_flames.SetActive(true); if (mesh_renderer != null) { mesh_renderer.material = damaged_2; } } if (Health <= 0) { CurrentDestruction = DestructionLevel.DESTROYED; } }
private GameObject SetDestructionLvl(DestructionLevel level) { foreach (var mesh in destructLvlMeshes) { mesh.SetActive(false); } var meshGameObject = destructLvlMeshes[(int)level]; meshGameObject.SetActive(true); return(meshGameObject); }