IEnumerator temporaryPosition(WarpControl wControl) { yield return(new WaitForSeconds(0.05f)); linefade.SetBool("inTransition", false); gameObject.transform.position = wControl.warpLoc.position; }
IEnumerator delaymove(WarpControl wControl) { yield return(new WaitForSeconds(0.04f)); gameObject.transform.position = wControl.map.position; Vector3 cam = wControl.camStartPos; iTween.MoveTo(mainCam.gameObject, cam, 2); }
public static double GetTime() { int latestSubspaceInt = WarpControl.GetLatestSubspace(); if (subspaces.ContainsKey(latestSubspaceInt)) { Subspace latestSubspace = subspaces[latestSubspaceInt]; double clockDiff = (DateTime.UtcNow.Ticks - latestSubspace.serverClock) / (double)TimeSpan.TicksPerSecond; return(latestSubspace.planetTime + (clockDiff * latestSubspace.subspaceSpeed)); } return(0); }
void OnCollisionEnter2D(Collision2D warp) { if (warp.gameObject.tag == "portal") { //Debug.Log("Enter portal"); WarpControl wControl = warp.gameObject.GetComponent <WarpControl>(); gameObject.transform.position = wControl.map.position; Vector3 cam = wControl.camStartPos; StartCoroutine("temporaryPosition", wControl); iTween.MoveTo(mainCam.gameObject, cam, 1); if (cam != wControl.warpLoc.position) { pControl.speedMultiplier = 0; } StartCoroutine("delayControl", 0.1f); } if (warp.gameObject.tag == "LevelPortal") { WarpControl wControl = warp.gameObject.GetComponent <WarpControl>(); fadeline.SetActive(true); linefade.SetBool("inTransition", true); Vector3 cam = wControl.camStartPos; gameObject.transform.position = wControl.map.position; StartCoroutine("disablefade"); StartCoroutine("delaymove", wControl); StartCoroutine("temporaryPosition", wControl); if (cam != wControl.warpLoc.position) { pControl.speedMultiplier = 0; } StartCoroutine("delayControl", 1.2f); } }