/// <summary> /// 初始化怪物和菜单栏英雄模型 /// </summary> /// <param name="id"></param> /// <param name="animType"></param> /// <param name="scale"></param> /// <param name="isFacingRight"></param> public void initCharacterModelById(string id, SDConstants.CharacterAnimType animType , float scale = 1, bool isFacingRight = true) { int _id = SDDataManager.Instance.getInteger(id.Split('#')[1]); SDConstants.CharacterModelType modelType = (SDConstants.CharacterModelType)(_id / 100000); //构建 }
//关卡开始时初始化所有行动单元,赋予速度 public void initAction(List <BattleRoleData> allUnits) { stopAction(); foreach (Transform t in actionUnitParent) { Destroy(t.gameObject); } // standardSpeedArray = new int[allUnits.Count]; allActionUnits = new List <ActionRoleData>(); for (int i = 0; i < allUnits.Count; i++) { BattleRoleData BUnit = allUnits[i]; Transform actionUnit = Instantiate(actionUnitPrefab) as Transform; actionUnit.SetParent(actionUnitParent); actionUnit.GetComponent <ActionRoleData>().nameText.text = BUnit.name; ActionRoleData unit = actionUnit.GetComponent <ActionRoleData>(); // int speed = BUnit.ThisBasicRoleProperty()._role.ReadCurrentRoleRA(AttributeData.Speed); standardSpeedArray[i] = speed; unit.speed = speed; // //actionUnit.GetComponent<Canvas>().sortingOrder = i; if (BUnit._Tag == SDConstants.CharacterType.Enemy) { actionUnit.position = startEnemyPos.position; unit.isEnemy = true; if (BUnit.IsBoss) { unit.headImage.initCharacterModelById (BUnit.UnitId, SDConstants.CharacterAnimType.Enemy, 0.15f, true); } else { unit.headImage.initCharacterModelById (BUnit.UnitId, SDConstants.CharacterAnimType.Enemy, 0.3f, true); } } else { actionUnit.position = startHeroPos.position; unit.isEnemy = false; int hashcode = BUnit.unitHashcode; string heroId = SDDataManager.Instance.getHeroIdByHashcode(hashcode); SDConstants.CharacterAnimType type = (SDConstants.CharacterAnimType) (SDDataManager.Instance.getHeroCareerById(heroId)); //unit.headImage.initCharacterModel(hashcode, type, 3f); } actionUnit.localScale = Vector3.one; if (BUnit.ReadThisStateEnable(StateTag.Dizzy)) { unit.stateBgImage.sprite = unit.stateSprites[1]; } else { unit.stateBgImage.sprite = unit.stateSprites[0]; } unit.battleUnit = BUnit; unit.isActed = false; allActionUnits.Add(unit); if (BUnit.IsDead) { actionUnit.gameObject.SetActive(false); } } BuildABMoveSpeed(allActionUnits); //BM.NextActionUnit(); startAction(); }
public void initHero(GDEHeroData hero) { type = SDConstants.ItemType.Hero; itemId = hero.id; itemHashcode = hero.hashCode; if (fightForceText) { fightForceText.text = "" + (SDDataManager.Instance.getHeroOriginalBattleForceByHashCode(itemHashcode));//读取角色战斗力 } SDConstants.CharacterAnimType animType = (SDConstants.CharacterAnimType) (SDDataManager.Instance.getHeroCareerById(itemId)); ROHeroData roh = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes); if (characterModel != null) { characterModel.initHeroCharacterModel(itemHashcode, SDConstants.HERO_MODEL_RATIO); } itemLevel = SDDataManager.Instance.getLevelByExp(hero.exp); if (upText) { upText.gameObject.SetActive(false); } if (downText) { downText.text = SDGameManager.T("Lv.") + itemLevel; } if (slider) { slider.gameObject.SetActive(false); } if (starVision) { starVision.StarNum = roh.starNum; } if (statusImg) { statusImg.gameObject.SetActive(true); statusImg.sprite = UIEffectManager.Instance.heroStatusSps[hero.status]; } // if (itemImg) { } // if (careerImg) { Sprite career = roh.Info.Career.Icon; careerImg.sprite = career; } if (raceImg) { Sprite race = roh.Info.Race.Icon; if (roh.Info.Race.NAME == "无种族") { HeroRace _r = roh.Info.Race; race = _r.Icon; } raceImg.sprite = race; } if (itemBgImg) { itemBgImg.sprite = SDDataManager.Instance.heroBgSpriteByRarity(roh.Info.Rarity); } if (frameImg) { frameImg.sprite = SDDataManager.Instance.heroFrameSpriteByRarity(roh.Info.Rarity); } }