/// <summary> /// 合体阶段 /// </summary> /// <param name="curPlayerPlanes"/>合体玩家变化的飞机数据/param> /// <param name="curControl">合体玩家控制器</param> /// <param name="newPlaneData">合体玩家新飞机数据</param> /// <param name="fitWithMove">执行合体动作时是否需要显示移动</param> private void OnFitState(Dictionary <int, PludoPlaneData> curPlayerPlanes, PludoControl curControl, PludoPlaneData newPlaneData, bool fitWithMove = true) { var beFitPlaneId = ConstantData.IntDefValue; foreach (var planePair in curPlayerPlanes) { var checkPlaneData = planePair.Value; if (checkPlaneData.CheckPlaneState(EnumPlaneStatus.BeFit) && checkPlaneData.DataId != newPlaneData.DataId) { beFitPlaneId = planePair.Key; } } if (beFitPlaneId == ConstantData.IntDefValue) { Debug.LogError("未找到被合体飞机数据,请检查"); return; } curControl.OnPlaneFit(newPlaneData, beFitPlaneId, fitWithMove); }
protected override void FreshUserInfo() { base.FreshUserInfo(); CurInfo = GetData <PludoPlayerInfo>(); if (CurInfo != null) { Control = ControlCenter.RelatePlayer(CurInfo.PlayerColor); Control.name = CurInfo.PlayerColor.ToString(); if (Control) { Control.UpdateView(CurInfo); } StarScore.TrySetComponentValue(string.Format(StarScoreFormat, CurInfo.StarNum)); if (PludoColorItem) { var colorData = new ColorItemData(CurInfo.PlayerColor); PludoColorItem.UpdateView(colorData); } ShowOpWithCd(); RoomOwnerFlag.TrySetComponentValue(CurInfo.IsOwner); AutoFlag.TrySetComponentValue(CurInfo.IsAuto); } }
public BeAttackInfo(PludoControl control, int id, int distance) { Control = control; PlaneId = id; Distance = distance; }
/// <summary> /// 攻击阶段 /// </summary> /// <param name="planeDataDic">变化飞机数据</param> /// <param name="attackControl">撞机飞机控制类</param> /// <param name="newPlaneData">主动撞机飞机变化数据</param> private void OnCollideState(Dictionary <int, Dictionary <int, PludoPlaneData> > planeDataDic, PludoControl attackControl, PludoPlaneData newPlaneData) { attackControl.OnPlaneMove(newPlaneData, delegate { CollidePlanes(planeDataDic); }); }
/// <summary> /// 攻击 /// </summary> /// <param name="planeDataDic"></param> /// <param name="attackControl"></param> /// <param name="newPlaneData"></param> /// <param name="moveFinishCall"></param> /// <returns></returns> IEnumerator OnAttack(Dictionary <int, Dictionary <int, PludoPlaneData> > planeDataDic, PludoControl attackControl, PludoPlaneData newPlaneData, AsyncCallback moveFinishCall) { var attackPlanId = newPlaneData.DataId; var beAttackInfos = new List <BeAttackInfo>(); foreach (var planesItem in planeDataDic) { var beAttackList = new List <int>(); var key = planesItem.Key; var planesDic = planesItem.Value; var control = ControlList.Find(item => item.Seat == key); beAttackList.AddRange(from planeDicItem in planesDic select planeDicItem.Value into planeData where planeData.CheckPlaneState(EnumPlaneStatus.BeAttack) select planeData.DataId); foreach (var beAttackId in beAttackList) { var mapPos = control.PlanesDic[beAttackId].PlaneData.LocalPosition; var distance = attackControl.GetDistance(attackPlanId, mapPos); var info = new BeAttackInfo(control, beAttackId, distance); beAttackInfos.Add(info); } } Comparison <BeAttackInfo> compare = (x, y) => { return(x.Distance.CompareTo(y.Distance)); }; beAttackInfos.Sort(compare); foreach (var beAttackInfo in beAttackInfos) { YxDebug.LogError(string.Format("ID:{0};Distance:{1}", beAttackInfo.PlaneId, beAttackInfo.Distance)); yield return(new WaitForSeconds(attackControl.OnPlaneAttack(attackPlanId, beAttackInfo.Control.OnPlaneBeAttack(beAttackInfo.PlaneId)))); Facade.Instance <MusicManager>().Play(ConstantData.KeyPlaneBoom); } attackControl.WaitBoomAndMove(newPlaneData, moveFinishCall); }
/// <summary> /// 攻击阶段 /// </summary> /// <param name="planeDataDic">变化飞机数据</param> /// <param name="attackControl">攻击控制类</param> /// <param name="newPlaneData">攻击飞机变化数据</param> /// <param name="moveFinishCall">攻击完成回调</param> private void OnAttackState(Dictionary <int, Dictionary <int, PludoPlaneData> > planeDataDic, PludoControl attackControl, PludoPlaneData newPlaneData, AsyncCallback moveFinishCall = null ) { if (_attckCor != null) { StopCoroutine(_attckCor); } _attckCor = StartCoroutine(OnAttack(planeDataDic, attackControl, newPlaneData, moveFinishCall)); }