Exemplo n.º 1
0
    IEnumerator temporaryPosition(WarpControl wControl)
    {
        yield return(new WaitForSeconds(0.05f));

        linefade.SetBool("inTransition", false);
        gameObject.transform.position = wControl.warpLoc.position;
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
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);
        }
    }