示例#1
0
    public static void ReBuildShip()
    {
        U3DUtil.DestroyAllChild(m_MapStart.gameObject);
        Int2 roomGrid = new Int2();

        switch (m_SceneState)
        {
        case TreasureState.None:
        case TreasureState.CanvasEdit: {
            ShipPlan plan = ShipPlanDC.GetCurShipPlan();
            if (plan != null)
            {
                roomGrid = plan.Canvans.GetMapSize();
                BattleEnvironmentM.ResetStartPos(plan.Canvans.GetMapSize(), true);
            }

            GenerateShip.GenerateShips(m_MapStart);

            break;
        }
        }
        Vector3 pos = MainCameraM.GetMainCameraPos(roomGrid);

        MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidBoatView);
        MainCameraM.s_Instance.AutoMoveTo(pos, 0f);
    }
示例#2
0
 /// <summary>
 /// 显示传送点
 /// </summary>
 /// <param name="grid"></param>
 public void ShowTranGate(Int2 grid)
 {
     if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit)
     {
         Vector3 vEndEff = Vector3.zero;
         if (RoomMap.CheckHaveMap() == true)
         {
             vEndEff = RoomMap.GetRoomGridLocalPos(grid);
         }
         else
         {
             vEndEff = GenerateShip.GetbuildPos(grid);
         }
         vEndEff = U3DUtil.AddX(vEndEff, 1.0f);
         if (go1903041)
         {
             go1903041.SetActive(true);
             go1903041.transform.localPosition = vEndEff;
             if (go1903041.GetComponent <NdHide>() != null)
             {
                 go1903041.GetComponent <NdHide>().ResetDuration(3f);
             }
         }
     }
 }
示例#3
0
 void GoToEdit()
 {
     MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidEditView);
     MainCameraM.s_Instance.AutoMoveTo(MainCameraM.s_vEditViewBoatviewCamPos, 0.3f);
     //U3DUtil.DestroyAllChild(BattleEnvironmentM.GetLifeMBornNode(true).gameObject);
     GenerateShip.ResetBuildingToCanvas(0.35f, gameObject, "DoFinish");
 }
示例#4
0
    /// <summary>
    /// 切换两种飞行动作
    /// </summary>
    public int CalculateHiteEdge()
    {
        int     pointInIndex = -1;
        int     index        = -1;
        Vector3 returnPos    = Vector3.zero;
        int     lastIndex    = m_lFlyData.Count - 1;

        for (int i = 0; i < m_lFlyData.Count - 1; i++)
        {
            if (GenerateShip.pointInRejectPolygon(m_lFlyData[i].Pos, GenerateShip.GetRejectPolygon()) && i != 0)
            {
                pointInIndex = i;
                break;
            }
        }

        if (pointInIndex != -1)
        {
            index = GenerateShip.RayToRejectPolygon(m_lFlyData[pointInIndex - 1].Pos, m_lFlyData[pointInIndex].Pos, ref returnPos, GenerateShip.GetRejectPolygon());
        }
        else
        {
            index = GenerateShip.RayToRejectPolygon(m_lFlyData[lastIndex - 1].Pos, m_lFlyData[lastIndex].Pos, ref returnPos, GenerateShip.GetRejectPolygon());
        }
        return(index);

        //NGUIUtil.DebugLog("hitIndex =" + index,"brown");
    }
示例#5
0
 /// <summary>
 /// 构建PVE战斗环境
 /// </summary>
 private static void BuildCombatPVEScene()
 {
     MainCameraM.s_Instance.ResetCameraDataByBattle();
     LoadCombatMap();
     LoadDefenseBulid();
     GenerateShip.GenerateShipsBattle(GetShipBodyMap(), GetLifeMBornNode(true));
     LoadDefenseSoldier();
 }
示例#6
0
    /// <summary>
    /// 生成甲板
    /// </summary>
    private void GenerateDeck()
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        P.DoDeckDataStart();
        GenerateShip.CreateMiddleBeam();
        P.DoDeckDataEnd();
    }
示例#7
0
    /// <summary>
    /// 生成甲板 排除拖动的房间
    /// </summary>
    private void GenerateDeckWithOutThis()
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        P.DoDeckDataStartWithOut(m_Core.Data);
        GenerateShip.CreateMiddleBeam();
        P.DoDeckDataEnd();
    }
示例#8
0
    public static void BuildViewStageScene()
    {
        CounterPartInfo    Info     = StageDC.GetCounterPartInfo();
        ShipCanvasInfo     Map      = StageM.GetCounterPartMap(Info.countershipcanvasid);
        List <SoldierInfo> lSoldier = new List <SoldierInfo>();
        List <BuildInfo>   lBuild   = new  List <BuildInfo>();

        StageM.GetCounterPartShipPut(Info.id, ref lSoldier, ref lBuild);
        CmCarbon.SetDefenseMap(Map);
        GenerateShip.GenerateShips(GetShipBodyMap(), GetLifeMBornNode(true), lBuild, lSoldier);
        MainCameraM.s_Instance.ResetCameraDataByBattle();
    }
示例#9
0
    void DoFinish()
    {
        //U3DUtil.DestroyAllChild(BattleEnvironmentM.GetLifeMBornNode(true).gameObject,false);
        RoomMap.CreateCanvansArea();
        ShipPlan Plan = ShipPlanDC.GetCurShipPlan();

        Plan.ReCalcShipBuildInfoXY(XYmode.Save2Edit);
        BattleEnvironmentM.SetBattleEnvironmentMode(BattleEnvironmentMode.Edit);
        BattleEnvironmentM.BuildScene();
        WndManager.DestoryDialog <ShipShowWnd>();
        WndManager.DestoryDialog <FangAnMenuWnd>();
        GenerateShip.CreateMiddleBeam();
        WndManager.GetDialog <ShipCanvasWnd>().ShowDialog();
        MainCameraM.s_Instance.EnableOthOn(true);
    }
示例#10
0
    /// <summary>
    /// 创建建筑
    /// </summary>
    void CreateBuilding(BuildInfo roomBuild)
    {
        // 创建地形
        if (roomBuild == null)
        {
            return;
        }

        GameObject dropHeroChild = new GameObject("dropHeroChild");

        dropHeroChild.transform.parent = MyHead.BtnClickTrap.transform;

        Vector2 size      = new Vector2(roomBuild.m_Shape.width, roomBuild.m_Shape.height);
        Vector3 pos       = new Vector3(-50f * size.x, -47.6f, -600f);
        Vector3 scaleSize = new Vector3(35f, 35f, 35f);

        if (size.y >= 2)
        {
            scaleSize = new Vector3(20f, 20f, 20f);
            pos       = new Vector3(-50f * size.x + 20f, -47.6f, -600f);
        }

        dropHeroChild.transform.localPosition = pos;
        dropHeroChild.transform.localScale    = scaleSize;

        Vector3 local = Vector3.zero;
        Vector3 world = dropHeroChild.transform.TransformPoint(local);

        roomBuild.m_cx = 0;
        roomBuild.m_cy = 0;
        m_buildlife    = LifeFactory.CreateBuilding(roomBuild, 0, dropHeroChild.transform, world, LifeEnvironment.View);
        if (m_buildlife != null)
        {
            m_buildlife.PlayViewAni();
            if (roomBuild.BuildType == 1605)
            {
                ParticleEffect effect = m_buildlife.m_thisT.gameObject.AddComponent <ParticleEffect>();
                effect.EnabelScale = true;
            }
        }
        // 创建房间外壳
        if (roomBuild.m_RoomType != RoomType.DeckTrap)   //非甲板房间需加壳
        {
            GenerateShip.GenerateShipBuildingShell(dropHeroChild.transform, roomBuild.GetBuildCanvasInfo());
        }

        GameObjectLoader.SetGameObjectLayer(dropHeroChild, gameObject.layer);
    }
示例#11
0
    /// <summary>
    /// 创建建筑
    /// </summary>
    void CreateBuilding(BuildInfo roomBuild)
    {
        // 创建地形
        if (roomBuild == null)
        {
            return;
        }
        GameObject dropHeroChild = new GameObject("dropHeroChild");

        dropHeroChild.transform.parent = MyHead.DropHero;
        Vector2 size      = new Vector2(roomBuild.m_Shape.width, roomBuild.m_Shape.height);
        Vector3 pos       = new Vector3(-50f * size.x, 40f, -600f);
        Vector3 scaleSize = new Vector3(35f, 35f, 35f);

        dropHeroChild.transform.localPosition = pos;
        dropHeroChild.transform.localScale    = scaleSize;

        Vector3 local = Vector3.zero;
        Vector3 world = dropHeroChild.transform.TransformPoint(local);

        roomBuild.m_cx = 0;
        roomBuild.m_cy = 0;
        Building buildlife = LifeFactory.CreateBuilding(roomBuild, 0, dropHeroChild.transform, world, LifeEnvironment.View);

        if (buildlife != null)
        {
            buildlife.PlayClickAni();
        }
        // 创建房间外壳
        if (roomBuild.m_RoomType != RoomType.DeckTrap)   //非甲板房间需加壳
        {
            GenerateShip.GenerateShipBuildingShellWithouClear(dropHeroChild.transform, roomBuild.GetBuildCanvasInfo());
        }
        m_Tropies = dropHeroChild;
        SetStarsLevel(roomBuild.StarLevel);
        GameObjectLoader.SetGameObjectLayer(dropHeroChild, gameObject.layer);

        NGUIUtil.SetActive(MyHead.Building, true);
        string[] s = roomBuild.m_Desc.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length > 1)
        {
            string text = string.Format("{0}{1}", NGUIUtil.GetStringByKey(88800039), s[0]);
            NGUIUtil.SetLableText(MyHead.LblBuildDesc, text);
            NGUIUtil.SetLableText(MyHead.LblBuildEffect, s[1]);
        }
    }
示例#12
0
    void SaveSuccecd()
    {
        TouchMoveManager.ShowCanvas(false);
        MainCameraM.s_Instance.ResetCameraDataByHaven();
        MainCameraM.s_Instance.EnableOthOn(false);
        MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidHavenView);
        MainCameraM.s_Instance.AutoMoveTo(MainCameraM.s_vHavenViewBoatviewCamPos, 0.3f);
        MainCameraM.s_Instance.EnableDrag(false);

        Life.Environment = LifeEnvironment.View;
        PutCanvasM.PutDownNewBuild();
        TouchMoveManager.DoTransgatePoint();
        m_IsSaving = true;

        if (MyHead.BtnReturn)
        {
            MyHead.BtnReturn.gameObject.SetActive(false);
        }
        if (MyHead.BtnNext)
        {
            MyHead.BtnNext.gameObject.SetActive(false);
        }
        CangKuWnd wnd = WndManager.FindDialog <CangKuWnd>();

        if (wnd)
        {
            wnd.gameObject.SetActive(false);
        }

        PutCanvasM.CanOperate = false;
        PutCanvasM.ShowRoomGridUI(false);
        TouchMoveManager.SetCurTouchMove(null);
        MainCameraM.s_Instance.EnableDrag(false);
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        P.CreateCanvans();
        GenerateShip.GenerateShipsWithAni();
    }
示例#13
0
    /// <summary>
    /// 手势开始
    /// </summary>
    /// <param name="gesture"></param>
    public void FingerStart(Vector3 posWorld)
    {
        if (s_bEnableFire == false)
        {
            return;
        }
        m_v3TouchPostions.Clear();
        if (CmCarbon.IsBorn(soldierDataID))
        {
            return;
        }
        SpawnFingerTrail(posWorld);
        PlayerSoldierFire.s_bCollectTouchPoint = true;
        MainCameraM.s_Instance.EnableDrag(false);

        if (GenerateShip.pointInRejectPolygon(posWorld, GenerateShip.GetRejectPolygon()))
        {
            PlayerSoldierFire.s_bCollectTouchPoint = false;
            MainCameraM.s_Instance.EnableDrag(true);
            return;
        }
        m_v3TouchPostions.Add(posWorld);
    }
示例#14
0
    private void Start()
    {
        /* Left Player */
        Ship[] l_LeftShips = new Ship[3];

        GameObject l_GO_TempShip = new GameObject("Ship");

        l_GO_TempShip.transform.SetPositionAndRotation
        (
            new Vector3(-5, 4, 0),
            Quaternion.Euler(0, 0, -90)
        );
        GenerateShip l_GenShip = l_GO_TempShip.AddComponent <GenerateShip>();

        l_GenShip.SetCodeGen("0001000001000000000000000000000000000000000000000000000000000011000000000000000000000001");
        l_LeftShips[0] = l_GenShip.GetShip();

        l_GO_TempShip = new GameObject("Ship");
        l_GO_TempShip.transform.SetPositionAndRotation
        (
            new Vector3(-5, 0, 0),
            Quaternion.Euler(0, 0, -90)
        );
        l_GenShip = l_GO_TempShip.AddComponent <GenerateShip>();
        l_GenShip.SetCodeGen("0001000001000000000000000000000000000000000000000000000000000011000000000000000000000001");
        l_LeftShips[1] = l_GenShip.GetShip();

        l_GO_TempShip = new GameObject("Ship");
        l_GO_TempShip.transform.SetPositionAndRotation
        (
            new Vector3(-5, -4, 0),
            Quaternion.Euler(0, 0, -90)
        );
        l_GenShip = l_GO_TempShip.AddComponent <GenerateShip>();
        l_GenShip.SetCodeGen("0001000001000000000000000000000000000000000000000000000000000011000000000000000000000001");
        l_LeftShips[2] = l_GenShip.GetShip();

        /* Right Player */
        Ship[] l_RightShips = new Ship[3];

        l_GO_TempShip = new GameObject("Ship");
        l_GO_TempShip.transform.SetPositionAndRotation
        (
            new Vector3(5, 4, 0),
            Quaternion.Euler(0, 0, 90)
        );
        l_GenShip = l_GO_TempShip.AddComponent <GenerateShip>();
        l_GenShip.SetCodeGen("0001000001000000000000000000000000000000000000000000000000000011000000000000000000000001");
        l_RightShips[0] = l_GenShip.GetShip();

        l_GO_TempShip = new GameObject("Ship");
        l_GO_TempShip.transform.SetPositionAndRotation
        (
            new Vector3(5, 0, 0),
            Quaternion.Euler(0, 0, 90)
        );
        l_GenShip = l_GO_TempShip.AddComponent <GenerateShip>();
        l_GenShip.SetCodeGen("0001000001000000000000000000000000000000000000000000000000000011000000000000000000000001");
        l_RightShips[1] = l_GenShip.GetShip();

        l_GO_TempShip = new GameObject("Ship");
        l_GO_TempShip.transform.SetPositionAndRotation
        (
            new Vector3(5, -4, 0),
            Quaternion.Euler(0, 0, 90)
        );
        l_GenShip = l_GO_TempShip.AddComponent <GenerateShip>();
        l_GenShip.SetCodeGen("0001000001000000000000000000000000000000000000000000000000000011000000000000000000000001");
        l_RightShips[2] = l_GenShip.GetShip();

        /*{
         *  new Ship()
         *  {
         *      m_Slots = new Slot[]
         *      {
         *          new Weapon(SlotType.laser, null, Orientation.middle, Orientation.middle),
         *          new Weapon(SlotType.energy, null, Orientation.right, Orientation.right),
         *          new Defense(SlotType.missile, null),
         *      }
         *  },
         *  new Ship()
         *  {
         *      m_Slots = new Slot[]
         *      {
         *          new Weapon(SlotType.energy, null, Orientation.middle, Orientation.left),
         *          new Weapon(SlotType.missile, null, Orientation.right, Orientation.middle),
         *          new Defense(SlotType.missile, null),
         *      }
         *  },
         *  new Ship()
         *  {
         *      m_Slots = new Slot[]
         *      {
         *          new Weapon(SlotType.laser, null, Orientation.middle, Orientation.middle),
         *          new Defense(SlotType.missile, null),
         *          new Defense(SlotType.laser, null),
         *      }
         *  },
         * };
         *
         * Ship[] l_RightShips = new Ship[]
         * {
         *  new Ship()
         *  {
         *      m_Slots = new Slot[]
         *      {
         *          new Weapon(SlotType.missile, null, Orientation.right, Orientation.middle),
         *          new Weapon(SlotType.missile, null, Orientation.middle, Orientation.left),
         *          new Defense(SlotType.energy, null),
         *      }
         *  },
         *  new Ship()
         *  {
         *      m_Slots = new Slot[]
         *      {
         *          new Weapon(SlotType.energy, null, Orientation.right, Orientation.middle),
         *          new Defense(SlotType.laser, null),
         *          new Defense(SlotType.energy, null),
         *      }
         *  },
         *  new Ship()
         *  {
         *      m_Slots = new Slot[]
         *      {
         *          new Weapon(SlotType.energy, null, Orientation.middle, Orientation.right),
         *          new Weapon(SlotType.laser, null, Orientation.right, Orientation.middle),
         *          new Weapon(SlotType.missile, null, Orientation.middle, Orientation.left),
         *      }
         *  },
         * };*/

        BattleManager.instance.InitBattle(l_LeftShips, l_RightShips);
    }
示例#15
0
    private static Life GetHitDeck(int fireai, ref Vector3 Firepos, ref LocationType t)
    {
        GenerateShip.CalcHitDeck();
        t = LocationType.Top;
        if (GenerateShip.LHitDeck.Count <= 0)
        {
            return(null);
        }
        if (fireai == 5)
        {
            Life    l          = null;
            MapGrid g          = CM.GoldBuild.GetMapGrid();
            Vector3 pos        = Vector3.zero;
            float   mindistant = int.MaxValue;
            Firepos = Vector3.zero;
            for (int i = 1; i < GenerateShip.LHitDeck.Count; i++)
            {
                if (GenerateShip.LHitDeck[i].m_type != LocationType.Top)
                {
                    pos = GetPos(GenerateShip.LHitDeck[i].m_layer, GenerateShip.LHitDeck[i].m_unit);
                    float distant = Vector3.Distance(g.pos, pos);
                    if (mindistant > distant)
                    {
                        mindistant = distant;
                        Firepos    = pos;
                        t          = GenerateShip.LHitDeck[i].m_type;
                        l          = GenerateShip.LHitDeck[i].m_target;
                    }
                }
            }
            for (int i = 0; i < GenerateShip.LHitBrokeDeck.Count; i++)
            {
                if (GenerateShip.LHitDeck[i].m_type != LocationType.Top)
                {
                    pos = GetPos(GenerateShip.LHitBrokeDeck[i].m_layer, GenerateShip.LHitBrokeDeck[i].m_unit);
                    float distant = Vector3.Distance(g.pos, pos);
                    if (mindistant > distant)
                    {
                        mindistant = distant;
                        Firepos    = pos;
                        t          = GenerateShip.LHitBrokeDeck[i].m_type;
                        l          = GenerateShip.LHitBrokeDeck[i].m_target;
                    }
                }
            }
            return(null);
        }
        if (fireai == 4)
        {
            Firepos = new Vector3(0, 0, 0);
            t       = LocationType.Left;
            return(null);

            /*
             * List<HitDeckInfo> lVertical = new List<HitDeckInfo>();
             * List<HitDeckInfo> ldeck = new List<HitDeckInfo>();
             *
             * foreach(HitDeckInfo k in GenerateShip.LHitBrokeDeck)
             * {
             *      if (k.m_type == LocationType.Left || k.m_type == LocationType.Right)
             *              lVertical.Add(k);
             *      else ldeck.Add(k);
             * }
             * if (lVertical.Count > 0)
             * {
             *      MapGrid g = CM.GoldBuild.GetMapGrid();
             *      Vector3 pos = GetPos(lVertical[0].m_layer,lVertical[0].m_unit);
             *      float mindistant = Vector3.Distance(g.pos,pos);
             *      Firepos = pos;
             *      t = lVertical[0].m_type;
             *      for(int i = 1; i < lVertical.Count; i++)
             *      {
             *              pos = GetPos(lVertical[i].m_layer,lVertical[i].m_unit);
             *              float distant =  Vector3.Distance(g.pos,pos);
             *              if (mindistant > distant)
             *              {
             *                      mindistant = distant;
             *                      Firepos = pos;
             *                      t = lVertical[i].m_type;
             *              }
             *      }
             *      return null;
             * }
             * else
             * {
             *      if (ldeck.Count > 0)
             *      {
             *              MapGrid g = CM.GoldBuild.GetMapGrid();
             *              Vector3 pos = GetPos(ldeck[0].m_layer,ldeck[0].m_unit);
             *              float mindistant = Vector3.Distance(g.pos,pos);
             *              Firepos = pos;
             *              t = ldeck[0].m_type;
             *              for(int i = 1; i < ldeck.Count; i++)
             *              {
             *                      pos = GetPos(ldeck[i].m_layer,ldeck[i].m_unit);
             *                      float distant =  Vector3.Distance(g.pos,pos);
             *                      if (mindistant > distant)
             *                      {
             *                              mindistant = distant;
             *                              Firepos = pos;
             *                              t = ldeck[i].m_type;
             *                      }
             *              }
             *              return null;
             *      }
             *      else
             *              fireai = 2;
             * }*/
        }
        if (fireai == 3)
        {
            List <Building> ltrap = new List <Building>();
            List <Life>     lb    = new List <Life>();
            List <Life>     ld    = new List <Life>();
            CM.SearchLifeMListInBoat(ref lb, LifeMType.BUILD, LifeMCamp.DEFENSE);
            foreach (Building b in lb)
            {
                BuildInfo info = CmCarbon.GetBuildInfo(b.m_Core.m_DataID);
                if (info.m_RoomType == RoomType.NormalTrap)
                {
                    for (int i = 1; i < GenerateShip.LHitDeck.Count; i++)
                    {
                        if (GenerateShip.LHitDeck[i].m_type == LocationType.Top && GenerateShip.LHitDeck[i].m_layer == (info.m_cy + 1) && GenerateShip.LHitDeck[i].m_unit == info.m_cx)
                        {
                            ltrap.Add(b);
                            ld.Add(GenerateShip.LHitDeck[i].m_target);
                        }
                    }
                }
            }
            if (ltrap.Count > 0)
            {
                Life l     = ld[0];
                int  minhp = ltrap[0].m_Attr.Hp;
                for (int i = 1; i < ltrap.Count; i++)
                {
                    if (minhp > ltrap[i].m_Attr.Hp)
                    {
                        minhp = ltrap[i].m_Attr.Hp;
                        l     = ltrap[i];
                    }
                }
                return(l);
            }
            else
            {
                fireai = 1;
            }
        }
        if (fireai == 2)
        {
            bool allsame = true;
            Life l       = GenerateShip.LHitDeck[0].m_target;
            t = GenerateShip.LHitDeck[0].m_type;
            int minhp = GenerateShip.LHitDeck[0].m_target.m_Attr.Hp;
            for (int i = 1; i < GenerateShip.LHitDeck.Count; i++)
            {
                if (minhp != GenerateShip.LHitDeck[i].m_target.m_Attr.Hp)
                {
                    allsame = false;
                }
                if (minhp > GenerateShip.LHitDeck[i].m_target.m_Attr.Hp)
                {
                    minhp = GenerateShip.LHitDeck[i].m_target.m_Attr.Hp;
                    l     = GenerateShip.LHitDeck[i].m_target;
                    t     = GenerateShip.LHitDeck[i].m_type;
                }
            }
            if (allsame)
            {
                fireai = 1;
            }
            else
            {
                return(l);
            }
        }
        if (fireai == 1)
        {
            while (true)
            {
                int i = Random.Range(0, GenerateShip.LHitDeck.Count);
                if (GenerateShip.LHitDeck[i].m_type == LocationType.Top)
                {
                    return(GenerateShip.LHitDeck[i].m_target);
                }
            }
        }
        return(null);
    }
示例#16
0
    /// <summary>
    /// 确认飞行轨迹有效。
    /// </summary>
    public static bool CheckFlyLine(ref List <Vector3> lFlyPoint)
    {
        if (lFlyPoint == null || lFlyPoint.Count < 0)
        {
            return(false);
        }
        //if( lFlyPoint.Count < 2) return false;
        //if (lFlyPoint.Count==2 && lFlyPoint[0] == lFlyPoint[1])
        //	return false;
        lFlyPoint = PathUtil.SmoothSimple(lFlyPoint);
        if (m_IsSmooth)
        {
            if (lFlyPoint == null)
            {
                return(false);
            }
            if (GenerateShip.pointInRejectPolygon(lFlyPoint [0], GenerateShip.GetOutRejectPolygon()))
            {
                Vector3 posRaySrc  = lFlyPoint [0];
                Vector3 posRayTo0  = lFlyPoint [0] + Vector3.left * 6f;
                Vector3 posReturn0 = new Vector3(posRayTo0.x, posRayTo0.y, posRayTo0.z);
                GenerateShip.RayToRejectPolygon(posRaySrc, posRayTo0, ref posReturn0, GenerateShip.GetOutRejectPolygon());

                Vector3 posRayTo1  = lFlyPoint [0] + Vector3.right * 6f;
                Vector3 posReturn1 = new Vector3(posRayTo1.x, posRayTo1.y, posRayTo1.z);
                GenerateShip.RayToRejectPolygon(posRaySrc, posRayTo1, ref posReturn1, GenerateShip.GetOutRejectPolygon());

                Vector3 posRayTo2  = lFlyPoint [0] + Vector3.up * 6f;
                Vector3 posReturn2 = new Vector3(posRayTo2.x, posRayTo2.y, posRayTo2.z);
                GenerateShip.RayToRejectPolygon(posRaySrc, posRayTo2, ref posReturn2, GenerateShip.GetOutRejectPolygon());

                float fDistance0 = Vector2.Distance(posRaySrc, posReturn0);
                float fDistance1 = Vector2.Distance(posRaySrc, posReturn1);
                float fDistance2 = Vector2.Distance(posRaySrc, posReturn2);
                lFlyPoint.Remove(posRaySrc);
                if (fDistance0 <= fDistance1)
                {
                    if (fDistance2 < fDistance0)
                    {
                        lFlyPoint.Insert(0, posReturn2);
                    }
                    else
                    {
                        lFlyPoint.Insert(0, posReturn0);
                    }
                }
                else
                {
                    if (fDistance2 < fDistance1)
                    {
                        lFlyPoint.Insert(0, posReturn2);
                    }
                    else
                    {
                        lFlyPoint.Insert(0, posReturn1);
                    }
                }
            }
            //把进入船的点去掉
            for (int i = 0; i < lFlyPoint.Count; i++)
            {
                if (GenerateShip.pointInRejectPolygon(lFlyPoint [i], GenerateShip.GetRejectPolygon()) && lFlyPoint.Count - i - 1 > 0)
                {
                    lFlyPoint.RemoveRange(i + 1, lFlyPoint.Count - i - 1);
                    break;
                }
            }
        }

        if (lFlyPoint.Count > 1)
        {
            if (GenerateShip.pointInRejectPolygon(lFlyPoint [0], GenerateShip.GetOutRejectPolygon()))
            {
                Vector3 posRaySrc  = lFlyPoint [0];
                Vector3 posRayTo0  = lFlyPoint [0] + Vector3.left * 6f;
                Vector3 posReturn0 = new Vector3(posRayTo0.x, posRayTo0.y, posRayTo0.z);
                GenerateShip.RayToRejectPolygon(posRaySrc, posRayTo0, ref posReturn0, GenerateShip.GetOutRejectPolygon());
            }

            int     nPoint  = lFlyPoint.Count;
            Vector3 posLast = lFlyPoint[nPoint - 1] + (lFlyPoint[nPoint - 1] - lFlyPoint[nPoint - 2]) * 30f;
            lFlyPoint.Add(posLast);
            return(true);
        }
        return(false);
    }
示例#17
0
 void StartBreakUp()
 {
     SoundPlay.Play("ship_break", false, false);
     GenerateShip.BreakUp(gameObject, "GoToEdit");
 }
示例#18
0
 public void BtnEdit_OnClickEventHandler(UIButton sender)
 {
     HideUI();
     Life.Environment = LifeEnvironment.Edit;
     GenerateShip.BreakUpFallBack(gameObject, "StartBreakUp");
 }