Пример #1
0
    private void GenerateShadow(List <PlayerSavedInfo> teamSaveList)
    {
        int tagIndex = 0;

        foreach (var saveList in teamSaveList)
        {
            var          shadowUnit   = Instantiate(GetShadownInstaceFromTitle(saveList.job), transform.position, Quaternion.identity);
            ItemOnPlayer itemOnPlayer = shadowUnit.gameObject.AddComponent <ItemOnPlayer>();
            PlayerInfo   ShandowInfo  = new PlayerInfo(
                saveList.playerUid,
                saveList.name,
                0,
                saveList.job
                );
            // set item
            itemOnPlayer.SetItemHolder(ShandowInfo);
            AttachItemToShadow(shadowUnit, saveList.itemOwned);

            // set skill
            UpSkillShadow(shadowUnit, saveList.acuiredSkill);

            // tracking shadow
            ShadowCharacterTracking trackingScript = shadowUnit.gameObject.AddComponent <ShadowCharacterTracking>();
            shadowTagControl.create(tagIndex, saveList.name);
            trackingScript.SetKingStateOwner(this, tagIndex, shadowTagControl);
            ++tagIndex;
            generatedShadow.Add(shadowUnit);
        }
    }
Пример #2
0
    public void addPlayerDontDestroyOnLoad(int index, GameObject player)
    {
        ItemOnPlayer itemOnPlayer = player.AddComponent <ItemOnPlayer>() as ItemOnPlayer;

        itemOnPlayer.SetItemHolder(playerManagement.playersInfo[index]);
        playerManagement.playerInstance[index] = player;
        DontDestroyOnLoad(playerManagement.playerInstance[index]);
    }