Ejemplo n.º 1
0
    public void Update()
    {
        if (RequestGear)
        {
            // Request the gear for this player.
            if (!isServer)
            {
                Player.Local.NetUtils.CmdRequestGear(this.gameObject);
            }
            RequestGear = false;
        }

        gameObject.name = Name;

        DebugText.Log("[" + Name + " - " + Team + "] @ " + transform.position.ToString("F0"), Color.cyan);

        // If this is the local player, load the chunks around them.
        if (isLocalPlayer)
        {
            RectInt bounds    = World.Instance.TileMap.GetCameraChunkBounds();
            int     chunkSize = World.Instance.TileMap.ChunkSize;
            int     x         = bounds.xMin / chunkSize;
            int     y         = bounds.yMin / chunkSize;
            int     endX      = bounds.xMax / chunkSize;
            int     endY      = bounds.yMax / chunkSize;

            AO.CancelAllRequests();

            for (int X = x; X < endX; X++)
            {
                for (int Y = y; Y < endY; Y++)
                {
                    AO.RequestChunk(X, Y);
                }
            }
        }
    }