예제 #1
0
    public void MoveToThisTile()
    {
        DungeonPlayer dp = FindObjectOfType <DungeonSceneManager>().GetPlayer();

        dp.SetIndex(tileIndex);
        dp.Move(transform.position);
    }
예제 #2
0
    private void Start()
    {
        tileSpawner = FindObjectOfType <TileSpawner>();

        // 플레이어 배치
        TileIndex startIdx   = tileSpawner.GetStartIndex();
        float     tileWidth  = tileSpawner.GetTileWidth();
        float     tileHeight = tileSpawner.GetTileHeight();

        // 플레이어 배치 좌표 계산
        Vector3 startPos = new Vector3();

        startPos.x = startIdx.x * tileWidth;
        startPos.y = startIdx.y * tileHeight;

        playerObj = Instantiate(PlayerPrefab, startPos, Quaternion.identity);
        dunPlayer = playerObj.GetComponent <DungeonPlayer>();
        dunPlayer.SetIndex(startIdx);

        // 카메라에 추적대상 설정
        FindObjectOfType <DungeonCamera>().SetTarget(dunPlayer.GetAnchor());
    }