/// <summary> /// 创建怪物 /// </summary> private void CreateMonterObject() { MonsterTemplate _monsterData = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(GlobalMembers.SPELL_SHOW_MONTER_ID); ArtresourceTemplate _atrRes = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_monsterData.getArtresources()); GameObject _assetRes = AssetLoader.Inst.GetAssetRes(_atrRes.getArtresources()); if (_assetRes != null) { GameObject _go = Instantiate(_assetRes, m_BossPos.position, m_BossPos.rotation) as GameObject; SceneObjectManager.GetInstance().SceneObjectAddMonster(_go, 1, 0); //_go.transform.rotation = Quaternion.Euler(_go.transform.rotation.x, 180, _go.transform.rotation.z); _go.transform.localScale = new Vector3(3, 3, 3); Animation _anim = _go.GetComponent <Animation>(); if (_anim == null) { return; } if (_go.GetComponent <Animation>()["Idle1"] != null) { _go.GetComponent <Animation>().CrossFade("Idle1"); } else if (_go.GetComponent <Animation>()["Nidle1"] != null) { _go.GetComponent <Animation>().CrossFade("Nidle1"); } _go.GetComponent <Animation>().wrapMode = WrapMode.Loop; } }
//实例化怪物 [1/20/2015 Zmy] private void InstantiateMonsterObj() { int MonsterNum = FightEditorContrler.GetInstantiate().GetMonsterGroupEditorData(m_RoundInScene).Count; FightEditorContrler.GetInstantiate().SetMonsterTroopType(ObjectSelf.GetInstance().LimitFightMgr.m_MonsterTroopType); FightEditorContrler.GetInstantiate().SetBeginFightCount(ObjectSelf.GetInstance().LimitFightMgr.m_RoundNum); for (int i = 0; i < MonsterNum; ++i) { int nTableID = SceneObjectManager.GetInstance().GetMosnterBundleRes(m_RoundInTotal, i); MonsterTemplate pRow = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(nTableID); ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(pRow.getArtresources()); string _res = art.getArtresources(); GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(_res); GameObject obj = Instantiate(_AssetRes, FightEditorContrler.GetInstantiate().GetMonsterGroupEditorData(m_RoundInScene)[i].MyPos, FightEditorContrler.GetInstantiate().GetMonsterGroupEditorData(m_RoundInScene)[i].MyAngle) as GameObject; GameUtils.SetLayerRecursively(obj, FightEditorContrler.GetInstantiate().GetShadowCullMaskLayer()); float _zoom = art.getArtresources_zoom() * pRow.getMonsterEnlarge(); obj.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); FightEditorContrler.GetInstantiate().SetMonsterBirthState(obj, FightEditorContrler.GetInstantiate().GetMonsterGroupEditorData(m_RoundInScene)[i], false); SceneObjectManager.GetInstance().SceneObjectAddMonster(obj, m_RoundInTotal, i); //Transform _body = null; //_body = obj.transform.FindChild("Body"); //if (_body != null) //{ // _body.gameObject.SetActive(false); // StartCoroutine(OnShowMonsterObj(_body)); //} for (int m = 0, n = obj.transform.childCount; m < n; m++) { obj.transform.GetChild(m).gameObject.SetActive(false); } StartCoroutine(OnShowMonsterObj(obj.transform)); //怪物入场怒气加成 [10/17/2015 Zmy] AngertableTemplate _data = (AngertableTemplate)DataTemplate.GetInstance().m_AngerTable.getTableData(pRow.getFuryId()); if (_data == null) { continue; } m_EnemyPower.OnUpdatePowerValue(_data.getStartFury()); } // //每波怪物初始化时候,初始敌方怒气值 [3/3/2015 Zmy] // if (m_RoundInScene - 1 >= 0 && m_RoundInScene - 1 < m_StageRow.m_waveFury.Length) // { // int nValue = m_StageRow.m_waveFury[m_RoundInScene - 1]; // m_EnemyPower.OnUpdatePowerValue(nValue); // } //初始化释放怪物的被动技能 [7/31/2015 Zmy] SceneObjectManager.GetInstance().OnMonsterFreePassiveSpell(); // add by zcd SetFightState(FightState.prepareEnemy_over); }
//初始化怪物卡牌 public void InitMonsterCard(MonsterTemplate _monster) { Parent = selfTransform.FindChild("Parent"); Image Boss_Image = Parent.FindChild("Boss_Image").GetComponent <Image>(); CardNameText = Parent.FindChild("Name_txt").GetComponent <Text>(); _CardLevelText = Parent.FindChild("Level_txt"); CardImage = Parent.FindChild("Icon_Img").GetComponent <Image>(); CardStar = _monster.getMonsterstar(); maxStar = _monster.getMonstermaxstar(); CardLevel = _monster.getMonsterlevel(); CardName = GameUtils.getString(_monster.getMonstername()); CardNameText.text = CardName;//名称 InterfaceControler.GetInst().AddLevelNum(CardLevel.ToString(), _CardLevelText, url); _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_monster.getArtresources()); Sprite _img = UIResourceMgr.LoadSprite(common.defaultPath + _Artresourcedata.getHeadiconresource()); CardImage.sprite = _img;//图片 for (int i = 0; i < 5; i++) { Image temp = Parent.FindChild("Star_Image").GetChild(i).GetComponent <Image>(); temp.enabled = i < maxStar; temp = Parent.FindChild("Star_Image").GetChild(i + 5).GetComponent <Image>(); temp.enabled = i < CardStar; } Boss_Image.enabled = _monster.getMonstertype() == 2 ? true : false; }
private void IndexModel(MonsterTemplate monster) { ArtresourceTemplate _Artresourcedata = new ArtresourceTemplate(); _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(monster.getArtresources()); PushNeedDownBundle(_Artresourcedata.getArtresources() + _strRes); string[] ActArtresourceData = _Artresourcedata.getActionresource(); for (int i = 0; i < ActArtresourceData.Length; ++i) { PushNeedDownBundle(ActArtresourceData[i] + _strRes); } }
private void OnEnemyOnDie(GameEvent ge) { CurrentMonsterDieCount++; for (int i = 0; i < CurrentAllMonsterdataList.Count; ++i) { if (CurrentAllMonsterdataList[i].MonsterPointdataList.Count <= 0) { continue; } if (CurrentAllMonsterdataList[i].MonsterPointdataList[0].Entertype == MonsterEnterType.Bench && CurrentAllMonsterdataList[i].MonsterPointdataList[0].BenchCount == CurrentMonsterDieCount) { int fightCount = ObjectSelf.GetInstance().IsLimitFight ? ObjectSelf.GetInstance().LimitFightMgr.m_RoundNum : CurrentFightCount; int id = SceneObjectManager.GetInstance().GetMosnterBundleRes(fightCount, i); MonsterTemplate pRow = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(id); ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(pRow.getArtresources()); string _res = art.getArtresources(); GameObject _Monster = AssetLoader.Inst.GetAssetRes(_res); GameObject obj = Instantiate(_Monster, CurrentAllMonsterdataList[i].MyPos, CurrentAllMonsterdataList[i].MyAngle) as GameObject; float _zoom = art.getArtresources_zoom() * pRow.getMonsterEnlarge(); obj.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); MonsterObjList.Add(obj); SetMonsterBirthState(obj, CurrentAllMonsterdataList[i], false, i); } } //X_GUID monsterGuid = ge.data as X_GUID; //if (monsterGuid != null) //{ // //判断前排英雄是否消失; // //TODO::这里应该考虑到是否有支援怪物(和策划确认了不要支援怪物了2015/10/30/11.20); // //List<ObjectMonster> monsters = SceneObjectManager.GetInstance().GetSceneMonsterList(); // //if (monsters != null && monsters.Count > 0) // //{ // // //写死的阵型,前2后3; // // for (int i = 0; i < 2; i++) // // { // // } // //} // if (IsFrontRowDie()) // { // SceneObjectManager.GetInstance().ObjectHeroMoveTarget(); // } //} }
public void SetData(int tableID) { int quality = -1; string iconStr = string.Empty; string name = string.Empty; string hintTxt = string.Empty; string detail = string.Empty; EM_OBJECT_CLASS eoc = GameUtils.GetObjectClassById(tableID); switch (eoc) { case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: ItemTemplate runeItemT = DataTemplate.GetInstance().GetItemTemplateById(tableID); if (runeItemT == null) { LogManager.LogError("item表格中缺少物品id=" + tableID); return; } iconStr = runeItemT.getIcon_s(); name = GameUtils.getString(runeItemT.getName()); int count = 0; if (ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, tableID, ref count)) { } else { count = 0; } hintTxt = string.Format(GameUtils.getString("tongyong_daoju1"), count); detail = GameUtils.getString(runeItemT.getDes()); quality = runeItemT.getRune_quality(); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: ItemTemplate itemT = DataTemplate.GetInstance().GetItemTemplateById(tableID); if (itemT == null) { LogManager.LogError("item表格中缺少物品id=" + tableID); return; } iconStr = itemT.getIcon_s(); name = GameUtils.getString(itemT.getName()); int num = 0; if (ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, tableID, ref num)) { } else { num = 0; } hintTxt = string.Format(GameUtils.getString("tongyong_daoju1"), num); detail = GameUtils.getString(itemT.getDes()); quality = itemT.getQuality(); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_MONSTER: MonsterTemplate monsterT = DataTemplate.GetInstance().m_MonsterTable.getTableData(tableID) as MonsterTemplate; if (monsterT == null) { LogManager.LogError("item表格中缺少物品id=" + tableID); return; } ArtresourceTemplate artMonster = DataTemplate.GetInstance().GetArtResourceTemplate(monsterT.getArtresources()); if (artMonster == null) { LogManager.LogError("ArtResource时装表格中缺少物品id=" + monsterT.getArtresources()); return; } iconStr = artMonster.getHeadiconresource(); name = GameUtils.getString(monsterT.getMonstername()); hintTxt = string.Format("Lv{0}", monsterT.getMonsterlevel()); detail = GameUtils.getString(monsterT.getDescriptionID()); quality = monsterT.getMonsterstar(); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: HeroTemplate heroT = DataTemplate.GetInstance().GetHeroTemplateById(tableID); if (heroT == null) { LogManager.LogError("hero表格中缺少物品id=" + tableID); return; } ArtresourceTemplate artHero = DataTemplate.GetInstance().GetArtResourceTemplate(heroT.getArtresources()); if (artHero == null) { LogManager.LogError("ArtResource时装表格中缺少物品id=" + heroT.getArtresources()); return; } iconStr = artHero.getHeadiconresource(); //英雄的初始品质为HeroTemplate中的Quality; name = string.Format(GameUtils.GetHeroNameFontColor(heroT.getQuality()), GameUtils.getString(heroT.getNameID())); ObjectCard oc = ObjectSelf.GetInstance().HeroContainerBag.FindHero(tableID); hintTxt = string.Format("Lv{0}", oc == null ? 1 : oc.GetHeroData().Level); detail = GameUtils.getString(heroT.getDescriptionID()); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN: ArtresourceTemplate artT = DataTemplate.GetInstance().GetArtResourceTemplate(tableID); if (artT == null) { LogManager.LogError("ArtResource时装表格中缺少物品id=" + tableID); return; } iconStr = string.Empty; name = string.Empty; hintTxt = string.Empty; detail = string.Empty; break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: //资源类型点击无响应; iconStr = string.Empty; name = string.Empty; hintTxt = string.Empty; detail = string.Empty; break; default: LogManager.LogError("未处理的商城物品预览类型"); break; } name = string.Format(GameUtils.GetHeroNameFontColor(quality), name); SetData(iconStr, name, hintTxt, detail); }