DayTime.js 391 B

1234567891011121314151617
  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
  8. var sun = self.node.getChild("TheSun").getComponent("DirectionalLight2D");
  9. sun.color = [0.05, 0.05, 0.07, 0.1];
  10. }
  11. }
  12. }
  13. exports.component = component;