Example #1
0
        private static void Main()
        {
            GameTime gameTime = new GameTime();
            var      window   = new ExampleWindow();


            var orbit = window.GameWindow.CreateOrbitingCameraController(50f, 90, 0.1f, 500f);

            orbit.View.Azimuth   = 250;
            orbit.View.Elevation = 45;
            orbit.View.TargetY   = 10;
            var visual = new MainView(window.RenderContext.RenderState, window.ContentLoader);
            var model  = new MainModel();

            window.Update             += (period) => model.Update(gameTime.DeltaTime);
            window.Render             += () => visual.Render(model.Entities.ToViewEntities(), gameTime.AbsoluteTime, orbit);
            window.Resize             += visual.Resize;
            window.GameWindow.KeyDown += (sender, e) =>
            {
                if (e.Key == OpenTK.Input.Key.Space)
                {
                    visual.Bloom = !visual.Bloom;
                }
            };
            window.Run();
        }
Example #2
0
        private static void Main()
        {
            var window = new ExampleWindow();
            var logic  = new GameLogic();            //TODO student: load the game state
            var view   = new View(window.RenderContext.RenderState, window.ContentLoader);

            window.GameWindow.Closing += (s, e) => { /*TODO student: save the game state */ };
            window.Resize             += (w, h) => view.Resize(logic.GameState, w, h);
            window.Render             += () =>
            {
                var score = $"white:{logic.CountWhite} black:{logic.CountBlack}";
                window.GameWindow.Title = score;
                view.Render(logic.GameState);
                if (GameLogic.Result.PLAYING != logic.CurrentGameResult)
                {
                    var winner = logic.CurrentGameResult.ToString();
                    view.PrintMessage(winner);
                }
            };
            window.GameWindow.MouseDown += (s, e) =>
            {
                if (e.Button != MouseButton.Left)
                {
                    return;                                                           //only accept left mouse button
                }
                var coord   = window.GameWindow.ConvertWindowPixelCoords(e.X, e.Y);   //convert pixel coordinates to [-1,1]²
                var gridPos = view.CalcGridPos(new OpenTK.Vector2(coord.X, coord.Y)); //convert mouse coordinates into grid coordinates
                logic.Move(gridPos);                                                  //do move
            };
            window.Run();
        }
Example #3
0
        private static void Main()
        {
            var window     = new ExampleWindow();
            var controller = new Controller();

            window.Render += controller.Render;
            window.Update += (dt) => controller.Update(dt);
            window.Run();
        }
Example #4
0
        private static void Main()
        {
            var window = new ExampleWindow();
            var logic  = new Logic();
            var visual = new MyVisual(window.RenderContext.RenderState, window.ContentLoader);

            window.Update += (t) => Window_Update(window.Input, logic, t);
            window.Render += () => visual.Render(logic.Paddle1, logic.Paddle2, logic.Ball, logic.Player1Points, logic.Player2Points);
            window.Run();
        }
        /// <summary>
        /// Constructor for MasterModel class
        /// </summary>
        /// <param name="window">Handle to the user interface</param>
        /// <param name="radius">Radius to draw nodes and lines</param>
        public MasterModel(ExampleWindow window, int radius)
        {
            view = window;
            view.StepTrackBar.Minimum = 0;
            view.StepTrackBar.Maximum = 0;

            graph = new Graph(view.ModelOutput.Width, view.ModelOutput.Height, radius);
            lines = new List<Line>();
            nodes = new List<Node>();
        }
Example #6
0
        private static void Main()
        {
            ExampleWindow window = new ExampleWindow();
            //window.GameWindow.WindowState = OpenTK.WindowState.Fullscreen;
            var controller = new Controller();

            window.Render += controller.Render;
            window.Update += (t) => controller.Update(t * 1f);
            window.Resize += (width, height) => controller.onResize(width, height);
            window.Run();
        }
Example #7
0
    private void OnGUI()
    {
        if (GUILayout.Button("Close Me"))
        {
            if (win == null)
            {
                win = GetWindow <ExampleWindow>(false, "Example Window");
            }

            win.Close();
        }

        GUILayout.BeginHorizontal();
        GUILayout.TextArea("-- Horizontal 1 --");
        GUILayout.TextArea("-- Horizontal 2 --");
        GUILayout.EndHorizontal();

        testScroll = GUILayout.BeginScrollView(testScroll);

        // Things go ehere
        for (int i = 0; i < 25; ++i)
        {
            GUILayout.TextArea("Scroll View Area " + i);
        }

        GUILayout.EndScrollView();


        GUILayout.BeginHorizontal();
        GUILayout.TextArea("-- BOT Horizontal 1 --");
        GUILayout.TextArea("-- BOT Horizontal 2 --");
        GUILayout.EndHorizontal();


        testScroll2 = GUILayout.BeginScrollView(testScroll2);

        // Things go ehere
        for (int i = 0; i < 25; ++i)
        {
            GUILayout.BeginHorizontal();

            GUILayout.TextArea("A Left Area " + i);
            ++i;
            GUILayout.TextArea("A Middle Area " + i);
            ++i;
            GUILayout.TextArea("A Right Area " + i);

            GUILayout.EndHorizontal();
        }

        GUILayout.EndScrollView();
    }
Example #8
0
        static void Main(string[] args)
        {
            var window = new ExampleWindow();
            //var camera = window.GameWindow.CreateOrbitingCameraController(1f, 70f, 0.01f, 20f);
            //camera.View.Elevation = 30;

            var camera = window.GameWindow.CreateFirstPersonCameraController(0.1f, new Vector3(0.4f, 0.4f, 0.95f), 70f, 0.01f, 30f);

            var visual = new MainVisual(window.RenderContext, window.ContentLoader);

            window.Render += () => visual.Render(camera);
            window.Run();
        }
    void Awake()
    {
        if(instance == null){ 	//making sure we only initialize one instance.
            instance = this;
            GameObject.DontDestroyOnLoad(this.gameObject);
        } else {					//Destroying unused instances.
            GameObject.Destroy(this);
        }

        //FONT
        if(Mathf.Max(Screen.width, Screen.height) > 640){ //using max to be certain we have the longest side of the screen, even if we are in portrait.
            fontSuffix = "_2X"; //a nice suffix to show the fonts are twice as big as the original
        }
    }
        static void Main(string[] args)
        {
            var window = new ExampleWindow();
            var view   = new View(window.RenderContext.RenderState, window.ContentLoader);

            window.Render               += () => view.Render();
            window.Update               += (dt) => view.Update(dt);
            window.GameWindow.KeyDown   += view.Event_KeyDown;
            window.GameWindow.KeyUp     += view.Event_KeyRelease;
            window.Resize               += (width, height) => view.Resize(width, height);
            window.GameWindow.MouseDown += (sender, e) => view.GameWindow_MouseDown(sender, e);
            window.GameWindow.MouseUp   += (sender, e) => view.GameWindow_MouseUp(sender, e);
            //window.Render += () => Draw();
            window.Run();
        }
Example #11
0
        static void Main(string[] args)
        {
            var window = new ExampleWindow();
            var camera = window.GameWindow.CreateOrbitingCameraController(1f, 70f, 0.01f, 20f);

            camera.View.Elevation = 30;

            //var movementState = window.GameWindow.AddFirstPersonCameraEvents(visual.Camera); //TODO: implement
            //window.Update += (dt) => movementState.Update(visual.Camera, dt);

            var visual = new MainVisual(window.RenderContext, window.ContentLoader);

            window.Render += () => visual.Render(camera);
            window.Run();
        }
Example #12
0
        private static void Main()
        {
            var       window    = new ExampleWindow();
            var       view      = new View(window.RenderContext.RenderState, window.ContentLoader);
            GameLogic gameLogic = new GameLogic(view.Renderer);

            GameTime time = new GameTime();

            window.Update += (t) => HandleInput(gameLogic, time.AbsoluteTime);
            window.Resize += view.ResizeWindow;
            window.Render += () => view.DrawScreen(GameLogic.visibleFrame, gameLogic.Points);
            window.Render += () => time.NewFrame();
            window.Render += () => window.GameWindow.Title = $"{time.FPS}FPS";

            window.Run();
        }
Example #13
0
        public void Data_Context_Should_Stay_In_Sync_With_Reactive_Window_View_Model()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var view      = new ExampleWindow();
                var viewModel = new ExampleViewModel();
                Assert.Null(view.ViewModel);

                view.DataContext = viewModel;
                Assert.Equal(view.ViewModel, viewModel);
                Assert.Equal(view.DataContext, viewModel);

                view.DataContext = null;
                Assert.Null(view.ViewModel);
                Assert.Null(view.DataContext);
            }
        }
Example #14
0
    void Awake()
    {
        if (instance == null)           //making sure we only initialize one instance.
        {
            instance = this;
            GameObject.DontDestroyOnLoad(this.gameObject);
        }
        else                                                    //Destroying unused instances.
        {
            GameObject.Destroy(this);
        }

        //FONT
        if (Mathf.Max(Screen.width, Screen.height) > 640) //using max to be certain we have the longest side of the screen, even if we are in portrait.
        {
            fontSuffix = "_2X";                           //a nice suffix to show the fonts are twice as big as the original
        }
    }
Example #15
0
        public MainController(IInitializationHandler initializationHandler)
        {
            _app = new ExampleWindow();
            _app.RemoveDefaultKeyHandler();
            _inputHandler   = initializationHandler.InitializeInputHandler((GameWindow)_app.GameWindow);
            _stateHandler   = initializationHandler.InitializeStateHandler();
            _modelRegistry  = initializationHandler.InitalizeModelRegistry();
            _viewRegistry   = initializationHandler.InitializeViewRegistry();
            _inactiveModels = new List <IModel>();
            SetModelViewInstances(initializationHandler.InitialState);

            _timeSource = new Stopwatch();

            _app.Update += Update;
            _app.Render += Render;
            _app.Resize += Resize;

            _timeSource.Start();
            _app.Run();
        }
Example #16
0
        private static void Main()
        {
            GameTime gameTime = new GameTime();
            var      window   = new ExampleWindow();


            var orbit = window.GameWindow.CreateOrbitingCameraController(15f, 90, 0.1f, 500f);

            orbit.View.Azimuth   = 250;
            orbit.View.Elevation = 40;
            orbit.View.TargetY   = 10;

            Voronoi voronoi = new Voronoi(30, 30, new Vector3(10, 5, 10));

            var additionalMeshes = new Dictionary <Shared.Enums.EntityType, Tuple <DefaultMesh, Vector4> >();

            additionalMeshes.Add(Shared.Enums.EntityType.Voronoi, Tuple.Create(voronoi.Mesh, new Vector4(.1f, 1, 0.5f, 0)));

            var visual = new MainView(window.RenderContext.RenderState, window.ContentLoader, additionalMeshes);
            var model  = new MainModel();

            foreach (var key in voronoi.Crystals.Keys)
            {
                foreach (var crystal in voronoi.Crystals[key])
                {
                    model.AddEntity(key, crystal.Position, Vector3.UnitY * crystal.RotationFactor, crystal.ScaleFactor);
                }
            }

            window.Update             += (period) => model.Update(gameTime.DeltaTime);
            window.Render             += () => visual.Render(model.Entities.ToViewEntities(), gameTime.AbsoluteTime, orbit);
            window.Resize             += visual.Resize;
            window.GameWindow.KeyDown += (sender, e) =>
            {
                if (e.Key == OpenTK.Input.Key.Space)
                {
                    visual.Bloom = !visual.Bloom;
                }
            };
            window.Run();
        }
Example #17
0
        private static void Main()
        {
            using (var window = new ExampleWindow())
            {
                var model = new Model();
                var view  = new View(window.ContentLoader);
                var sound = new Sound(window.ContentLoader);
                model.OnShoot        += (sender, args) => { sound.Shoot(); };
                model.OnEnemyDestroy += (sender, args) => { sound.DestroyEnemy(); };
                model.OnLost         += (sender, args) => { sound.Lost(); };
                sound.Background();

                window.Render += () =>
                {
                    view.Clear();
                    view.DrawEnemies(model.Enemies);
                    view.DrawBullets(model.Bullets);
                    view.DrawPlayer(model.Player);
                };
                window.Update += (dt) => Update(model);
                window.Run();
            }
        }
Example #18
0
    public bool ProcessEvent(Event e)
    {
        if (!MapLogic.Instance.IsLoaded)
        {
            return(false);
        }

        if (e.type == EventType.KeyDown)
        {
            switch (e.keyCode)
            {
            case KeyCode.LeftArrow:
                if (ScrollDeltaX == 0)
                {
                    ScrollDeltaX = -1;
                }
                return(true);

            case KeyCode.RightArrow:
                if (ScrollDeltaX == 0)
                {
                    ScrollDeltaX = 1;
                }
                return(true);

            case KeyCode.UpArrow:
                if (ScrollDeltaY == 0)
                {
                    ScrollDeltaY = -1;
                }
                return(true);

            case KeyCode.DownArrow:
                if (ScrollDeltaY == 0)
                {
                    ScrollDeltaY = 1;
                }
                return(true);

            case KeyCode.Plus:
            case KeyCode.Equals:     // + = =
            case KeyCode.KeypadPlus:
            {
                int oldSpeed = MapLogic.Instance.Speed;
                if (!NetworkManager.IsClient)
                {
                    MapLogic.Instance.Speed++;
                }
                if (oldSpeed != MapLogic.Instance.Speed)
                {
                    MapViewChat.Instance.AddChatMessage(Player.AllColorsSystem, Locale.Main[108 + MapLogic.Instance.Speed]);
                }
            }
                return(true);

            case KeyCode.Minus:
            case KeyCode.KeypadMinus:
            {
                int oldSpeed = MapLogic.Instance.Speed;
                if (!NetworkManager.IsClient)
                {
                    MapLogic.Instance.Speed--;
                }
                if (oldSpeed != MapLogic.Instance.Speed)
                {
                    MapViewChat.Instance.AddChatMessage(Player.AllColorsSystem, Locale.Main[108 + MapLogic.Instance.Speed]);
                }
            }
                return(true);

            case KeyCode.F3:
                //if (NetworkManager.IsClient)
            {
                DiplomacyWindow wnd = Utils.CreateObjectWithScript <DiplomacyWindow>();
                //Debug.LogFormat("created a window!");
            }
                return(true);

            case KeyCode.Escape:
            {
                // todo: create main menu
                ExampleWindow wnd = Utils.CreateObjectWithScript <ExampleWindow>();
            }
                return(true);

            case KeyCode.Space:
                // check if local unit is dead.
                // for dead local unit, space sends respawn.
                // for alive local unit, space toggles both spellbook and inventory.
                if (MapLogic.Instance.ConsolePlayer != null &&
                    !MapLogic.Instance.ConsolePlayer.Avatar.IsAlive)
                {
                    Client.SendRespawn();
                }
                else
                {
                    bool cstate = InventoryVisible && SpellbookVisible;
                    InventoryVisible = !cstate;
                    SpellbookVisible = !cstate;
                    Spellbook.Update();
                }
                return(true);

            case KeyCode.BackQuote:
                InventoryVisible = !InventoryVisible;
                Spellbook.Update();
                return(true);

            case KeyCode.Q:
                SpellbookVisible = !SpellbookVisible;
                Spellbook.Update();
                return(true);
            }
        }
        else if (e.type == EventType.KeyUp)
        {
            switch (e.keyCode)
            {
            case KeyCode.LeftArrow:
                if (ScrollDeltaX == -1)
                {
                    ScrollDeltaX = 0;
                }
                return(true);

            case KeyCode.RightArrow:
                if (ScrollDeltaX == 1)
                {
                    ScrollDeltaX = 0;
                }
                return(true);

            case KeyCode.UpArrow:
                if (ScrollDeltaY == -1)
                {
                    ScrollDeltaY = 0;
                }
                return(true);

            case KeyCode.DownArrow:
                if (ScrollDeltaY == 1)
                {
                    ScrollDeltaY = 0;
                }
                return(true);
            }
        }
        else if (e.rawType == EventType.MouseMove)
        {
            UpdateInput();
            return(true);
        }
        else if (e.rawType == EventType.MouseDown && e.button == 0)
        {
            // select unit if not selected yet
            if (HoveredObject != null &&
                (SelectedObject == null || (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Move &&
                                            !Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt)) || (Commandbar.CurrentCommand == 0)))
            {
                SelectedObject = HoveredObject;
                OnObjectSelected(SelectedObject);
            }
            else if (SelectedObject != null && SelectedObject is IPlayerPawn && ((IPlayerPawn)SelectedObject).GetPlayer() == MapLogic.Instance.ConsolePlayer)
            {
                // todo: handle commands here
                // try to walk.
                if (SelectedObject.GetObjectType() == MapObjectType.Monster ||
                    SelectedObject.GetObjectType() == MapObjectType.Human)
                {
                    MapUnit unit = (MapUnit)SelectedObject;
                    if (GetCastSpell() != Spell.Spells.NoneSpell)
                    {
                        if (HoveredObject != null && (HoveredObject.GetObjectType() == MapObjectType.Monster ||
                                                      HoveredObject.GetObjectType() == MapObjectType.Human))
                        {
                            Client.SendCastToUnit(unit, GetCastSpell(), (MapUnit)HoveredObject);
                        }
                        else
                        {
                            Client.SendCastToArea(unit, GetCastSpell(), MouseCellX, MouseCellY);
                        }
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Move)
                    {
                        Client.SendMoveUnit(unit, MouseCellX, MouseCellY);
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Attack &&
                             HoveredObject != null &&
                             (HoveredObject.GetObjectType() == MapObjectType.Monster ||
                              HoveredObject.GetObjectType() == MapObjectType.Human))
                    {
                        Client.SendAttackUnit(unit, (MapUnit)HoveredObject);
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Pickup &&
                             MapLogic.Instance.GetSackAt(MouseCellX, MouseCellY) != null)
                    {
                        Client.SendPickupUnit(unit, MouseCellX, MouseCellY); // issue sack pickup command by current unit at target coordinates
                    }
                }
            }

            return(true);
        }
        else if (e.rawType == EventType.MouseDown && e.button == 1)
        {
            SelectedObject             = null; // deselect
            Commandbar.EnabledCommands = 0;
            return(true);
        }

        return(false);
    }
Example #19
0
    public bool ProcessEvent(Event e)
    {
        if (!MapLogic.Instance.IsLoaded)
        {
            if (MapLogic.Instance.IsLoading)
            {
                MouseCursor.SetCursor(MouseCursor.CurWait);
            }
            return(false);
        }

        if (e.type == EventType.KeyDown)
        {
            switch (e.keyCode)
            {
            case KeyCode.LeftArrow:
                if (ScrollDeltaX == 0)
                {
                    ScrollDeltaX = -1;
                }
                return(true);

            case KeyCode.RightArrow:
                if (ScrollDeltaX == 0)
                {
                    ScrollDeltaX = 1;
                }
                return(true);

            case KeyCode.UpArrow:
                if (ScrollDeltaY == 0)
                {
                    ScrollDeltaY = -1;
                }
                return(true);

            case KeyCode.DownArrow:
                if (ScrollDeltaY == 0)
                {
                    ScrollDeltaY = 1;
                }
                return(true);

            case KeyCode.Plus:
            case KeyCode.Equals:     // + = =
            case KeyCode.KeypadPlus:
            {
                int oldSpeed = MapLogic.Instance.Speed;
                if (!NetworkManager.IsClient)
                {
                    MapLogic.Instance.Speed++;
                }
                if (oldSpeed != MapLogic.Instance.Speed)
                {
                    MapViewChat.Instance.AddChatMessage(Player.AllColorsSystem, Locale.Main[108 + MapLogic.Instance.Speed]);
                }
            }
                return(true);

            case KeyCode.Minus:
            case KeyCode.KeypadMinus:
            {
                int oldSpeed = MapLogic.Instance.Speed;
                if (!NetworkManager.IsClient)
                {
                    MapLogic.Instance.Speed--;
                }
                if (oldSpeed != MapLogic.Instance.Speed)
                {
                    MapViewChat.Instance.AddChatMessage(Player.AllColorsSystem, Locale.Main[108 + MapLogic.Instance.Speed]);
                }
            }
                return(true);

            case KeyCode.F3:
                //if (NetworkManager.IsClient)
            {
                DiplomacyWindow wnd = Utils.CreateObjectWithScript <DiplomacyWindow>();
                //Debug.LogFormat("created a window!");
            }
                return(true);

            case KeyCode.Escape:
            {
                // todo: create main menu
                ExampleWindow wnd = Utils.CreateObjectWithScript <ExampleWindow>();
            }
                return(true);

            case KeyCode.Space:
                // check if local unit is dead.
                // for dead local unit, space sends respawn.
                // for alive local unit, space toggles both spellbook and inventory.
                if (MapLogic.Instance.ConsolePlayer != null &&
                    !MapLogic.Instance.ConsolePlayer.Avatar.IsAlive)
                {
                    Client.SendRespawn();
                }
                else
                {
                    bool cstate = InventoryVisible && SpellbookVisible;
                    InventoryVisible = !cstate;
                    SpellbookVisible = !cstate;
                    Spellbook.Update();
                }
                return(true);

            case KeyCode.BackQuote:
                InventoryVisible = !InventoryVisible;
                Spellbook.Update();
                return(true);

            case KeyCode.Q:
                SpellbookVisible = !SpellbookVisible;
                Spellbook.Update();
                return(true);
            }
        }
        else if (e.type == EventType.KeyUp)
        {
            switch (e.keyCode)
            {
            case KeyCode.LeftArrow:
                if (ScrollDeltaX == -1)
                {
                    ScrollDeltaX = 0;
                }
                return(true);

            case KeyCode.RightArrow:
                if (ScrollDeltaX == 1)
                {
                    ScrollDeltaX = 0;
                }
                return(true);

            case KeyCode.UpArrow:
                if (ScrollDeltaY == -1)
                {
                    ScrollDeltaY = 0;
                }
                return(true);

            case KeyCode.DownArrow:
                if (ScrollDeltaY == 1)
                {
                    ScrollDeltaY = 0;
                }
                return(true);
            }
        }
        else if (e.rawType == EventType.MouseMove)
        {
            UpdateInput();
            return(true);
        }
        else if (e.rawType == EventType.MouseDown && e.button == 0)
        {
            // select unit if not selected yet
            // to-do: unfuck this expression later...
            if (HoveredObject != null &&
                (SelectedObject == null || (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Move && GetCastSpell() == Spell.Spells.NoneSpell &&
                                            !Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt)) || (Commandbar.CurrentCommand == 0)) &&
                (SelectedObject == null || !(HoveredObject is MapStructure s && s.Class.Usable)))
            {
                SelectedObject = HoveredObject;
            }
            else if (SelectedObject != null && SelectedObject is IPlayerPawn && ((IPlayerPawn)SelectedObject).GetPlayer() == MapLogic.Instance.ConsolePlayer)
            {
                // todo: handle commands here
                // try to walk.
                if (SelectedObject is MapUnit unit)
                {
                    Spell.Spells castSpId = GetCastSpell();
                    if (HoveredObject is MapStructure struc && struc.Class.Usable)
                    {
                        Client.SendUseStructure(unit, struc);
                    }
                    else if (castSpId != Spell.Spells.NoneSpell && (MapLogic.Instance.Nodes[MouseCellX, MouseCellY].Flags & MapNodeFlags.Visible) != 0)
                    {
                        Spell castSp = GetOneTimeCast();
                        if (castSp == null)
                        {
                            castSp = unit.GetSpell(castSpId);
                        }
                        if (HoveredObject != null && HoveredObject is MapUnit)
                        {
                            Client.SendCastToUnit(unit, castSp, (MapUnit)HoveredObject, MouseCellX, MouseCellY);
                        }
                        else
                        {
                            Client.SendCastToArea(unit, castSp, MouseCellX, MouseCellY);
                        }
                        if (castSp == OneTimeCast || Commandbar.CurrentCommandActual == MapViewCommandbar.Commands.Cast)
                        {
                            SpellbookVisible = false;
                            if (Commandbar.CurrentCommandActual == MapViewCommandbar.Commands.Cast)
                            {
                                Commandbar.InitDefault(SelectedObject);
                            }
                        }
                        OneTimeCast = null;
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Move)
                    {
                        Client.SendMoveUnit(unit, MouseCellX, MouseCellY);
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Attack &&
                             HoveredObject != null &&
                             HoveredObject is MapUnit)
                    {
                        Client.SendAttackUnit(unit, (MapUnit)HoveredObject);
                    }
                    else if (Commandbar.CurrentCommand == MapViewCommandbar.Commands.Pickup &&
                             MapLogic.Instance.GetSackAt(MouseCellX, MouseCellY) != null)
                    {
                        Client.SendPickupUnit(unit, MouseCellX, MouseCellY); // issue sack pickup command by current unit at target coordinates
                    }
                }
            }
Example #20
0
 // Use this for initialization
 void Start()
 {
     ExampleWindow.OpenWindow();
 }
Example #21
0
 public static void openWindow()
 {
     win = GetWindow <ExampleWindow>(false, "Example Window");
     win.Focus();
     win.Show();
 }