Exemplo n.º 1
0
        private void Click()
        {
            Vector2i square = ScreenToGrid(Engine.MousePosition);

            if (square == null)
            {
                return;
            }

            switch (Mode)
            {
            case InterfaceMode.TargettingWarp:
                if (square == SelectedUnit.Position)
                {
                    SelectedUnit.WarpTarget    = null;
                    SelectedUnit.WarpCountdown = -1;
                }
                else if (SelectedUnit.CanWarpTo(square))
                {
                    SelectedUnit.WarpTarget    = square;
                    SelectedUnit.WarpCountdown = 3;
                }

                Mode = InterfaceMode.Normal;
                break;

            case InterfaceMode.TargettingBombard:
                //we can only get here if the selectedunit has bombard
                Unit target = Game.World.Map.At(square).Unit;
                if (target != null)
                {
                    Engine.NetClient.Send(
                        new NetMessage3(
                            NM3MessageType.unit_bombard,
                            SelectedUnit.ID,
                            target.ID
                            )
                        );
                }

                Mode = InterfaceMode.Normal;
                break;

            default:
            case InterfaceMode.Normal:
                Select(square);
                break;
            }
        }