public void Show3DModel(ArtresourceTemplate artT) { GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(artT.getArtresources()); if (_AssetRes != null && _AssetRes.GetComponent <NavMeshAgent> () != null) { _AssetRes.GetComponent <NavMeshAgent> ().enabled = false; } //实例化该对象 Card3Dmodel = Instantiate(_AssetRes, m_Point.position, m_Point.rotation) as GameObject; float _zoom = artT.getArtresources_zoom(); Card3Dmodel.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); Card3Dmodel.transform.parent = m_Point; //设置3D模型摩擦力 Card3Dmodel.rigidbody.angularDrag = 2.8f; Card3Dmodel.rigidbody.mass = 1.5f; //_obj.transform.localScale = new Vector3(1.3f,1.3f,1.3f); Animation anim = Card3Dmodel.GetComponent <Animation> (); if (anim == null) { return; } Card3Dmodel.GetComponent <Animation> ().Play("Nidle1"); Card3Dmodel.GetComponent <Animation> ().wrapMode = WrapMode.Loop; }
/// <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; } }
/// <summary> /// 创建英雄 /// </summary> private void CreateHeroObject() { GameObject _heroObject = AssetLoader.Inst.GetAssetRes(m_ArtResData.getArtresources()); if (_heroObject != null) { Transform _pos = null; if (m_AttackType == 0) { _pos = m_HeroNearPos; } else { _pos = m_HeroFarPos; } GameObject _obj = Instantiate(_heroObject, _pos.position, _pos.rotation) as GameObject; _obj.transform.localScale = new Vector3(2, 2, 2); Animation _anim = _obj.GetComponent <Animation>(); if (_anim == null) { return; } if (_obj.GetComponent <Animation>()["Idle1"] != null) { _obj.GetComponent <Animation>().CrossFade("Idle1"); } else if (_obj.GetComponent <Animation>()["Nidle1"] != null) { _obj.GetComponent <Animation>().CrossFade("Nidle1"); } _obj.GetComponent <Animation>().wrapMode = WrapMode.Loop; SceneObjectManager.GetInstance().SceneObjectAddHero(_obj, m_HeroTableId, m_Card); } }
/// <summary> /// 显示3D模型 /// </summary> /// <param name="card"></param> private void Show3DModel(ObjectCard m_Card) { ClearModel(); m_Point = GameObject.Find("pos").transform; ArtresourceTemplate m_Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(m_Card.GetHeroData().GetHeroViewID()); GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(m_Artresourcedata.getArtresources()); if (_AssetRes != null) { if (_AssetRes.GetComponent <NavMeshAgent>() != null) { _AssetRes.GetComponent <NavMeshAgent>().enabled = false; } m_Card3Dmodel = Instantiate(_AssetRes, m_Point.position, m_Point.rotation) as GameObject; float _zoom = m_Artresourcedata.getArtresources_zoom(); m_Card3Dmodel.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); m_Card3Dmodel.transform.parent = m_Point; ////设置3D模型摩擦力 //m_Card3Dmodel.rigidbody.angularDrag = 2.8f; //m_Card3Dmodel.rigidbody.mass = 1.5f; Animation anim = m_Card3Dmodel.GetComponent <Animation>(); if (anim == null) { return; } m_Card3Dmodel.GetComponent <Animation>().Play("Nidle1"); m_Card3Dmodel.GetComponent <Animation>().wrapMode = WrapMode.Loop; } }
private void IndexModel(HeroTemplate hero, bool isHero = false) { ArtresourceTemplate _Artresourcedata = new ArtresourceTemplate(); _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); PushNeedDownBundle(_Artresourcedata.getArtresources() + _strRes, isHero); ArtresourceTemplate[] _SkinArtresourcedata = new ArtresourceTemplate[hero.getUseableArtresource().Length]; for (int i = 0; i < hero.getUseableArtresource().Length; ++i) { _SkinArtresourcedata[i] = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getUseableArtresource()[i]); if (_SkinArtresourcedata[i].getArtresources() == null) { continue; } PushNeedDownBundle(_SkinArtresourcedata[i].getArtresources() + _strRes, isHero); } if (!SceneManager.Inst.NextloadScene.ToString().Contains("Battle")) { return; } string[] ActArtresourceData = _Artresourcedata.getActionresource(); for (int i = 0; i < ActArtresourceData.Length; ++i) { PushNeedDownBundle(ActArtresourceData[i] + _strRes); } }
//实例化Hero对象 private void CallBack_InitHeroObject() { for (int i = 0; i < GlobalMembers.MAX_TEAM_CELL_COUNT; ++i) { int nGroup = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); if (nGroup < 0 && nGroup >= GlobalMembers.MAX_MATRIX_COUNT) { continue; } X_GUID pMemberGuiD = null; if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter) { pMemberGuiD = ObjectSelf.GetInstance().LimitFightMgr.m_HeroInfo[i]; if (ObjectSelf.GetInstance().LimitFightMgr.m_HeroHp[i] == 0) { //初始英雄时,如果血量记录是0 代表本次是继续开启的试炼。并且上次的英雄已死亡。那么本次不再实例化英雄 [6/19/2015 Zmy] pMemberGuiD.CleanUp(); } } else { pMemberGuiD = ObjectSelf.GetInstance().Teams.m_Matrix[nGroup, i]; //暂时默认上场第一组阵型的英雄[3/25/2015 Zmy] } if (!pMemberGuiD.IsValid()) { continue; } ObjectCard pHero = ObjectSelf.GetInstance().HeroContainerBag.FindHero(pMemberGuiD); if (pHero == null) { continue; } ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(pHero.GetHeroData().GetHeroViewID()); if (_Artresourcedata == null) { continue; } GameObject pHeroObject = AssetLoader.Inst.GetAssetRes(_Artresourcedata.getArtresources()); if (pHeroObject != null) { GameObject obj1 = Instantiate(pHeroObject, FightEditorContrler.GetInstantiate().GetFormationCenterPos(i), FightEditorContrler.GetInstantiate().GetFormationCenterAngle(i)) as GameObject; GameUtils.SetLayerRecursively(obj1, FightEditorContrler.GetInstantiate().GetShadowCullMaskLayer()); float _zoom = _Artresourcedata.getArtresources_zoom(); obj1.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); SceneObjectManager.GetInstance().SceneObjectAddHero(obj1, pHero.GetHeroRow().getId(), pHero); FightEditorContrler.GetInstantiate().InitFormationPos(pHero, i); } } FightEditorContrler.GetInstantiate().HeroPathInitSpeed(); GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_StoryCameraEnd); //初始化完成后,切换状态 [1/20/2015 Zmy] SetFightState(FightState.prepareData); //初始入场怒气 InitFightPower(); }
public void Show3DModel(ObjectCard _card) { ModelCear(); //通过表ID获取到英雄数据表 HeroTemplate _HeroData = _card.GetHeroRow(); //通过英雄数据表中的资源数据表ID得到资源表数据 ArtresourceTemplate _Artresourcedata = new ArtresourceTemplate(); _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_card.GetHeroRow().getArtresources()); //通过资源表获取到角色默认美术资源(名称) 通过该名称获取到动态加载数据返回一个对象 GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(_Artresourcedata.getArtresources()); //实例化该对象 Card3Dmodel = Instantiate(_AssetRes, _Point.position, _Point.rotation) as GameObject; float _zoom = _Artresourcedata.getArtresources_zoom(); Card3Dmodel.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); Card3Dmodel.transform.parent = _Point; //设置3D模型摩擦力 Card3Dmodel.rigidbody.angularDrag = 1; Card3Dmodel.rigidbody.mass = 1; //_obj.transform.localScale = new Vector3(1.3f,1.3f,1.3f); Animation anim = Card3Dmodel.GetComponent <Animation>(); if (anim == null) { return; } Card3Dmodel.GetComponent <Animation>().Play("Nidle1"); Card3Dmodel.GetComponent <Animation>().wrapMode = WrapMode.Loop; }
/// <summary> /// 显示3D模型 /// </summary> /// <param name="card"></param> IEnumerator Show3DModel() { ArtresourceTemplate m_Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(mObjectCard.GetHeroData().GetHeroViewID()); GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(m_Artresourcedata.getArtresources()); while (AssetLoader.Inst.IsReadyOver == false) { yield return(1); } ClearModel(); GameObject go = GameObject.Find("pos"); if (go == null) { GameObject ModelViewRoom = GameObject.Find("ModelViewRoom"); if (ModelViewRoom == null) { Vector3 _pos = new Vector3(5000, 0, 0); ModelViewRoom = Instantiate(Resources.Load("UI/Prefabs/UI_Home/MainHome/ModelViewRoom"), _pos, Quaternion.identity) as GameObject; ModelViewRoom.name = "ModelViewRoom"; } m_Point = ModelViewRoom.transform.FindChild("pos"); m_Point.localPosition = new Vector3(m_Point.localPosition.x + 0.2f, m_Point.localPosition.y, m_Point.localPosition.z); GameObject camObj = m_Point.FindChild("Camera").gameObject; camObj.SetActive(true); } else { m_Point = GameObject.Find("pos").transform; } if (_AssetRes != null) { if (_AssetRes.GetComponent <NavMeshAgent>() != null) { _AssetRes.GetComponent <NavMeshAgent>().enabled = false; } m_Card3Dmodel = Instantiate(_AssetRes, m_Point.position, m_Point.rotation) as GameObject; float _zoom = m_Artresourcedata.getArtresources_zoom(); m_Card3Dmodel.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); m_Card3Dmodel.transform.parent = m_Point; ////设置3D模型摩擦力 //m_Card3Dmodel.rigidbody.angularDrag = 2.8f; //m_Card3Dmodel.rigidbody.mass = 1.5f; Animation anim = m_Card3Dmodel.GetComponent <Animation>(); if (anim != null) { m_Card3Dmodel.GetComponent <Animation>().Play("Nidle1"); m_Card3Dmodel.GetComponent <Animation>().wrapMode = WrapMode.Loop; } } }
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); } }
// ============================= 事件响应回调函数 ================================= //实例化hero出场特效; private void CallBack_InitHeroEffect() { for (int i = 0; i < GlobalMembers.MAX_TEAM_CELL_COUNT; ++i) { int nGroup = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); if (nGroup < 0 && nGroup >= GlobalMembers.MAX_MATRIX_COUNT) { continue; } X_GUID pMemberGuiD = null; if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter) { pMemberGuiD = ObjectSelf.GetInstance().LimitFightMgr.m_HeroInfo[i]; if (ObjectSelf.GetInstance().LimitFightMgr.m_HeroHp[i] == 0) { //初始英雄时,如果血量记录是0 代表本次是继续开启的试炼。并且上次的英雄已死亡。那么本次不再实例化英雄 [6/19/2015 Zmy] pMemberGuiD.CleanUp(); } } else { pMemberGuiD = ObjectSelf.GetInstance().Teams.m_Matrix[nGroup, i]; //暂时默认上场第一组阵型的英雄[3/25/2015 Zmy] } if (!pMemberGuiD.IsValid()) { continue; } ObjectCard pHero = ObjectSelf.GetInstance().HeroContainerBag.FindHero(pMemberGuiD); if (pHero == null) { continue; } ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(pHero.GetHeroData().GetHeroViewID()); if (_Artresourcedata == null) { continue; } GameObject pHeroObject = AssetLoader.Inst.GetAssetRes(_Artresourcedata.getArtresources()); if (pHeroObject != null) { //创建出场特效; GameObject eff = Instantiate(Resources.Load("Effect/Effect_Chuchang01"), FightEditorContrler.GetInstantiate().GetFormationCenterPos(i), FightEditorContrler.GetInstantiate().GetFormationCenterAngle(i)) as GameObject; Destroy(eff, 0.3f); } } Invoke("CallBack_InitHeroObject", 0.3f); }
/// <summary> /// 显示3D模型 /// </summary> /// <param name="card"></param> public void Show3DModel(ObjectCard card, int resId = 0) { ModelCear(); if (m_Point == null) { //ModelViewRoom = Instantiate(Resources.Load("UI/Prefabs/UI_Home/ModelViewRoom"), new Vector3(-5000, 0, 0), Quaternion.identity) as GameObject; m_Point = GameObject.Find("pos").transform; } if (resId == 0) { m_heroShowID = card.GetHeroData().GetHeroViewID(); } else { m_heroShowID = resId; } m_Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(m_heroShowID); GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(m_Artresourcedata.getArtresources()); if (_AssetRes == null) { return; } if (_AssetRes != null && _AssetRes.GetComponent <NavMeshAgent>() != null) { _AssetRes.GetComponent <NavMeshAgent>().enabled = false; } m_Card3Dmodel = Instantiate(_AssetRes, m_Point.position, m_Point.rotation) as GameObject; float _zoom = m_Artresourcedata.getArtresources_zoom(); m_Card3Dmodel.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); m_Card3Dmodel.transform.parent = m_Point; //设置3D模型摩擦力 m_Card3Dmodel.rigidbody.angularDrag = 2.8f; m_Card3Dmodel.rigidbody.mass = 1.5f; Animation anim = m_Card3Dmodel.GetComponent <Animation>(); if (anim == null) { return; } m_Card3Dmodel.GetComponent <Animation>().Play("Nidle1"); m_Card3Dmodel.GetComponent <Animation>().wrapMode = WrapMode.Loop; }
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(); // } //} }
// ==================================== 私有接口 ===================================== /// <summary> /// 传入英雄ID加载英雄资源 【Lyq】 /// </summary> /// <param name="heroID">英雄ID</param> private void IndexHeroAsset(int heroID) { HeroTemplate _hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroID); ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_hero.getArtresources()); ArtresourceTemplate[] _SkinArtresourcedata = new ArtresourceTemplate[_hero.getUseableArtresource().Length]; PushNeedDownBundle(_Artresourcedata.getArtresources() + _strRes); for (int i = 0; i < _hero.getUseableArtresource().Length; ++i) { _SkinArtresourcedata[i] = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_hero.getUseableArtresource()[i]); if (_SkinArtresourcedata[i].getArtresources() == null) { continue; } PushNeedDownBundle(_SkinArtresourcedata[i].getArtresources() + _strRes); } string[] ActArtresourceData = _Artresourcedata.getActionresource(); for (int i = 0; i < ActArtresourceData.Length; ++i) { PushNeedDownBundle(ActArtresourceData[i] + _strRes); } SkillTemplate normalskill = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(_hero.getNormalskill()); for (int i = 0; i < normalskill.getBallIsticEffID().Length; i++) { PushNeedDownBundle(normalskill.getBallIsticEffID()[i] + _strRes); } PushNeedDownBundle(normalskill.getUnderAttackEffID() + _strRes); SkillTemplate m_skill1 = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(_hero.getSkill1ID()); for (int i = 0; i < m_skill1.getBallIsticEffID().Length; i++) { PushNeedDownBundle(m_skill1.getBallIsticEffID()[i] + _strRes); } PushNeedDownBundle(m_skill1.getUnderAttackEffID() + _strRes); SkillTemplate m_skill2 = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(_hero.getSkill2ID()); for (int i = 0; i < m_skill2.getBallIsticEffID().Length; i++) { Debug.Log(m_skill2.getBallIsticEffID()[i]); PushNeedDownBundle(m_skill2.getBallIsticEffID()[i] + _strRes); } PushNeedDownBundle(m_skill2.getUnderAttackEffID() + _strRes); }
public void Show3DModel(ObjectCard _card) { ModelCear(); if (_Point == null) { //Vector3 _pos = gameObject.transform.parent.parent.Find("UI_Camera1").GetComponent<Camera>().ScreenToWorldPoint(_confirm.transform.localPosition); Vector3 _pos = new Vector3(5000, 0, 0); ModelViewRoom = Instantiate(Resources.Load("UI/Prefabs/UI_Home/MainHome/ModelViewRoom"), _pos, Quaternion.identity) as GameObject; ModelViewRoom.name = "ModelViewRoom"; _Point = ModelViewRoom.transform.FindChild("posPopUp"); _Point.localPosition = new Vector3(_Point.localPosition.x + 0.2f, _Point.localPosition.y, _Point.localPosition.z); } SetCameraActive(true); //通过英雄数据表中的资源数据表ID得到资源表数据 ArtresourceTemplate _Artresourcedata = new ArtresourceTemplate(); _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_card.GetHeroData().GetHeroViewID()); //通过资源表获取到角色默认美术资源(名称) 通过该名称获取到动态加载数据返回一个对象 GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(_Artresourcedata.getArtresources()); //Debug.Log(_Artresourcedata.getArtresources()); //实例化该对象 if (_AssetRes != null) { Card3Dmodel = Instantiate(_AssetRes, _Point.position, _Point.rotation) as GameObject; float _zoom = _Artresourcedata.getArtresources_zoom(); Card3Dmodel.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); Card3Dmodel.transform.parent = _Point; //设置3D模型摩擦力 Card3Dmodel.rigidbody.angularDrag = 1; Card3Dmodel.rigidbody.mass = 1; //_obj.transform.localScale = new Vector3(1.3f,1.3f,1.3f); Animation anim = Card3Dmodel.GetComponent <Animation>(); if (anim == null) { return; } Card3Dmodel.GetComponent <Animation>().Play("Nidle1"); Card3Dmodel.GetComponent <Animation>().wrapMode = WrapMode.Loop; } }
/// <summary> /// 创建队友 /// </summary> /// 如果释放目标为敌人就不创建该对象 private void CreateTeamMate() { SkillTemplate _skill = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(m_Card.GetHeroData().SpellDataList[0].SpellID); if (_skill.getTarget() == 2) { return; } ObjectCard _teamMateCard = ObjectSelf.GetInstance().HeroContainerBag.GetHeroList()[0]; HeroTemplate _heroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_teamMateCard.GetHeroData().TableID); //ObjectCard _teamMateCard = new ObjectCard(); //Hero hero = new Hero(); //hero.heroid = ObjectSelf.GetInstance().HeroContainerBag.GetHeroList()[0].GetHeroData().TableID; //_teamMateCard.GetHeroData().Init(hero); ArtresourceTemplate _artResData = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_heroData.getArtresources()); GameObject _heroObject = AssetLoader.Inst.GetAssetRes(_artResData.getArtresources()); if (_heroObject != null) { GameObject _obj = Instantiate(_heroObject, m_TeamMatePos.position, m_TeamMatePos.rotation) as GameObject; _obj.transform.localScale = new Vector3(2, 2, 2); SceneObjectManager.GetInstance().SceneObjectAddHero(_obj, _heroData.getId(), _teamMateCard); Animation _anim = _obj.GetComponent <Animation>(); if (_anim == null) { return; } if (_obj.GetComponent <Animation>()["Idle1"] != null) { _obj.GetComponent <Animation>().CrossFade("Idle1"); } else if (_obj.GetComponent <Animation>()["Nidle1"] != null) { _obj.GetComponent <Animation>().CrossFade("Nidle1"); } _obj.GetComponent <Animation>().wrapMode = WrapMode.Loop; } }
/// <summary> /// 设置显示队伍 /// </summary> /// <param name="teamPos"></param> private void SetShowTram(Transform teamPos) { ClearTramModel(); for (int i = 0; i < teamPos.childCount; i++) { OtherHeroInfo _info = null; bool isNull = m_HeroAttribute.TryGetValue((i + 1), out _info); if (isNull == false) { continue; } int _artResId = _info.m_HeroViewId; ArtresourceTemplate _artRes = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_artResId); GameObject _assetRes = AssetLoader.Inst.GetAssetRes(_artRes.getArtresources()); GameObject _go = Instantiate(_assetRes, teamPos.GetChild(i).position, teamPos.GetChild(i).rotation) as GameObject; if (_go != null) { float _zoom = _artRes.getArtresources_zoom(); _go.transform.localScale = new Vector3(_zoom, _zoom, _zoom); Animation _anim = _go.GetComponent <Animation>(); if (_anim != null) { 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; } } m_GoList.Add(_go); } }
/// <summary> /// 创建模型 /// </summary> private void CreateModel() { for (int i = 0; i < m_HeroAdvances.Count; i++) { int _heroID = m_HeroAdvances[i].getArtresources(); ArtresourceTemplate _res = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_heroID); if (_res == null) { continue; } GameObject _resModel = AssetLoader.Inst.GetAssetRes(_res.getArtresources()); if (_resModel != null) { if (_resModel.GetComponent <NavMeshAgent>() != null) { _resModel.GetComponent <NavMeshAgent>().enabled = false; } GameObject _go = Instantiate(_resModel, m_Group.GetChild(i).position, m_Group.GetChild(i).rotation) as GameObject; float _zoom = _res.getArtresources_zoom(); _go.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); _go.transform.parent = m_Group.GetChild(i); Animation _anim = _go.GetComponent <Animation>(); if (_anim != null) { 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); }
//刷新2D显示人物 public void Init2DHeros() { //int type = ObjectSelf.GetInstance().Teams.GetFormationType(); //if (type == 1) //{ TeamViewRoomTeam1.SetActive(true); TeamViewRoomTeam2.SetActive(false); CurrentViewRoomTeam = TeamViewRoomTeam1.transform; //} //else //{ // TeamViewRoomTeam1.SetActive(false); // TeamViewRoomTeam2.SetActive(true); // CurrentViewRoomTeam = TeamViewRoomTeam2.transform; //} int GroupCount = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); int HeroCount = ObjectSelf.GetInstance().Teams.m_Matrix.GetLength(1); for (int i = 0; i < HeroCount; ++i) { X_GUID pMemberGuiD = ObjectSelf.GetInstance().Teams.m_Matrix[GroupCount, i]; GameObject _obj = null; if (pMemberGuiD.IsValid()) { ObjectCard temp = ObjectSelf.GetInstance().HeroContainerBag.FindHero(ObjectSelf.GetInstance().Teams.m_Matrix[GroupCount, i]); if (temp == null) { continue; } HeroTemplate _HeroData = temp.GetHeroRow(); ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(temp.GetHeroData().GetHeroViewID()); GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(_Artresourcedata.getArtresources()); if (_AssetRes != null) { if (_AssetRes.GetComponent <NavMeshAgent>() != null) { _AssetRes.GetComponent <NavMeshAgent>().enabled = false; } _obj = Instantiate(_AssetRes, CurrentViewRoomTeam.GetChild(i).position, CurrentViewRoomTeam.GetChild(i).rotation) as GameObject; float _zoom = _Artresourcedata.getArtresources_zoom(); _obj.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); } } // else // { // //GameObject _DefRes = AssetLoader.Inst.GetAssetRes("ElementBody02"); // GameObject _DefRes = Resources.Load(common.EleBody + "ElementBody02") as GameObject; // if (_DefRes != null) // _obj = Instantiate(_DefRes, CurrentViewRoomTeam.GetChild(i).position, CurrentViewRoomTeam.GetChild(i).rotation) as GameObject; // } if (_obj != null) { HeroObjs2D.Add(_obj); Animation anim = _obj.GetComponent <Animation>(); if (anim != null) { if (anim["Nidle1"] != null) { anim.CrossFade("Nidle1", 0.5f); } else if (anim["Idle1"] != null) { anim.CrossFade("Idle1", 0.5f); } anim.wrapMode = WrapMode.Loop; } } } }
//刷新3D显示英雄位置 private void Init3DHeros() { List <GameObject> PointList = new List <GameObject>(); //int type = ObjectSelf.GetInstance().Teams.GetFormationType(); //if (type == 1) //{ for (int i = 0; i < Herogroup1.transform.childCount; ++i) { PointList.Add(Herogroup1.transform.GetChild(i).gameObject); } //} //if (type == 2) //{ // for (int i = 0; i < Herogroup2.transform.childCount; ++i) // { // PointList.Add(Herogroup2.transform.GetChild(i).gameObject); // } //} int GroupCount = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); int HeroCount = ObjectSelf.GetInstance().Teams.m_Matrix.GetLength(1); for (int i = 0; i < HeroCount; ++i) { ObjectCard temp = ObjectSelf.GetInstance().HeroContainerBag.FindHero(ObjectSelf.GetInstance().Teams.m_Matrix[GroupCount, i]); if (temp == null) { continue; } ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(temp.GetHeroData().GetHeroViewID()); GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(_Artresourcedata.getArtresources()); if (_AssetRes != null) { if (_AssetRes.GetComponent <NavMeshAgent>() != null) { _AssetRes.GetComponent <NavMeshAgent>().enabled = false; } int nGroup = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); X_GUID pMemberGuiD = ObjectSelf.GetInstance().Teams.m_Matrix[nGroup, i]; GameObject _obj = Instantiate(_AssetRes, PointList[i].transform.position, PointList[i].transform.rotation) as GameObject; float _zoom = _Artresourcedata.getArtresources_zoom(); _obj.transform.localScale = new UnityEngine.Vector3(_zoom, _zoom, _zoom); HeroObjs3D.Add(_obj); Animation anim = _obj.GetComponent <Animation>(); if (anim != null) { if (anim["Nidle1"] != null) { anim.CrossFade("Nidle1"); } else if (anim["Idle1"] != null) { anim.CrossFade("Idle1"); } anim.wrapMode = WrapMode.Loop; } } } }