示例#1
0
    // Move player to a given tile
    public void MoveToTile(GameTile tile)
    {
        Vector3 newPos = new Vector3(tile.transform.position.x, tile.transform.position.y);

        newPos.z           = -1;
        transform.position = newPos;
        GameTile oldTile = map.GetTileAt(curMapPos);

        curMapPos = tile.mapPosition;
        oldTile.DeOccupy();
        tile.Occupy();
        costSoFar += pathFinder.distance(oldTile.mapPosition.GetPosition(), tile.mapPosition.GetPosition());
    }