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); } }
void deathAction(int killerId) { // print("Call Dead Action from " + gameObject.name); myCol.enabled = false; // Shadow Character dead ShadowCharacterTracking tracking = GetComponent <ShadowCharacterTracking>(); if (tracking != null) { tracking.NotifyDead(); } if (playerCon != null && tag != "Enemy") { playerCon.ReportDeath(); reviveArea.activeReviveArea(); if (GameManagerPC.Instance != null && id >= 0) { // player Lose 10% of holding item ItemOnPlayer itemOnPlayer = GetComponent <ItemOnPlayer>(); if (itemOnPlayer != null) { itemOnPlayer.RemoveRandomItemOnPlayer(3); } GameManagerPC.Instance.OnPlayerDeath(id); } return; } EnemyAI enemyAI = gameObject.GetComponent <EnemyAI>(); if (enemyAI != null) { enemyAI.ReportDeath(killerId); } DropControl dropControl = gameObject.GetComponent <DropControl>(); if (dropControl != null) { dropControl.randomDrop(); } }