/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Low != null)
         {
             hashCode = hashCode * 59 + Low.GetHashCode();
         }
         if (High != null)
         {
             hashCode = hashCode * 59 + High.GetHashCode();
         }
         if (Morning != null)
         {
             hashCode = hashCode * 59 + Morning.GetHashCode();
         }
         if (Day != null)
         {
             hashCode = hashCode * 59 + Day.GetHashCode();
         }
         if (Evening != null)
         {
             hashCode = hashCode * 59 + Evening.GetHashCode();
         }
         if (Night != null)
         {
             hashCode = hashCode * 59 + Night.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
 public DayPhases(Morning morning, Day day, Evening evening, Night night)
 {
     this.MorningPhase = morning;
     this.DayPhase     = day;
     this.EveningPhase = evening;
     this.NightPhase   = night;
 }
        public void ShouldFillSession()
        {
            var morning = new Morning();
            morning.Allocate(new Talk { Minutes = morning.AvailableMinutes });

            var isFull = morning.IsFull;
            Assert.AreEqual(true, isFull);
        }
        public void ShouldHaveCorrectStartTime()
        {
            var morning = new Morning();
            var talk = new Talk { Minutes = 1 };
            morning.Allocate(talk);

            var startTime = new TimeSpan(9,0,0);
            Assert.AreEqual(talk.StartTime, startTime);
        }
Beispiel #5
0
        public NextTurn()
        {
            Logger.info("story.NextTurn():run.");

            AStory story  = null;
            AStory story2 = null;

            if (GameFactory.getGame().shareData.field.state == FIELD_STATE.EARLY_MORNING)
            {
                story  = new EarlyMorning();
                story2 = new Morning();
            }
            else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.MORNING)
            {
                story  = new Morning();
                story2 = new Noon();
            }
            else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.NOON)
            {
                story  = new Noon();
                story2 = new Night();
            }
            else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.NIGHT)
            {
                story  = new Night();
                story2 = new MidNight();
            }
            else if (GameFactory.getGame().shareData.field.state == FIELD_STATE.MIDNIGHT)
            {
                story  = new MidNight();
                story2 = new EarlyMorning();
            }


            // 次のターンを実施
            if (story.end())
            {
                if (GameFactory.getGame().shareData.field.state == FIELD_STATE.MIDNIGHT)
                {
                    GameFactory.getGame().shareData.field.state = FIELD_STATE.EARLY_MORNING;
                }
                else
                {
                    GameFactory.getGame().shareData.field.state += 1;
                }

                story2.init();
            }


            // send
            if (!GameFactory.debug)
            {
                // update view
                GameFactory.getUnityManager().updateDraw(true);
            }
        }
Beispiel #6
0
 public void ClearActivies()
 {
     if (Morning != null)
     {
         Morning.ClearActivies();
     }
     if (Afternoon != null)
     {
         Afternoon.ClearActivies();
     }
 }
Beispiel #7
0
 public int GetSize(bool includingHeader)
 {
     return(1 + // TimeOfDay
            3 + // null
            Morning.GetSize() +
            Afternoon.GetSize() +
            Evening.GetSize() +
            Night.GetSize() +
            4 +
            (includingHeader ? 10 : 0));
 }
        IEnumerator TimeRoutine()
        {
            while (Hour < MaxHour)
            {
                if (timeScale == 0f)
                {
                    yield return(new WaitForTimeUnpaused());
                }

                var timeStep = 1f / (TimeSpeed * timeScale);
                yield return(new WaitForTimeElapsed(timeStep));

                Minute += 1;
                MinuteTicked?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));

                var hourChanged = Minute >= 60;
                Hour += hourChanged ? 1 : 0;

                Minute %= 60;

                if (hourChanged)
                {
                    if (Hour >= MorningHour && Hour <= EveningHour)
                    {
                        WorkingHourTicked?.Invoke(this,
                                                  new TimeEventArgs(Minute, Hour, Year));
                    }
                }

                TimeChanged?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));

                if (Hour == MorningHour && Minute == 0)
                {
                    Morning?.Invoke(this, EventArgs.Empty);
                }
                if (Hour == EveningHour && Minute == 0)
                {
                    Evening?.Invoke(this, EventArgs.Empty);
                }
            }

            Year  += 1;
            Hour   = MinHour;
            Minute = 0;

            TimeChanged?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));
            YearTicked?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));

            StopTime();
        }
Beispiel #9
0
        public static Morning Create()
        {
            Morning instance = new Morning();

            instance.Add(new Eggs());
            instance.Add(new Toast());

            Coffee obj = new Coffee();

            obj.EnableMultipleOrder();
            obj.Order(3);
            instance.Add(obj);

            return(instance);
        }
        /// <summary>
        /// Returns true if ForecastTemperature instances are equal
        /// </summary>
        /// <param name="other">Instance of ForecastTemperature to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ForecastTemperature other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Low == other.Low ||
                     Low != null &&
                     Low.Equals(other.Low)
                     ) &&
                 (
                     High == other.High ||
                     High != null &&
                     High.Equals(other.High)
                 ) &&
                 (
                     Morning == other.Morning ||
                     Morning != null &&
                     Morning.Equals(other.Morning)
                 ) &&
                 (
                     Day == other.Day ||
                     Day != null &&
                     Day.Equals(other.Day)
                 ) &&
                 (
                     Evening == other.Evening ||
                     Evening != null &&
                     Evening.Equals(other.Evening)
                 ) &&
                 (
                     Night == other.Night ||
                     Night != null &&
                     Night.Equals(other.Night)
                 ));
        }
 public void ShouldHaveAvailableMinutes()
 {
     var morning = new Morning();
     var minutes = morning.AvailableMinutes;
     Assert.AreEqual(minutes, 60 * 3);
 }
Beispiel #12
0
 public Track()
 {
     Morning = new Morning();
     Afternoon = new Afternoon();
 }
Beispiel #13
0
 public bool Equals(Activities other)
 {
     return(Morning.SequenceEqual(other.Morning) && Afternoon.SequenceEqual(other.Afternoon));
 }
 public void ShouldNotBeFull()
 {
     var morning = new Morning();
     var isFull = morning.IsFull;
     Assert.AreEqual(false, isFull);
 }
 public void ShouldHaveTalks()
 {
     var morning = new Morning();
     Assert.IsNotNull(morning.Talks);
 }
 public void ShouldHaveCorrectTotalMinutes()
 {
     var morning = new Morning();
     var minutes = morning.TotalMinutes;
     Assert.AreEqual(minutes, 60 * 3);
 }
 public void ShouldHaveCorrectStartTime()
 {
     var morning = new Morning();
     var time = new TimeSpan(9, 0, 0);
     Assert.AreEqual(morning.StartTime, time);
 }