예제 #1
0
    private void PlacePlayer()
    {
        mPlayerPiece = ((GameObject)Instantiate(
                            PlayerPrefab,
                            DungeonManager.Instance.GridPosToWorldPos(DungeonManager.Instance.SpawnPosX, DungeonManager.Instance.SpawnPosY),
                            Quaternion.identity)).GetComponent <PlayerPiece>();

        PlayerData playerData = new PlayerData(3, 0, 0);

        if (PlayerPrefs.HasKey(Constants.kStrPlayerHealth))
        {
            playerData.Health = PlayerPrefs.GetInt(Constants.kStrPlayerHealth);
        }
        if (PlayerPrefs.HasKey(Constants.kStrPlayerHealth))
        {
            playerData.Shield = PlayerPrefs.GetInt(Constants.kStrPlayerShield);
        }
        if (PlayerPrefs.HasKey(Constants.kStrPlayerHealth))
        {
            playerData.Coins = PlayerPrefs.GetInt(Constants.kStrPlayerCoins);
        }
        mPlayerPiece.Initialise(DungeonManager.Instance.SpawnPosX, DungeonManager.Instance.SpawnPosY, playerData);
    }