Beispiel #1
0
 public void SendFightFleet(Fleet attacker, Fleet defender)
 {
     MapGlobal.getInstance().attacker = attacker.mapIndex;
     MapGlobal.getInstance().defender = defender.mapIndex;
 }
Beispiel #2
0
        /* private void Awake()
         * {
         *   for (int i = 0; i < grid.units.Count; i++)
         *   {
         *       grid.units[i].camp = 0;
         *       turnCamp.Add(grid.units[i]);
         *
         *   }
         *
         * }*/

        void Update()
        {
            if (MapEditor == null || !MapEditor.编辑模式)
            {
                if (!EventSystem.current.IsPointerOverGameObject())
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        if (!selectedUnit)
                        {
                            MouseDoSelection();
                            if (selectedUnit)
                            {
                                moveRange(selectedUnit);
                            }
                        }
                        else if (selectedUnit)
                        {
                            if (GetCellUnderCursor() && GetCellUnderCursor().FleetUnit)
                            {
                                MouseDoSelection();
                                moveRange(selectedUnit);
                            }
                            else if (GetCellUnderCursor() && !GetCellUnderCursor().FleetUnit)
                            {
                                if (selectedUnit.camp == 0)
                                {
                                    if (selectedUnit.step > GetCellUnderCursor().Distance)
                                    {
                                        DoMove(GetCellUnderCursor());
                                    }
                                    else if (selectedUnit.step < GetCellUnderCursor().Distance)
                                    {
                                        Refresh();
                                        selectedUnit = null;
                                    }
                                }
                                else if (selectedUnit.camp != 0)
                                {
                                    Refresh();
                                    selectedUnit = null;
                                }
                            }
                        }
                    }
                    if (Input.GetMouseButtonDown(1) &&
                        selectedUnit &&
                        GetCellUnderCursor().FleetUnit.camp != selectedUnit.camp &&
                        GetCellUnderCursor().FleetUnit.camp != 2)
                    {
                        fight(selectedUnit, GetCellUnderCursor().FleetUnit);
                    }
                    else if (!selectedUnit)
                    {
                        Refresh();
                        UpdateMouseCell();
                    }
                    else if (selectedUnit)
                    {
                        moveRange(selectedUnit);
                        UpdateMouseCell();
                        DoPathfinding();
                    }
                }
            }
        }
Beispiel #3
0
 public void RemoveFleetUnit(Fleet fleetUnit)
 {
     fleetUnits.Remove(fleetUnit);
 }