コード例 #1
0
    // Use this for initialization
    void Awake()
    {
        timeSystem  = TimeSystem.GetInstance();
        plantedTime = timeSystem.GetTime();

        SetPhaseIndex(0);
    }
コード例 #2
0
 public TimeInstant UpdateTimeInstant(TimeInstant timeInstant)
 {
     Contract.Requires(timeInstant != null);
     using (IUnitOfWork uow = this.GetUnitOfWork())
     {
         IRepository <TimeInstant> repo = uow.GetRepository <TimeInstant>();
         repo.Merge(timeInstant);
         var merged = repo.Get(timeInstant.Id);
         repo.Put(merged);
         uow.Commit();
     }
     return(timeInstant);
 }
コード例 #3
0
        public bool DeleteTimeInstant(TimeInstant timeInstant)
        {
            Contract.Requires(timeInstant != null);
            Contract.Requires(timeInstant.Id >= 0);

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <TimeInstant> repo = uow.GetRepository <TimeInstant>();
                timeInstant = repo.Reload(timeInstant);
                repo.Delete(timeInstant);
                uow.Commit();
            }
            return(true);
        }
コード例 #4
0
    private void SpawnObject()
    {
        lastSpawnedObject = Instantiate(prefab, this.transform) as GameObject;
        lastSpawnedObject.transform.localPosition = Vector3.zero;

        if (multispawner)
        {
            // reset timing if we're a multispawner
            timerStart = timeSystem.GetTime();
        }
        else
        {
            spawned = true;
        }
    }
コード例 #5
0
        public TimeInstant CreateTimeInstant(SystemDefinedUnit precision, DateTime?instant)
        {
            TimeInstant timeInstant = new TimeInstant()
            {
                Precision = precision,
                Instant   = instant
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <TimeInstant> repo = uow.GetRepository <TimeInstant>();
                repo.Put(timeInstant);
                uow.Commit();
            }
            return(timeInstant);
        }
コード例 #6
0
        public TimeInterval CreateTimeInterval(TimeInstant startTime, TimeInstant endTime)
        {
            TimeInterval timeInterval = new TimeInterval()
            {
                StartTime = startTime,
                EndTime   = endTime
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <TimeInterval> repo = uow.GetRepository <TimeInterval>();
                repo.Put(timeInterval);
                uow.Commit();
            }
            return(timeInterval);
        }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        if (lastSpawnedObject == null || multispawner)
        {
            // Dewdrop was just collected, reset timing
            if (spawned)
            {
                timerStart = timeSystem.GetTime();
                spawned    = false;
            }

            int elapsedDays = (timeSystem.GetTime() - timerStart).GetDays();
            if (elapsedDays >= spawnDelayDays)
            {
                SpawnObject();
                if (oneOff)
                {
                    Destroy(this.gameObject);
                }
            }
        }
    }
コード例 #8
0
 /// <summary>
 ///     This is a time fence that is in the <see cref="FenceState.State.True"/> state during a time interval defined with respect to <see cref="TimeInstant.Sunrise" /> or <see cref="TimeInstant.Sunset" /> instants.
 ///     For example, if it is relative to <see cref="TimeInstant.Sunrise" />, and sunrise time is denoted by variable T, then this fence is in the <see cref="FenceState.State.True"/> state during the period [T + startOffsetMillis, T +
 ///     stopOffsetMillis].
 /// </summary>
 /// <param name="timeInstant">is the desired semantic time label around which fence triggers are defined to happen.</param>
 /// <param name="startOffsetMillis">
 ///     is the offset from the beginning of the semantic time period. It can be specified as a positive or negative offset value but should be between -24 to 24 hours
 ///     inclusive (expressed in millis)
 /// </param>
 /// <param name="stopOffsetMillis">
 ///     is the offset from the end of the semantic time period. It can be specified as a positive or negative offset value but should be between -24 to 24 hours inclusive
 ///     (expressed in millis) constraint: <see cref="startOffsetMillis" /> < <see cref="stopOffsetMillis" />
 /// </param>
 /// <returns><see cref="AwarenessFence" /> that is <see cref="FenceState.State.True"/> when the current time falls within the interval specified based on the semantic time label and offsets.</returns>
 public static AwarenessFence AroundTimeInstant(TimeInstant timeInstant, long startOffsetMillis, long stopOffsetMillis)
 {
     return(new AwarenessFence(TimeFenceClass.AJCCallStaticOnceAJO("aroundTimeInstant", (int)timeInstant, startOffsetMillis, stopOffsetMillis)));
 }
コード例 #9
0
 public void Load(GrowableData data)
 {
     plantedTime     = data.plantedTime;
     lastWateredTime = data.lastWateredTime;
     SetPhaseIndex(data.phaseIndex);
 }
コード例 #10
0
 public AddTimeInterval(TimeInstant timeInstant, TimeInterval interval)
 {
     _timeInstant = timeInstant;
     _interval    = interval;
 }
コード例 #11
0
 private Age(TimeInstant birthday) => _birthday = birthday;
コード例 #12
0
 private AddTimeIntervalAtFirstAccess(TimeInterval interval, TimeInstant nowAtFirstAccess)
 {
     _interval         = interval;
     _nowAtFirstAccess = nowAtFirstAccess;
 }
コード例 #13
0
    // Update is called once per frame
    void Update()
    {
        TimeInstant currentTime = timeSystem.GetTime();

        timeText.text = currentTime.GetHours().ToString() + ":00";
    }
コード例 #14
0
 public virtual void Water()
 {
     watered         = true;
     lastWateredTime = timeSystem.GetTime();
 }
コード例 #15
0
 // Use this for initialization
 void Start()
 {
     timeSystem = TimeSystem.GetInstance();
     timerStart = timeSystem.GetTime();
 }
コード例 #16
0
 public DifferenceOfTimeInstant(TimeInstant minuend, TimeInstant subtrahend)
 {
     _minuend    = minuend;
     _subtrahend = subtrahend;
 }
コード例 #17
0
ファイル: NowUntil.cs プロジェクト: Fyzxs/PomodoroTimer
 public NowUntil(TimeInstant target) : this(target, new Now())
 {
 }
コード例 #18
0
ファイル: NowUntil.cs プロジェクト: Fyzxs/PomodoroTimer
 private NowUntil(TimeInstant target, TimeInstant now) : this(new DifferenceOfTimeInstant(target, now))
 {
 }
コード例 #19
0
 private NowAtFirstAccessUntil(TimeInstant timeInstant) => _timeInstant = timeInstant;
コード例 #20
0
 public TimeInstant(TimeInstant other)
 {
     this.seconds = other.seconds;
 }