Beispiel #1
0
        string LifeSpanStats()
        {
            string s = ""
                       + " \n gameStart=\t" + TMsingleton.gmStart.ToLongTimeString() + "\t+0"
                       + " \n i started=\t" + birthdate.ToLongTimeString() + "\t+" + TMsingleton.RunTime(birthdate)
                       + " \n now=\t" + TMsingleton.TimeString() + "\t+" + TMsingleton.RunTime()
            ;

            return(s);
        }
Beispiel #2
0
        //making a timeObj that manages this slice of time
        public TimeObj(DateTime dt, TimeObjFactory tof)
        {
            this.tof = tof;

            m_Date      = dt; //make key useful ... Remove for micro usefullnes
            m_Secs      = TMsingleton.SecsSinceMidnight(dt);
            m_EpochSecs = dt.ConvertToUnixTimestamp();

            //m_GameObjects = new Dictionary <EtcMgr.TimeType, Transform>();
            //m_Events = new Dictionary <EventType, Event>();
            //m_Contacts = new Dictionary <object, TimeObj>();

            if (dump)
            {
                U.Log(Dump());
            }
        }
Beispiel #3
0
        //  IEnumerator FillTimeObjDictionary(DateTime start, DateTime end)
        public void FillTimeObjDictionary(DateTime start, DateTime end)
        {
            timer = Stopwatch.StartNew();
            DateTime then = DateTime.Now;

            U.Log("Filling ...  " + Math.Floor(TMsingleton.ElapsedFunc(start, end).TotalSeconds));


            while (timeObjDictionary.Count < TMsingleton.ElapsedFunc(start, end).TotalSeconds)
            {
                TimeObj tos = tof.MakeTimeObj(lastProcessedStamp);

                //Neuter flatens the Ticks to make dt == dt comparison faster
                timeObjDictionary.Add(lastProcessedStamp.Neuter(), tos);

                if (first)
                {
                    first = false;
                }

                lastProcessedStamp = lastProcessedStamp.AddSeconds(1);
            }
            allSecs  = timeObjDictionary.Values;
            allDates = timeObjDictionary.Keys;

            timer.Stop();
            DateTime now = DateTime.Now;

            U.Log("Timing ...  " + (now - then).Seconds);

            U.Log("FillTimeObjDictionary w " + allSecs.Count
                  + " in " + timer.Elapsed.Seconds.ToString());



            //configGameObjects();
            //runTests();
            ToToToTo(U.pIsDay, U.aDump, U.aActDayDown);
            U.ActivateHoursUp();
        }
Beispiel #4
0
 public static Vector3 getPosition(DateTime dt)
 {
     return(new Vector3(0, 0, -TMsingleton.SecsSinceMidnight(dt) * EtcMgr.secondDepthZ));
 }
Beispiel #5
0
 //the distance of an event from the start position of the day
 public static float MidnightOffset(DateTime dt)  // Z offset midnight to dt
 {
     return((float)(TMsingleton.SecsSinceMidnight(dt) * EtcMgr.secondDepthZ));
 }
Beispiel #6
0
 //making a timeObj that manages all time
 public TimeObj(DateTime dt)
 {
     m_Date      = dt;
     m_Secs      = TMsingleton.SecsSinceMidnight(dt);
     m_EpochSecs = dt.ConvertToUnixTimestamp();
 }
Beispiel #7
0
 public Vector3 getPosition()
 {
     return(new Vector3(0, 0, -TMsingleton.SecsSinceMidnight(m_Date) * EtcMgr.secondDepthZ));
 }
Beispiel #8
0
    //public static void SetColor(this GameObject go, float r, float g,float b, float a)
    //{
    //    go.GetComponent<BasicBehaviour>().SetColor(r, g, b, a);  //todo may not have Me
    //}


    public static void SetPlaceInTime(this GameObject go, DateTime dt)
    {
        go.transform.position = new Vector3(go.transform.position.x,
                                            go.transform.position.y,
                                            EtcMgr.secondDepthZ * TMsingleton.ADSecs(dt));
    }