//public void SetCharacter(CharacterInfo newCharacterInfo)
    //{
    //    OnCanClick();
    //    SetCharacterInfo(newCharacterInfo);


    //    character = Instantiate(InGameService.defaultCharacter, transform.root.parent);
    //    character.Initialize();

    //    var characterDataSheet = DataBase.Instance.characterDataSheet;
    //    if (characterDataSheet.TryGetCharacterImage(characterInfo.id, out var sprite))
    //    {
    //        character.SetImage(sprite);
    //    }
    //    if (characterDataSheet.TryGetCharacterOrigin(characterInfo.id, out var origin))
    //    {
    //        int Id = characterInfo.id;
    //        int star = characterInfo.star;

    //        var characterAbilityDataSheet = DataBase.Instance.characterAbilityDataSheet;
    //        if(characterAbilityDataSheet.TryGetCharacterAbilityData(Id, star, out var abilityData))
    //        {
    //            character.SetAbility(abilityData, origin);
    //        }
    //    }

    //    character.OnIsDead += OnHide;
    //    character.OnHit += PlayHitParticle;
    //    character.OnHit += PlayShowHPBarForMoment;
    //    character.SetUIFloatingTextList(uiFloatingTextList);
    //    character.characterInfo = this.characterInfo;
    //    character.InitializeUIFloatingTextList();

    //    CharacterMoveToUICharacter();
    //    uiHPBar.Initialize();
    //    uiHPBar.controllingPawn = character;
    //    uiHPBar.SetUpdateHPBarAndAfterImage();
    //}

    public void SetCharacter(CharacterInfo newCharacterInfo)
    {
        OnCanClick();
        characterInfo           = newCharacterInfo;
        character.characterInfo = newCharacterInfo;

        var characterDataSheet = DataBase.Instance.characterDataSheet;

        if (characterDataSheet.TryGetCharacterImage(characterInfo.id, out var sprite))
        {
            character.SetImage(sprite);
        }
        if (characterDataSheet.TryGetCharacterOrigin(characterInfo.id, out var origin))
        {
            if (characterDataSheet.TryGetCharacterTribe(characterInfo.id, out var tribe))
            {
                int Id   = characterInfo.id;
                int star = characterInfo.star;

                var characterAbilityDataSheet = DataBase.Instance.characterAbilityDataSheet;
                if (characterAbilityDataSheet.TryGetCharacterAbilityData(Id, star, out var abilityData))
                {
                    character.SetAbility(abilityData, origin, tribe);
                }
            }
        }

        CharacterMoveToUICharacter();
        character.OnShow();
        character.isOnBattlefield = false;

        uiHPBar.UpdateHPBar();
    }
Beispiel #2
0
    public void SetEnemy(EnemyData newEnemyData)
    {
        //enemy = cInstantiate(InGameServie.defaultEnemy, transform.root.parent);
        enemy.animator.runtimeAnimatorController = newEnemyData.RuntimeAnimatorController;
        enemy.SetAbility(newEnemyData);
        enemy.OnShow();

        EnemyMoveToUIEnemy();
        uiHPBar.UpdateHPBar();
    }