예제 #1
0
        /// <summary>
        /// 飞机被攻击(包括撞机)
        /// </summary>
        /// <param name="planeId">飞机Id</param>
        /// <param name="widthLock"></param>
        /// <returns>被攻击飞机位置</returns>
        public Vector3 OnPlaneBeAttack(int planeId, bool widthLock = true)
        {
            var beAttackPlane = GetPlaneById(planeId);

            if (widthLock)
            {
                beAttackPlane.OnPlaneBeLock();
            }
            var planeCount    = beAttackPlane.PlaneList.Count;
            var planeList     = beAttackPlane.PlaneList.ToList();
            var planeMoveList = new List <MoveAndRotateData>();

            for (int i = 0; i < planeCount; i++)
            {
                var plane = planeList[i];
                plane.PlaneData.PlaneStateChange((int)EnumPlaneStatus.Home);
                GetMapPosByPlaneData(plane.PlaneData, false);
                MoveAndRotateData moveRotaData = new MoveAndRotateData();
                moveRotaData.MovePath = new List <Vector3>();
                moveRotaData.MovePath.Add(plane.PlaneData.CurPos);
                moveRotaData.FinishRotate = plane.PlaneData.DefTargetPos;
                planeMoveList.Add(moveRotaData);
            }
            if (widthLock)
            {
                YxDebug.LogError((ItemColor)CurColor + "被攻击飞机数量是:" + planeMoveList.Count);
            }
            else
            {
                YxDebug.LogError((ItemColor)CurColor + "被撞击飞机数量是:" + planeMoveList.Count);
            }
            beAttackPlane.OnPlaneBeAttack(planeMoveList, widthLock);
            return(beAttackPlane.LocalPosition);
        }
예제 #2
0
 /// <summary>
 /// 飞机移动+结束旋转
 /// </summary>
 public void PlaneMovePathWithRotate(MoveAndRotateData data, bool hideFireOnFinish = true, AsyncCallback rotateFinishCall = null)
 {
     PlaneMovePath(data.MovePath, hideFireOnFinish, delegate
     {
         TweenRotate(data.FinishRotate, BulletMoveTime / 2, delegate
         {
             PlaneInFlyState(false);
             if (rotateFinishCall != null)
             {
                 rotateFinishCall(null);
             }
         });
     });
 }
예제 #3
0
        /// <summary>
        /// 飞机准备
        /// </summary>
        /// <param name="newPlaneData"></param>
        public void OnPlaneReady(PludoPlaneData newPlaneData)
        {
            var readyPlane = GetPlaneById(newPlaneData.DataId);
            var moveList   = new List <Vector3>();

            newPlaneData.PlaneStateChange((int)EnumPlaneStatus.Ready);
            GetMapPosByPlaneData(newPlaneData, false);
            moveList.Add(newPlaneData.CurPos);
            ConstantData.PlaySoundBySex(_curPlayerInfo.SexI, ConstantData.KeyStarFly);
            MoveAndRotateData moveRoateData = new MoveAndRotateData()
            {
                MovePath     = moveList.ToList(),
                FinishRotate = newPlaneData.DefTargetPos
            };

            readyPlane.PlaneMovePathWithRotate(moveRoateData, true, delegate
            {
                readyPlane.PlaneListReset();
                readyPlane.PlaneData.PlaneStateChange((int)EnumPlaneStatus.Ready);
            });
        }