Better sector null checks
This commit is contained in:
@@ -44,12 +44,14 @@ public class Universe{
|
||||
}
|
||||
}
|
||||
|
||||
//update sector light
|
||||
float light = state.getSector().getLight();
|
||||
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f));
|
||||
//assign and map so darkness is not 100% dark
|
||||
state.rules.ambientLight.a = 1f - alpha;
|
||||
state.rules.lighting = !Mathf.equal(alpha, 1f);
|
||||
if(state.hasSector()){
|
||||
//update sector light
|
||||
float light = state.getSector().getLight();
|
||||
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f));
|
||||
//assign and map so darkness is not 100% dark
|
||||
state.rules.ambientLight.a = 1f - alpha;
|
||||
state.rules.lighting = !Mathf.equal(alpha, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public float secondsMod(float mod, float scale){
|
||||
|
||||
Reference in New Issue
Block a user