コード例 #1
0
ファイル: Player.cs プロジェクト: Epicguru/NotQuiteDead
    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);
                }
            }
        }
    }