// Use this for initialization void Awake() { timeSystem = TimeSystem.GetInstance(); plantedTime = timeSystem.GetTime(); SetPhaseIndex(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); }
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); }
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; } }
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); }
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); }
// 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); } } } }
/// <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))); }
public void Load(GrowableData data) { plantedTime = data.plantedTime; lastWateredTime = data.lastWateredTime; SetPhaseIndex(data.phaseIndex); }
public AddTimeInterval(TimeInstant timeInstant, TimeInterval interval) { _timeInstant = timeInstant; _interval = interval; }
private Age(TimeInstant birthday) => _birthday = birthday;
private AddTimeIntervalAtFirstAccess(TimeInterval interval, TimeInstant nowAtFirstAccess) { _interval = interval; _nowAtFirstAccess = nowAtFirstAccess; }
// Update is called once per frame void Update() { TimeInstant currentTime = timeSystem.GetTime(); timeText.text = currentTime.GetHours().ToString() + ":00"; }
public virtual void Water() { watered = true; lastWateredTime = timeSystem.GetTime(); }
// Use this for initialization void Start() { timeSystem = TimeSystem.GetInstance(); timerStart = timeSystem.GetTime(); }
public DifferenceOfTimeInstant(TimeInstant minuend, TimeInstant subtrahend) { _minuend = minuend; _subtrahend = subtrahend; }
public NowUntil(TimeInstant target) : this(target, new Now()) { }
private NowUntil(TimeInstant target, TimeInstant now) : this(new DifferenceOfTimeInstant(target, now)) { }
private NowAtFirstAccessUntil(TimeInstant timeInstant) => _timeInstant = timeInstant;
public TimeInstant(TimeInstant other) { this.seconds = other.seconds; }