I'm extending StaticMeshActor to create a new DynamicEvilMesh actor - which can look at it's materials, and change a parameter within them, called Evil. The idea is, there is a linear interpolation between the 'Good' sky and the 'Evil' sky, that has a direct relationship with the player health. The class is generic, so we can use it for more than just skies, but I won't talk about those here. I find all the DynamicEvilMeshes in a map before the game begins, to make things easier.
Put simply, as the player health gets lower, the sky becomes increasingly evil. When the player health gets better, it gets less evil.
The trick is, any ideas on how to monitor health? We could add to all the take damage / healing functions, but I get a feeling there are a lot of them. Another option is to perhaps stick a timer in Pawn, to check every few seconds. This might be good, as we can then try and transition between skies.
Post Processing will also be code based (not volume based) - and will also depend heavily on the player health.
Here's the current code, anyway:
class DR_DynamicEvilMesh extends StaticMeshActor; var MaterialInstanceConstant EvilMaterial; function SetEvil(float Evil, int MaterialIndex) { EvilMaterial = Material[MaterialIndex].CreateAndSetMaterialInstanceConstant( MaterialIndex ); EvilMaterial.SetScalarParameterValue('Evil', Evil); } DefaultProperties { }
class DR_Game extends UTGame; var array < DR_DynamicEvilMesh > DynamicEvilMeshes; var array<Actor> out_Actors; //Before the game begins, create an array of all meshes that dynamically change material with player health. simulated function PostBeginPlay() { local int i; Super.PostBeginPlay(); if ( FindActorsOfClass(class'DataRun.DR_DynamicEvilMesh', out_Actors)) { for (i = 0; i < out_Actors.Length; i++) { DynamicEvilMeshes[i] = DynamicEvilMeshes(out_Actors[i]); } } } DefaultProperties { PlayerControllerClass=class'DataRun.DR_PlayerController' DefaultPawnClass=class'DataRun.DR_Pawn' }