예제 #1
0
    void Start()
    {
        width          = 32;
        height         = 32;
        player         = GameObject.Find("Player");
        this.pathLimit = 45;
        map            = new TileData[width, height];
        this.walkMap   = new bool[width, height];
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                map[i, j]     = new TileData();
                walkMap[i, j] = true;
            }
        }

        Debug.Log("Creating wolrd?");
        this.worldLoader = GetComponent <WorldLoader>();
        worldLoader.intializeWorldData(map, walkMap, width, height);
        worldLoader.loadWorld();

        this.heightMap = GameObject.Find("Terrain").GetComponent <TerrainGenerator>().getHeightMap();
        Debug.Log(this.heightMap[1, 1]);
        Debug.Log(this.heightMap.Length);
    }
예제 #2
0
    void Start()
    {
        if (!simulateLive)
        {
            worldLoader.loadWorld("railway");
            traceParser.loadTrace("railway_log");
        }
        else
        {
            // Establish the local endpoint for the socket.
            // Dns.GetHostName returns the name of the
            // host running the application.
            IPAddress  ipAddress      = IPAddress.Parse("127.0.0.1");
            IPEndPoint remoteEndPoint = new IPEndPoint(ipAddress, PORT);
            Debug.Log(String.Format("Listening on : {0}:{1}", ipAddress, PORT));

            listener          = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            listener.Blocking = false;
            listener.Bind(remoteEndPoint);
            listener.Listen(1);
        }
    }