MODULEAmbientLightGO EXPORTSAmbientLightGO ,AmbientLightGOProxy ; IMPORT BooleanPropPrivate, Color, ColorPropPrivate, GO, GOPrivate, GraphicsBase, GraphicsBasePrivate, LightGO, Prop; PROCEDURENew (c : Color.T) : T = VAR light := NEW (T).init (); BEGIN LightGO.SetColour (light, c); LightGO.SetSwitch (light, TRUE); RETURN light; END New; REVEAL T = Public BRANDED OBJECT OVERRIDES init := Init; draw := Draw; damageIfDependent := DamageIfDependent; END; PROCEDUREInit (self : T) : T = BEGIN EVAL GO.T.init (self); IF MkProxyT # NIL AND self.proxy = NIL THEN MkProxyT (self); END; RETURN self; END Init; PROCEDUREDamageIfDependent (self : T; pn : Prop.Name) = BEGIN IF pn = LightGO.Switch OR pn = LightGO.Colour THEN self.damaged := TRUE; END; END DamageIfDependent; PROCEDUREDraw (self : T; state : GraphicsBase.T) = BEGIN state.push (self); IF LightGO.Switch.getState (state) THEN state.addAmbientLight (LightGO.Colour.getState (state)); END; state.pop (self); END Draw; BEGIN END AmbientLightGO.