public bool DoFilter(Direction d) { bool res = false; if (m_Started) { SkipExpired(m_MoveRecords); res = checkFastWalk(); TimeSpan delay = ComputeMovementSpeed(d); DateTime end; if (m_MoveRecords.Count > 0) { end = m_EndQueue + delay; } else { end = DateTime.Now + delay; } m_EndQueue = end; m_MoveRecords.Enqueue(MovementRecord.NewInstance(end)); } return(res); }
private void ResetShadow() { actualPositionTarget = shadowActionsRecord.roundMovementRecords[0]; if (shadowActionsRecord.roundShootingRecords.Count > 0) { actualInQeueAction = shadowActionsRecord.roundShootingRecords[0]; allActionsMade = false; } else { allActionsMade = true; } shadowRb.velocity = Vector3.zero; affordanceInstance = Instantiate(resetAffordance, actualPositionTarget.position, Quaternion.identity); GameManager.Instance.effectsToDestroy.Add(affordanceInstance); shadowAnimator.ResetTrigger("StartLoop"); shadowAnimator.SetTrigger("EndLoop"); StartCoroutine(WaitTime(loopPauseTime)); allPositionsMade = false; }
public bool checkFastWalk(Direction d) { bool res = false; insertOldMovementRecord(); SkipExpired(m_MoveRecordsMounted); SkipExpired(m_MoveRecordsFooted); SkipExpired(m_MoveRecords); checkFastWalk(); TimeSpan delay = ComputeMovementSpeed(d); TimeSpan delayMounted = ComputeMovementSpeedMounted(d); TimeSpan delyaFooted = ComputeMovementSpeedFooted(d); DateTime end; DateTime endMounted; DateTime endFooted; if (m_MoveRecords.Count > 0) { end = m_EndQueue + delay; } else { end = DateTime.Now + delay; } m_EndQueue = end; if (m_MoveRecordsMounted.Count > 0) { endMounted = m_EndQueueMounted + delayMounted; } else { endMounted = DateTime.Now + delayMounted; } m_EndQueueMounted = endMounted; if (m_MoveRecordsFooted.Count > 0) { endFooted = m_EndQueueFooted + delyaFooted; } else { endFooted = DateTime.Now + delyaFooted; } m_EndQueueFooted = endFooted; m_MoveRecords.Enqueue(MovementRecord.NewInstance(end)); m_MoveRecordsFooted.Enqueue(MovementRecord.NewInstance(endFooted)); m_MoveRecordsMounted.Enqueue(MovementRecord.NewInstance(endMounted)); return(res); }
public void PostAsJsonAsync(SensorTag.MovementDataChangedEventArgs movementData) { MovementRecord record = new MovementRecord(); record.AssignedName = SelectedSensorTag.AssignedToName; record.DeviceAddress = SelectedSensorTag.DeviceAddress; SingleRecord singleRecord = new SingleRecord(); singleRecord.Time = DateTime.Now; singleRecord.Value = new MovementMeasurement(movementData.X, movementData.Y, movementData.Z); record.Recording.Add(singleRecord); RecordingQueue.SingleRecordingQueue.AddToDeviceQueue(record); }
private void SkipExpired(Queue <MovementRecord> queue) { while (queue.Count > 0) { MovementRecord r = queue.Peek(); if (r.Expired()) { queue.Dequeue(); } else { break; } } }
public static MovementRecord NewInstance(DateTime end) { MovementRecord r; if (m_InstancePool.Count > 0) { r = m_InstancePool.Dequeue(); r.m_End = end; } else { r = new MovementRecord(end); } return(r); }
public void SetBehaviour(RoundRecordContainer shadowActionsRecord) { this.shadowActionsRecord = shadowActionsRecord; actualPositionTarget = this.shadowActionsRecord.roundMovementRecords[0]; if (shadowActionsRecord.roundShootingRecords.Count > 0) { actualInQeueAction = this.shadowActionsRecord.roundShootingRecords[0]; } else { allActionsMade = true; } startMovingTime = Time.time; transform.position = actualPositionTarget.position; timeBetweenChangingPositions = GameManager.Instance.playerRec.recordTime; StartCoroutine(WaitTime(startingWaitTime)); allPositionsMade = false; }
public static MovementRecord NewInstance( DateTime end ) { MovementRecord r; if ( m_InstancePool.Count > 0 ) { r = (MovementRecord)m_InstancePool.Dequeue(); r.m_End = end; } else { r = new MovementRecord( end ); } return r; }
private void SetNextPosition() { actualPositionTarget = shadowActionsRecord.roundMovementRecords [shadowActionsRecord.roundMovementRecords.IndexOf(actualPositionTarget) + 1]; }