DayTime.js 564 B

123456789101112131415161718
  1. "atomic component";
  2. //DayTime component
  3. var component = function(self) {
  4. var dayTime = require("GlobalVariables").dayTime;
  5. self.start = function() {
  6. if(!dayTime) {
  7. //if it's night, make TheSun color darker - ambient isn't being set properly, see GitHub issue: https://github.com/AtomicGameEngine/AtomicGameEngine/issues/340
  8. self.scene.getComponent("Zone").ambientColor = [0, 0, 0, 0.2];
  9. var sun = self.node.getChild("TheSun").getComponent("DirectionalLight2D");
  10. sun.enabled = false;
  11. }
  12. };
  13. };
  14. exports.component = component;