Ejemplo n.º 1
0
    void Update()
    {
        if (!firstSync)
        {
            InitializeObject();
            firstSync = true;
        }


        trans.position = gamePos.getRenderingPosition();

        if (rend != null)
        {
            rend.sortingOrder = (map.mapDepth - gamePos.toMapCoords().depth - 1) * 10 + 5;
        }

        if (!isLocalPlayer)
        {
            GamePosition syncGamePos = GamePosition.ParseStruct(syncPos);
            gamePos.planePosition = Vector2.Lerp(gamePos.planePosition, syncGamePos.planePosition, Time.deltaTime * lerpRate);
            gamePos.depth         = syncGamePos.depth;

            if (rend.sortingOrder > MoleController.localPlayer.GetComponent <MoleController> ().rend.sortingOrder)
            {
                rend.color = new Color(1, 1, 1, 0);
            }
            else
            {
                rend.color = new Color(1, 1, 1, 1);
            }
        }
        else
        {
            CmdTransmitPosition(gamePos.toStruct());
        }

        GameUpdate();
    }