public void SaveReplay() { GetInfoToSave(); string newfileName = filePath + fileName + ".txt"; StreamWriter writer = new StreamWriter(newfileName); //Populate while (pointsInTimeToSave.Count > 0) { PointInTime pointInTime = pointsInTimeToSave[0]; string tmpPos = pointInTime.position.x.ToString() + ":" + pointInTime.position.y.ToString() + ":" + pointInTime.position.z.ToString(); string tmpRot = pointInTime.rotation.x.ToString() + ":" + pointInTime.rotation.y.ToString() + ":" + pointInTime.rotation.z.ToString() + ":" + pointInTime.rotation.w.ToString(); string output = tmpPos + ":" + tmpRot; writer.WriteLine(output); pointsInTimeToSave.RemoveAt(0); //print(output); } writer.Close(); }
public void SetPointInTime(float point) { if (isWarping && recordAmount > 0) { int total = recordAmount - 1; int offset = ((int)recordTime * (int)(recordsPerSecond)) - recordAmount; int normalizedIndex = Mathf.FloorToInt(point * (total - 1)); int desiredIndex = normalizedIndex - (total - warpIndex); if (desiredIndex < 0) { desiredIndex = total + desiredIndex + 1 + offset; } try { PointInTime pointInTime = pointsInTime[desiredIndex]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; currentIndex = desiredIndex; } catch (IndexOutOfRangeException e) { Debug.Log(e.ToString() + " " + desiredIndex); } } }
void Rewinding() { if (pointsInTime.Count > 0) { PointInTime poinInTime = pointsInTime[0]; transform.position = poinInTime.position; transform.rotation = poinInTime.rotation; pointsInTime.RemoveAt(0); } else { if (gameObject.tag == "FractRoot") { if (SceneManager.GetActiveScene().name == "TwoObjWater" || SceneManager.GetActiveScene().name == "TwoObjPine") { GameObject obj1 = GameObject.Find("Obj1"); GameObject obj2 = GameObject.Find("Obj2"); obj1.GetComponent <MeshRenderer>().enabled = true; obj1.GetComponent <CapsuleCollider>().enabled = true; obj2.GetComponent <MeshRenderer>().enabled = true; obj2.GetComponent <CapsuleCollider>().enabled = true; gameObject.SetActive(false); } else { GameObject.FindWithTag("Obj").GetComponent <MeshRenderer>().enabled = true; GameObject.FindWithTag("Obj").GetComponent <CapsuleCollider>().enabled = true; gameObject.SetActive(false); } } StopRewind(); } }
private void RecordThisTimestep() { if (IndexOfMostRecentPointInTime > 0) { PointInTime lastPoint = pointsInTime[IndexOfMostRecentPointInTime]; if (transform.position == lastPoint.position && transform.rotation == lastPoint.rotation) { if (stillFrameCounter.ContainsKey(IndexOfMostRecentPointInTime)) { stillFrameCounter[IndexOfMostRecentPointInTime]++; } else { stillFrameCounter.Add(IndexOfMostRecentPointInTime, 1); } } else { pointsInTime.Add(new PointInTime(transform.position, transform.rotation, rb.velocity, rb.angularVelocity)); } } else { pointsInTime.Add(new PointInTime(transform.position, transform.rotation, rb.velocity, rb.angularVelocity)); } }
private void Rewind() { if (pointsInTime.Count > 0) { // Set transform and velocities PointInTime pointInTime = pointsInTime[IndexOfMostRecentPointInTime]; SetObjectToPointInTime(pointInTime); // Manage the stillFrameCounter and the pointsInTime if (stillFrameCounter.ContainsKey(IndexOfMostRecentPointInTime)) { stillFrameCounter[IndexOfMostRecentPointInTime]--; //Debug.Log("Time --> " + Time.time + " --- Popping key " + IndexOfMostRecentPointInTime + ": indices left --> " + stillFrameCounter[IndexOfMostRecentPointInTime]); if (stillFrameCounter[IndexOfMostRecentPointInTime] == 0) { int index = IndexOfMostRecentPointInTime; pointsInTime.RemoveAt(index); stillFrameCounter.Remove(index); } } else { pointsInTime.RemoveAt(IndexOfMostRecentPointInTime); } } else { StopRewind(); } }
List <PointInTime> CalDiscount(DicMallitemEntity entity) { if (string.IsNullOrEmpty(entity.CurrencyDiscount)) { return(new List <PointInTime>(0)); } else { //0,0~100&1000,2000~60 string[] commandValues = entity.CurrencyDiscount.Split('&'); var pointInTimes = new List <PointInTime>(commandValues.Length); foreach (var commandValue in commandValues) { string[] rateInTimes = commandValue.Split('~'); string[] times = rateInTimes[0].Split(','); int discount = Convert.ToInt32(rateInTimes[1]); var pointEntity = new PointInTime(); pointEntity.Point = entity.CurrencyCount * discount / 100; pointEntity.StartTime = ShareUtil.BaseTime.AddMinutes(Convert.ToInt32(times[0])); pointEntity.EndTime = ShareUtil.BaseTime.AddMinutes(Convert.ToInt32(times[1])); pointInTimes.Add(pointEntity); } return(pointInTimes); } }
private ChartPoint CreateChartPoint(PointInTime point, IDateTimeHelper dateTimeHelper, string pattern) { // TODO: Conversion to local date time should be moved to services string stringDate = string.Format(pattern, dateTimeHelper.GetLocalUserDate(point.Date)); return(new ChartPoint(stringDate, point.Value)); }
public void UpdateFreeze() { offset += Time.fixedDeltaTime; PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; }
void Rewind() { if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; canvas.rotation = pointInTime.rotation; myRigidBody.velocity = pointInTime.velocity; up = pointInTime.up; down = pointInTime.down; sideways = pointInTime.sideways; sprite.enabled = pointInTime.spriteActive; if (myRigidBody.velocity.z < 0) { up = true; down = false; sideways = false; } if (myRigidBody.velocity.z > 0) { up = false; down = true; sideways = false; } if (myRigidBody.velocity.x != 0) { up = false; down = false; sideways = true; } myAnim.SetBool("Up", up); myAnim.SetBool("Down", down); myAnim.SetBool("Vertical", sideways); pointsInTime.RemoveAt(0); acceleration += Time.deltaTime; if (acceleration > 0.8 && pointsInTime.Count > 0) { pointsInTime.RemoveAt(0); } if (acceleration > 1.4 && pointsInTime.Count > 1) { pointsInTime.RemoveAt(0); } if (acceleration > 1.8 && pointsInTime.Count > 2) { pointsInTime.RemoveAt(0); } if (acceleration > 2 && pointsInTime.Count > 3) { pointsInTime.RemoveAt(0); } } else { StopRewind(); } }
/// <inheritdoc /> protected override void Print(ExpressionPrinter expressionPrinter) { if (!string.IsNullOrEmpty(Schema)) { expressionPrinter.Append(Schema).Append("."); } expressionPrinter .Append(Name) .Append(" FOR SYSTEM_TIME "); switch (TemporalOperationType) { case TemporalOperationType.AsOf: expressionPrinter .Append("AS OF ") .Append(PointInTime.ToString() !); break; case TemporalOperationType.FromTo: expressionPrinter .Append("FROM ") .Append(From.ToString() !) .Append(" TO ") .Append(To.ToString() !); break; case TemporalOperationType.Between: expressionPrinter .Append("BETWEEN ") .Append(From.ToString() !) .Append(" AND ") .Append(To.ToString() !); break; case TemporalOperationType.ContainedIn: expressionPrinter .Append("CONTAINED IN (") .Append(From.ToString() !) .Append(", ") .Append(To.ToString() !) .Append(")"); break; default: // TemporalOperationType.All expressionPrinter .Append("ALL"); break; } if (Alias != null) { expressionPrinter.Append(" AS ").Append(Alias); } }
/// <summary> /// Record a point in time and do all appropriate logic. /// </summary> private void RecordPoint() { //Store the current position and rotation in a PointInTime. recordedPoint = new PointInTime(transform.position, transform.rotation); //Now uparent the player's outer core from the player and put it in the recorded position. outerCore.parent = null; outerCore.position = recordedPoint.position; outerCore.rotation = recordedPoint.rotation; }
void ReWind() { Time.timeScale = 1; if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(0); } }
private void SetObjectToPointInTime(PointInTime pointInTime) { transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; if (conserveVelocity) { rb.velocity = -pointInTime.velocity; rb.angularVelocity = -pointInTime.angularVelocity; } }
void Rewind() { if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; pointsInTime.RemoveAt(0); } else { StopRewind(); } }
private void Rewind() { if (_pointsInTime.Count > 0) { PointInTime pointInTime = _pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; _pointsInTime.RemoveAt(0); } else { StopRewinding(); } }
//Default Constructor public ClientConnection(TcpClient Connection) { //Store the connection and assign a new network ID this.Connection = Connection; ClientID = ((IPEndPoint)Connection.Client.RemoteEndPoint).Port; //Set up the datastream and buffer for listening for messages from the client Connection.SendBufferSize = 262144; Connection.ReceiveBufferSize = 262144; DataStream = Connection.GetStream(); DataBuffer = new byte[Connection.Available]; DataStream.BeginRead(DataBuffer, 0, DataBuffer.Length, ReadPacket, null); //Set the time of last contact to now LastCommunication = new PointInTime(); }
/// <summary> /// Moves the player back to the recorded point in time, and does other relevant logic. /// </summary> private void RewindToPoint() { //Move the player to the recorded PointInTime. transform.position = recordedPoint.position; transform.rotation = recordedPoint.rotation; //Reparent the outer core to the player and make sure it lines up with the player. outerCore.parent = transform; outerCore.position = transform.position; outerCore.rotation = transform.rotation; //Erase the old recorded point because we just used it up. recordedPoint = null; }
private void Play() { if (index >= 0) { PointInTime point = pointsInTime[index]; transform.position = point.position; transform.rotation = point.rotation; index -= 1; } else { transform.Translate(Vector3.back); } }
void Rewind() { if (positions.Count > 0) { PointInTime pointintime = positions [0]; transform.position = pointintime.pos; transform.rotation = pointintime.rot; positions.RemoveAt(0); } else { StopRewind(); } }
void rewind() { if (rewindList.Count > 0) { PointInTime pointInTime = rewindList[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; rewindList.RemoveAt(0); } else { StopRewinding(); } }
public void Rewind() { if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[pointsInTime.Count - 1]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(pointsInTime.Count - 1); } else { StopRewind(); } }
private void Rewind() { if (index < pointsInTime.Count - 1) { PointInTime point = pointsInTime[index]; transform.position = point.position; transform.rotation = point.rotation; index += 1; } else { rewinding = false; } }
private void Rewind() { if (pointsInTimes.Count > 0) { PointInTime pointInTime = pointsInTimes[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTimes.RemoveAt(0); } else { StopRewind(); } }
private void Replay() { if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(0); } else { playingReplay = false; } }
public void RewindBackward() { if (pointsInTime.Count > 0) { offset += Time.fixedDeltaTime; PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(0); } else { StopRewind(); } }
void Rewind() { if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(0); } else { StopRewind(); doSomething?.Invoke(4); } }
void Rewind() { if (pointInTimes.Count > 0) { PointInTime pointInTime = pointInTimes[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointInTimes.RemoveAt(0); } else { StopRewind(); GameObject.FindGameObjectWithTag("Time").GetComponent <TimeControlSystem>().TimeControl.value = 0; } }
public ThumbnailGenerationOptions(PointInTime pointInTime, ImageType imageType, ImageSize imageSize) { if (pointInTime == null) throw new ArgumentNullException("pointInTime"); if (imageType == null) throw new ArgumentNullException("imageType"); if (imageSize == null) throw new ArgumentNullException("imageSize"); PointInTime = pointInTime; ImageType = imageType; ImageSize = imageSize; }
public void Rewind() { if (pointsInTime.Count > 0) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(0); //Time.timeScale = 2; } else { StopRewind(); } }
void Rewind() { if (pointsInTime.Count > 0 && DataManager.Instance.playerTimeLapseFuel >= 0.03) { PointInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveAt(0); DataManager.Instance.playerTimeLapseFuel -= 0.2f * Time.deltaTime; } else { StopRewind(); } }
void Rewind() { if (pointsInTime.Count > 0) { rb.isKinematic = true; PointInTime pointInTime = pointsInTime.First.Value; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; pointsInTime.RemoveFirst(); } if (pointsInTime.Count == 0) { turnSystem.ResetMatch(); } }
public static PointInTime CreatePointInTime(string @ref, global::System.DateTime date) { PointInTime pointInTime = new PointInTime(); pointInTime.Ref = @ref; pointInTime.Date = date; return pointInTime; }