// Start is called before the first frame update void Start() { GameObject prefab1 = Instantiate(Resources.Load(_StaticData.player.curPkmID)) as GameObject; prefab1.transform.parent = ModelContainer.transform; prefab1.name = prefab1.name.Replace("(Clone)", ""); pkmPlayer = prefab1.transform.GetChild(0).gameObject; pkmPlayerAnim = pkmPlayer.GetComponent <animationPKM>(); }
// Start is called before the first frame update void Start() { loadPkmInfo(0); Debug.Log("Loaded opponent's"); loadPkmInfo(1); Debug.Log("Loaded player's"); endScreen.gameObject.SetActive(false); //_StaticData.player.curPkmID = "182"; //_StaticData.opponent.curPkmID = "146"; pkmOpponentData = _StaticData.opponent.load(_StaticData.opponent.curPkmID); pkmPlayerData = _StaticData.player.load(_StaticData.player.curPkmID); //Debug.Log(pkmPlayerData.attack + " " + pkmPlayerData.def); playerPkmHealthCurrent = pkmPlayerData.hp; opponentPkmHealthCurrent = pkmOpponentData.hp; opponentHealth.fillAmount = 1; playerHealth.fillAmount = 1; playerHealth.color = colorHeath2; opponentHealth.color = colorHeath2; pkmPlayerName.text = getPkmName(_StaticData.player.curPkmID); pkmOpponentName.text = getPkmName(_StaticData.opponent.curPkmID); GameObject prefab1 = Instantiate(Resources.Load(_StaticData.player.curPkmID)) as GameObject; prefab1.transform.parent = ModelContainer.transform; prefab1.name = prefab1.name.Replace("(Clone)", ""); GameObject prefab2 = Instantiate(Resources.Load(_StaticData.opponent.curPkmID)) as GameObject; prefab2.transform.parent = ModelContainer.transform; prefab2.name = prefab2.name.Replace("(Clone)", ""); pkmPlayer = prefab1.transform.GetChild(0).gameObject; pkmOpponent = prefab2.transform.GetChild(0).gameObject; cameraAvatarPkm1 = pkmPlayer.transform.Find("Camera").GetComponent <Camera>(); cameraAvatarPkm1.targetTexture = avatarPlayerPkm; cameraAvatarPkm2 = pkmOpponent.transform.Find("Camera").GetComponent <Camera>(); cameraAvatarPkm2.targetTexture = avatarOpponentPkm; pkmPlayerAnim = pkmPlayer.GetComponent <animationPKM>(); pkmOppontentAnim = pkmOpponent.GetComponent <animationPKM>(); playerHealthText.text = Convert.ToString(max(playerPkmHealthCurrent, 0)) + "/" + Convert.ToString(pkmPlayerData.hp); opponentHealthText.text = Convert.ToString(max(opponentPkmHealthCurrent, 0)) + "/" + Convert.ToString(pkmOpponentData.hp); // Debug.Log(pkmPlayer.name); }