public void UpdateSelectHero(Hero hero) { Clear(); currentHero = hero; if (Camera.main != null) { string body_prefab_name = DataManager.instance.GetConfigValueToString(hero.heroJob.ToString() + "_body" + "_" + hero.heroSex.ToString()); heroShow3D = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("enemy", body_prefab_name); if (heroShow3D != null) { enity = heroShow3D.GetComponent <Enity>(); if (enity != null) { enity.InitEnityByHero(hero); } Quaternion quaternion = new Quaternion(0, 180, 0, 1); heroShow3D.transform.localRotation = quaternion; heroShow3D.transform.SetParent(Camera.main.transform.parent, false); heroShow3D.transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); heroShow3D.transform.localPosition = new Vector3(0, 0, 0); if (heroShow != null) { heroShow3D.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(heroShow.transform.position.x, heroShow.transform.position.y, 10.0f)); } } } //heroName.text = itemTableData.name; //heroInfo.text = itemTableData.des; bool isinteam = hero.teamPosition > -1; removeButton.gameObject.SetActive(isinteam); changeButton.gameObject.SetActive(!isinteam); }
private void SetCuurentHero() { Dictionary <long, Hero> heroes = DataManager.GetInstance().GetGameData().Heroes; if (heroes.ContainsKey(HeroIndex)) { if (CurrentHero != null) { CurrentHero.transform.SetParent(null, false); CurrentHero.gameObject.SetActive(false); } Hero hero = heroes[HeroIndex]; if (HeroChair != null && hero != null) { string body_prefab_name = DataManager.instance.GetConfigValueToString(hero.heroJob.ToString() + "_body" + "_" + hero.heroSex.ToString()); GameObject bodyPrefab = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("enemy", body_prefab_name); if (bodyPrefab != null) { CurrentHero = bodyPrefab.GetComponent <Enity>(); CurrentHero.transform.SetParent(HeroChair.transform, false); CurrentHero.animatorAction = currentAnimatorAction; CurrentHero.InitEnityByHero(hero); UpdateEquipShow(); } } } }
public void OnFleshRandomHeroes() { ClearRandomHeroes(); for (int i = 0; i < RandomHeroesPosArr.Length; i++) { Hero hero = RandomHeroManager.instance.OnRandomOneHero(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// string body_prefab_name = DataManager.instance.GetConfigValueToString(hero.heroJob.ToString() + "_body" + "_" + hero.heroSex.ToString()); GameObject bodyPrefab = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("enemy", body_prefab_name); if (bodyPrefab != null) { Enity enity = bodyPrefab.GetComponent <Enity>(); if (enity != null) { /////初始化Enity//////////// enity.InitEnityByHero(hero); } RandomHeroes.Add(bodyPrefab); bodyPrefab.transform.SetParent(RandomHeroesPosArr[i].transform, false); } } }
public GameObject CreateFightHero(Hero hero) { GameObject AI = null; string body_prefab_name = DataManager.instance.GetConfigValueToString(hero.heroJob.ToString() + "_body" + "_" + hero.heroSex.ToString()); GameObject bodyPrefab = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("enemy", body_prefab_name); if (bodyPrefab != null) { Enity enity = bodyPrefab.GetComponent <Enity>(); if (enity != null) { enity.InitEnityByHero(hero); } AI = DataManager.GetInstance().CreateGameObjectFromAssetsBundle("", "AI"); bodyPrefab.transform.SetParent(AI.transform, false); AIBase AIScript = AI.GetComponent <AIBase>(); AIScript.InitAIBaseByEnity(enity); AI.name = hero.id.ToString(); createEnityIndex++; } return(AI); }