// TODO :: 전 씬에서 고른 PlayerType 기억하고 그에 맞추어 Player 생성하기
    private void PlayerCreate()
    {
        var player1Text = Resources.Load <TextAsset>("Data/Archer1").text;
        var player1Spec = PlayerSpec.CreateFromText(player1Text);

        _player1 = Player.Factory.Create(player1Spec);
        _player1.transform.position = CreatePosition();

        //var player2Text = Resources.Load<TextAsset>("Data/Archer1").text;
        //var player2Spec = PlayerSpec.CreateFromText(player2Text);

        //_player2 = Player.Factory.Create(player2Spec);
        //_player2.transform.position = new Vector3(1.0f, 0.0f, 0.0f);
    }
Пример #2
0
        public static Player Create(PlayerType type)
        {
            // Get Player Spec Struct
            var playerSpecText = Resources.Load <TextAsset>("Data/" + type.ToString()).text;
            var playerSpec     = PlayerSpec.CreateFromText(playerSpecText);

            // Make Player with Spec
            var prefab   = Resources.Load("Prefabs/Player") as GameObject;
            var instance = Instantiate(prefab).GetComponent <Player>();

            if (instance == null)
            {
                Debug.LogError("Player Instantiate Failed");
                return(null);
            }

            instance.Init(playerSpec);

            return(instance);
        }
Пример #3
0
    private IEnumerator PlayerCreate()
    {
        // 내 캐릭터 생성.
        var playerSpecText = Resources.Load <TextAsset>("Data/Archer" + (int)_dataContainer._playerType).text;
        var playerSpec     = PlayerSpec.CreateFromText(playerSpecText);

        _player = Player.Factory.Create(playerSpec);
        _player.OnDamageOccured += OnCharacterDamaged;

        // 적 캐릭터 생성.
        var enemySpecText = Resources.Load <TextAsset>("Data/Archer" + (int)_dataContainer._enemyType).text;
        var enemySpec     = PlayerSpec.CreateFromText(enemySpecText);

        _enemy = Player.Factory.Create(enemySpec);
        _enemy.OnDamageOccured += OnCharacterDamaged;
        _enemy.SetEnemy();

        // 이펙트 매니저에서 쓸 수 있도록 등록.
        _effectManager.SetPlayers(_player.gameObject, _enemy.gameObject);
        yield break;
    }
Пример #4
0
    private void PlayerCreate()
    {
        // 내 캐릭터 생성.
        var playerSpecText = Resources.Load <TextAsset>("Data/Archer1").text;
        var playerSpec     = PlayerSpec.CreateFromText(playerSpecText);

        _player           = Player.Factory.Create(playerSpec);
        _player._isMyTurn = true;

        // 적 캐릭터 생성.
        var enemySpecText = Resources.Load <TextAsset>("Data/Archer2").text;
        var enemySpec     = PlayerSpec.CreateFromText(enemySpecText);

        _enemy = Player.Factory.Create(enemySpec);
        _enemy.SetEnemy();

        var playerPosition = Camera.main.ScreenToWorldPoint(new Vector3(50, 300, 0));

        playerPosition.z           = 10;
        _player.transform.position = playerPosition;

        DataContainer.GetInstance().SetPlayerPosition(_player.transform.position);
        DataContainer.GetInstance().SetEnemyPosition(_enemy.transform.position);
    }