public void ChangePetAvatar(int petID, int petStage) { if (petID == m_petID && petStage == m_petStage) { return; } m_petID = petID; m_petStage = petStage; if (m_myPetBird != null) { GameObject.Destroy(m_myPetBird.gameObject); m_myPetBird = null; } Transform stop = m_curModel.FindChild("birdstop"); string petava = A3_PetModel.getInstance().GetPetAvatar(m_petID, 0); if (petava == "") { return; } GameObject birdPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_" + petava); GameObject pathPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_birdpath"); if (birdPrefab == null || pathPrefab == null) { return; } GameObject bird = GameObject.Instantiate(birdPrefab, stop.position, Quaternion.identity) as GameObject; GameObject path = GameObject.Instantiate(pathPrefab, stop.position, Quaternion.identity) as GameObject; if (bird == null || path == null) { return; } path.transform.parent = stop; bird.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); m_myPetBird = bird.AddComponent <PetBird>(); m_myPetBird.Path = path; }
public void ChangePetAvatar(int petID, int petStage) { bool flag = petID == this.m_petID && petStage == this.m_petStage; if (!flag) { this.m_petID = petID; this.m_petStage = petStage; bool flag2 = this.m_myPetBird != null; if (flag2) { UnityEngine.Object.Destroy(this.m_myPetBird.gameObject); this.m_myPetBird = null; } Transform transform = this.m_curModel.FindChild("birdstop"); string petAvatar = ModelBase <A3_PetModel> .getInstance().GetPetAvatar(this.m_petID, 0); bool flag3 = petAvatar == ""; if (!flag3) { GameObject gameObject = Resources.Load <GameObject>("profession/" + petAvatar); GameObject gameObject2 = Resources.Load <GameObject>("profession/birdpath"); bool flag4 = gameObject == null || gameObject2 == null; if (!flag4) { GameObject gameObject3 = UnityEngine.Object.Instantiate(gameObject, transform.position, Quaternion.identity) as GameObject; GameObject gameObject4 = UnityEngine.Object.Instantiate(gameObject2, transform.position, Quaternion.identity) as GameObject; bool flag5 = gameObject3 == null || gameObject4 == null; if (!flag5) { gameObject4.transform.parent = transform; gameObject3.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); this.m_myPetBird = gameObject3.AddComponent <PetBird>(); this.m_myPetBird.Path = gameObject4; } } } } }
public void creatPetAvatar(int carr) { if (m_myPetBird != null) { GameObject.Destroy(m_myPetBird.gameObject); m_myPetBird = null; } Transform stop = m_curModel.FindChild("birdstop"); GameObject path = null; GameObject bird = null; string str = XMLMgr.instance.GetSXML("newpet.pet", "pet_id==" + carr).getString("mod"); if (carr == 2) { GameObject birdPrefab; birdPrefab = GAMEAPI.ABModel_LoadNow_GameObject(/*"profession_eagle"*/ "profession_" + str); GameObject pathPrefab; pathPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_birdpath"); if (birdPrefab == null || pathPrefab == null) { return; } bird = GameObject.Instantiate(birdPrefab, stop.position, Quaternion.identity) as GameObject; path = GameObject.Instantiate(pathPrefab, stop.position, Quaternion.identity) as GameObject; } else if (carr == 3) { GameObject birdPrefab; birdPrefab = GAMEAPI.ABModel_LoadNow_GameObject(/*"profession_yaque"*/ "profession_" + str); GameObject pathPrefab; pathPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_birdpath"); if (birdPrefab == null || pathPrefab == null) { return; } bird = GameObject.Instantiate(birdPrefab, stop.position, Quaternion.identity) as GameObject; path = GameObject.Instantiate(pathPrefab, stop.position, Quaternion.identity) as GameObject; } else if (carr == 5) { GameObject birdPrefab; birdPrefab = GAMEAPI.ABModel_LoadNow_GameObject(/*"profession_yingwu"*/ "profession_" + str); GameObject pathPrefab; pathPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_birdpath"); if (birdPrefab == null || pathPrefab == null) { return; } bird = GameObject.Instantiate(birdPrefab, stop.position, Quaternion.identity) as GameObject; path = GameObject.Instantiate(pathPrefab, stop.position, Quaternion.identity) as GameObject; } if (bird == null || path == null) { return; } path.transform.parent = stop; bird.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); m_myPetBird = bird.AddComponent <PetBird>(); m_myPetBird.Path = path; }
public void creatPetAvatar(int carr) { bool flag = this.m_myPetBird != null; if (flag) { UnityEngine.Object.Destroy(this.m_myPetBird.gameObject); this.m_myPetBird = null; } Transform transform = this.m_curModel.FindChild("birdstop"); GameObject gameObject = null; GameObject gameObject2 = null; bool flag2 = carr == 2; if (flag2) { GameObject gameObject3 = Resources.Load <GameObject>("profession/eagle"); GameObject gameObject4 = Resources.Load <GameObject>("profession/birdpath"); bool flag3 = gameObject3 == null || gameObject4 == null; if (flag3) { return; } gameObject2 = (UnityEngine.Object.Instantiate(gameObject3, transform.position, Quaternion.identity) as GameObject); gameObject = (UnityEngine.Object.Instantiate(gameObject4, transform.position, Quaternion.identity) as GameObject); } else { bool flag4 = carr == 3; if (flag4) { GameObject gameObject5 = Resources.Load <GameObject>("profession/yaque"); GameObject gameObject6 = Resources.Load <GameObject>("profession/birdpath"); bool flag5 = gameObject5 == null || gameObject6 == null; if (flag5) { return; } gameObject2 = (UnityEngine.Object.Instantiate(gameObject5, transform.position, Quaternion.identity) as GameObject); gameObject = (UnityEngine.Object.Instantiate(gameObject6, transform.position, Quaternion.identity) as GameObject); } else { bool flag6 = carr == 5; if (flag6) { GameObject gameObject7 = Resources.Load <GameObject>("profession/yingwu"); GameObject gameObject8 = Resources.Load <GameObject>("profession/birdpath"); bool flag7 = gameObject7 == null || gameObject8 == null; if (flag7) { return; } gameObject2 = (UnityEngine.Object.Instantiate(gameObject7, transform.position, Quaternion.identity) as GameObject); gameObject = (UnityEngine.Object.Instantiate(gameObject8, transform.position, Quaternion.identity) as GameObject); } } } bool flag8 = gameObject2 == null || gameObject == null; if (!flag8) { gameObject.transform.parent = transform; gameObject2.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); this.m_myPetBird = gameObject2.AddComponent <PetBird>(); this.m_myPetBird.Path = gameObject; } }