public void Init(int charId, BattleEnum.Enum_CharSide side, int index = -1) { m_Go = gameObject; m_ParentTrans = transform.parent; m_ParentGo = m_ParentTrans.gameObject; m_iIndex = index; _animCb = m_ParentTrans.GetComponent <CharAnimCb>(); m_CharBody = m_ParentTrans.GetComponent <CharBody>(); m_CharData = m_Go.AddComponent <CharData>(); m_CharState = m_Go.AddComponent <CharState>(); m_CharMove = m_Go.AddComponent <CharMove>(); m_CharAnim = m_Go.AddComponent <CharAnim>(); m_CharTick = m_Go.AddComponent <CharTick>(); m_CharEffect = m_Go.AddComponent <CharEffect>(); m_CharSlide = m_Go.AddComponent <CharSlide>(); m_CharSkill = m_Go.AddComponent <CharSkill>(); m_CharDefence = new CharDefence(this); _animCb.SetCharHandler(this); m_CharData.Init(charId, side, index); m_CharState.SetCharHandler(this); m_CharMove.SetCharHandler(this); m_CharAnim.SetCharHandler(this); m_CharTick.SetCharHandler(this); m_CharEffect.SetCharHandler(this); m_CharSlide.SetCharHandler(this); m_CharSkill.SetCharHandler(this); m_CharState.enabled = false; SetHeadUI(); }
//最近 public CharHandler GetNearestChar(CharHandler charHandler, BattleEnum.Enum_CharSide side, ref float dis) { List <CharHandler> lst = BattleEnum.Enum_CharSide.Mine == side ? m_listGeneralMine : m_listGeneralEnemy; Vector3 pos = charHandler.m_ParentTrans.position; CharHandler ret = null; for (int i = 0; i < lst.Count; ++i) { CharHandler tmpChar = lst[i]; if (tmpChar == charHandler || tmpChar.IsInexistence()) { continue; } float temp = Vector3.Distance(tmpChar.m_ParentTrans.position, pos); if (temp < dis) { dis = temp; ret = tmpChar; } } if (BattleEnum.Enum_CharSide.Mine != side) { CharHandler ch = GetNearestMonster(charHandler, ref dis); if (null != ch) { ret = ch; } } return(ret); }
//获取某方的 所有对象 public void GetAllChar(BattleEnum.Enum_CharSide side, List <List <CharHandler> > lst) { GetAllHero(side, lst); if (BattleEnum.Enum_CharSide.Enemy == side) { GetAllMonster(lst); } }
private void CreateCharOfficial(BattleEnum.Enum_CharSide side, int charId, int charIndex) { CharHandler h = BattleScenePool.GetInst().LoadHero(side, charId, charIndex); h.m_CharData.SetCharType(BattleEnum.Enum_CharType.Official); SetObstacleAvoidance(h); h.m_CharSkill.InitTriggerSkill(); SetRingLight(h); BattleManager.GetInst().m_CharInScene.AddChar(h); }
protected CharHandler GetConcentrate(CharHandler charHandler, SkillEnum.AimSide aimSide) { CharHandler ConcentrateChar = null; BattleEnum.Enum_CharSide oppSide = charHandler.m_CharData.GetOppositeSide(); if (SkillEnum.AimSide.Aim == aimSide) { ConcentrateChar = BattleManager.GetInst().m_CharInScene.GetConcentrate(oppSide); } return(ConcentrateChar); }
public static CharHandler CreateMonster(BattleEnum.Enum_CharSide side, int charId, int charIndex, Vector3 pos, Quaternion rot, int index) { CharHandler h = BattleScenePool.GetInst().PopMonsterHandler(charId); SetMonsterData(h); SetObstacleAvoidanceMonster(h); SetRadius(h); h.ToBorn(0.3f * (index + 1)); ResetPosition(h, pos, rot); BattleManager.GetInst().m_CharInScene.AddChar(h); return(h); }
public BuffBool Concentrate = new BuffBool(); //集火 public void Init(int charId, BattleEnum.Enum_CharSide side, int iIndex) { m_iCharID = charId; m_eSide = side; m_eState = BattleEnum.Enum_CharState.Idle; SkillIDs = new int[5]; if (iIndex != -1) { HeroInfo heroInfo = BattleManager.GetInst().GetHeroInfo(side, charId); SetCharData(heroInfo); } }
//获取某方的 在场英雄 public void GetPresence(BattleEnum.Enum_CharSide side, List <List <CharHandler> > lst) { if (BattleEnum.Enum_CharSide.Mine == side) { lst.Add(m_listGeneralMine); lst.Add(m_listOfficialPresenceMine); } else { lst.Add(m_listGeneralEnemy); lst.Add(m_listOfficialPresenceEnemy); } }
public CharHandler LoadHero(BattleEnum.Enum_CharSide side, int heroId, int heroIndex) { GameObject charGo = ResourceLoader.LoadAssetAndInstantiate(string.Format("Character/Hero{0}_Stand", heroId.ToString()), _transform, PositionMgr.vecHidePos); GameObject handlerGo = new GameObject("Handler"); //把其他代码和CharAnimCallback分开放 handlerGo.transform.SetParent(charGo.transform); handlerGo.transform.localPosition = Vector3.zero; CharHandler charHandler = handlerGo.AddComponent <CharHandler>(); charHandler.Init(heroId, side, heroIndex); //PreloadBulletHero(charHandler); return(charHandler); }
//获取某方的集火目标 public CharHandler GetConcentrate(BattleEnum.Enum_CharSide side) { List <CharHandler> lst = BattleEnum.Enum_CharSide.Mine == side ? m_listGeneralMine : m_listGeneralEnemy; for (int i = 0; i < lst.Count; ++i) { if (lst[i].m_CharData.Concentrate.Value) { return(lst[i]); } } return(null); }
protected override List <CharHandler> GetTargets(CharHandler charHandler, SkillDataSon skillDataSon = null, int index = -1) { _lstTargets.Clear(); _lstTargetLists.Clear(); BattleEnum.Enum_CharSide side = charHandler.m_CharData.GetOppositeSide(); BattleManager.GetInst().m_CharInScene.GetAllChar(side, _lstTargetLists); for (int i = 0; i < _lstTargetLists.Count; ++i) { GetCharInSector(charHandler, charHandler.m_CharData.m_fAtkRadian, charHandler.m_CharData.m_fAtkRange + 2f, _lstTargetLists[i], _lstTargets); } return(_lstTargets); }
private List <List <CharHandler> > GetTargetsByAimSideType(CharHandler charHandler, SkillDataSon skillDataSon) { _lstTargetLists.Clear(); BattleEnum.Enum_CharSide side = SkillEnum.AimSide.Self == skillDataSon.m_eAimSide ? charHandler.m_CharData.m_eSide : charHandler.m_CharData.GetOppositeSide(); switch (skillDataSon.m_eAimSideType) { case SkillEnum.AimSideType.All: BattleManager.GetInst().m_CharInScene.GetAllChar(side, _lstTargetLists); break; case SkillEnum.AimSideType.General: BattleManager.GetInst().m_CharInScene.GetGeneral(side, _lstTargetLists); break; case SkillEnum.AimSideType.Official: BattleManager.GetInst().m_CharInScene.GetOfficial(side, _lstTargetLists); break; case SkillEnum.AimSideType.Hero: BattleManager.GetInst().m_CharInScene.GetAllHero(side, _lstTargetLists); break; case SkillEnum.AimSideType.Dead: BattleManager.GetInst().m_CharInScene.GetDeadGeneral(side, _lstTargetLists); break; case SkillEnum.AimSideType.Monster: BattleManager.GetInst().m_CharInScene.GetAllMonster(_lstTargetLists); break; case SkillEnum.AimSideType.Presence: BattleManager.GetInst().m_CharInScene.GetPresence(side, _lstTargetLists); break; case SkillEnum.AimSideType.Self: _lstTargetLists.Add(new List <CharHandler>() { charHandler }); break; default: break; } return(_lstTargetLists); }
public static CharHandler CreateBoss(BattleEnum.Enum_CharSide side, int charId, int charIndex, Vector3 pos, Quaternion rot) { CharHandler h = BattleScenePool.GetInst().LoadHero(side, charId, charIndex); Rigidbody rb = h.m_Go.AddComponent <Rigidbody>(); BoxCollider cl = h.m_Go.AddComponent <BoxCollider>(); rb.useGravity = false; cl.isTrigger = true; h.m_CharData.SetCharType(BattleEnum.Enum_CharType.General); SetObstacleAvoidanceBoss(h); SetRadius(h); h.m_CharSkill.InitTriggerSkill(); SetApplyRootMotionBoss(h); SetRingLightBoss(h); ResetPosition(h, pos, rot); BattleManager.GetInst().m_CharInScene.AddChar(h); return(h); }
public void EnableCharacters(BattleEnum.Enum_CharSide side) { bool bMine = BattleEnum.Enum_CharSide.Mine == side; List <CharHandler> lst = bMine ? BattleManager.GetInst().m_CharInScene.m_listGeneralMine : BattleManager.GetInst().m_CharInScene.m_listGeneralEnemy; if (lst.Count <= 0) { return; } for (int i = 0; i < lst.Count; ++i) { lst[i].EnableChar(); } if (!bMine) { BattleManager.GetInst().FinalEnemyBorned(lst); } }
public CharHandler GetCharByID(BattleEnum.Enum_CharSide side, int charId) { List <CharHandler> lst = BattleEnum.Enum_CharSide.Mine == side ? m_listGeneralMine : m_listGeneralEnemy; for (int i = 0; i < lst.Count; ++i) { if (lst[i].m_CharData.m_iCharID == charId) { return(lst[i]); } } lst = BattleEnum.Enum_CharSide.Mine == side ? m_listOfficialMine : m_listOfficialEnemy; for (int i = 0; i < lst.Count; ++i) { if (lst[i].m_CharData.m_iCharID == charId) { return(lst[i]); } } return(null); }
public virtual CharHandler CreateChar(BattleEnum.Enum_CharSide side, int charId, int charIndex) { return(null); }
public HeroInfo GetHeroInfo(BattleEnum.Enum_CharSide side, int charId) { return(side == BattleEnum.Enum_CharSide.Mine ? GetHeroInfoMine(charId) : GetHeroInfoEnemy(charId)); }
public CharHandler GetCharHandler(BattleEnum.Enum_CharSide side, int charId) { return(BattleEnum.Enum_CharSide.Mine == side ? _dicCharMinePool[charId] : _dicCharEnemyPool[charId]); }
public int GetHeroCount(BattleEnum.Enum_CharSide side) { return(BattleEnum.Enum_CharSide.Mine == side ? m_listGeneralMine.Count + m_listOfficialMine.Count : m_listGeneralEnemy.Count + m_listOfficialEnemy.Count); }
//获取某方的文官 public void GetOfficial(BattleEnum.Enum_CharSide side, List <List <CharHandler> > lst) { lst.Add(BattleEnum.Enum_CharSide.Mine == side ? m_listOfficialMine : m_listOfficialEnemy); }
//获取某方的文官 public List <CharHandler> GetOfficial(BattleEnum.Enum_CharSide side) { return(BattleEnum.Enum_CharSide.Mine == side ? m_listOfficialMine : m_listOfficialEnemy); }
//获取某方的阵亡武官 public void GetDeadGeneral(BattleEnum.Enum_CharSide side, List <List <CharHandler> > lst) { lst.Add(BattleEnum.Enum_CharSide.Mine == side ? m_listDeadMine : m_listDeadEnemy); }
public List <ConnectLine> GetConnectList(BattleEnum.Enum_CharSide side) { return(BattleEnum.Enum_CharSide.Mine == side ? _lstConnectMine : _lstConnectEnemy); }