// Methods -------------------------------------------------------------------- public UniversalClock() { lastUpdateTime = DateTime.Now; mInstance = this; }
/// <summary> /// Creates all Caelum's components needed, /// register them in <c>mChildren</c> and sets up them. /// </summary> protected override void OnPostCreate(bool loaded) { base.OnPostCreate(loaded); Log.Info("Initialising Caelum system..."); // Avoid undo bug if(mChildren == null) mChildren = new List<CaelumBase>(); // Creates and sets up a new UniversalClock UniversalClock clock = new UniversalClock(); clock.SetGregorianDateTime(mStartYear, mStartMonth, mStartDay, mStartHour, 0, 0); // Sets up Sky color's calculation model SkyColorModel.GradientImage = _type.GradientImage; SkyColorModel.SkyGradientImage = _type.SkyGradientImage; /* Creates all Caelum's element * TODO: Find a better way to do that and clean up this code */ CaelumItem item = getItembyType(CaelumComponent.Sun); if (item != null) if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Sun)) { CaelumSun sun = new CaelumSun(item); sun.FarDistance = _type.FarDistance; mChildren.Add(sun); } item = getItembyType(CaelumComponent.Moon); if (item != null) if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Moon)) { CaelumMoon moon = new CaelumMoon(item); moon.FarDistance = _type.FarDistance; mChildren.Add(moon); } item = getItembyType(CaelumComponent.Starfield); if (item != null) { if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Starfield)) mChildren.Add(new CaelumStarfield(item)); } item = getItembyType(CaelumComponent.Skydome); if (item != null) { if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Skydome)) mChildren.Add(new CaelumSkydome(item)); } item = getItembyType(CaelumComponent.Clouds); if (item != null) { if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Clouds)) { CaelumClouds clouds = new CaelumClouds(item); clouds.SetCoverImage( _type.CoverLookupImage ); mChildren.Add(clouds); } } if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Fog)) mManageFog = true; Log.Info("Done: Initialising Caelum system"); }
public void Dispose() { mInstance = null; }