/// <summary> /// 通过cid获取单位 /// </summary> public CAIController GetUnit(int cid) { CAIController value = null; bool b = m_pawnEntityList.TryGetValue(cid, out value); return(value); }
protected override void OnDestroy() { base.OnDestroy(); m_brainComp = null; BlackBorad = null; InterestingTarget = null; m_perceptionComp = null; }
/// <summary> /// 获取我敌对的团队 /// </summary> public List <CAIController> GetEnemyList(CAIController actor) { if (actor.Pawn.Team == CPawnEntity.TeamSide.Blue) { return(m_redGroup); } return(m_blueGroup); }
/// <summary> /// 选择一个角色为当前操作的角色 /// </summary> /// <param name="ctrl"></param> public void SelectPawnCtrl(CPlayerController ctrl) { if (ctrl == null) { return; } ctrl.IgnoreInput = false; ctrl.InterestingTarget = null; m_selectedPawnCtrl = ctrl; }
/// <summary> /// 添加单位到场景 /// </summary> /// <param name="unit"></param> public void AddUnit(CAIController unit) { m_pawnEntityList.Add(unit.Pawn.CId, unit); if (unit.Pawn.Team == CPawnEntity.TeamSide.Red) { m_redGroup.Add(unit); } else if (unit.Pawn.Team == CPawnEntity.TeamSide.Blue) { m_blueGroup.Add(unit); } }
/// <summary> /// 清理游戏 /// </summary> public virtual void OnDestroy() { m_enabled = false; m_selectedPawnCtrl = null; }