Example #1
0
        private void btnSendCommand_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Random r = new Random();

                if (Players.Client.Units.Count == 0)
                {
                    Players.CreateNewUnit();
                }

                Players.Client.Units[0].Location = new UnitLocation
                {
                    X = r.Next(0, 20),
                    Y = r.Next(0, 20),
                    Z = r.Next(0, 20)
                };

                Command c = new Command();
                c.CommandName = "Move";
                c.Unit        = Players.Client.Units[0];
                c.Sender      = Players.Client;

                //NetManager.Client.BroadcastCommand(c);
                FantasyBattle.BattleGrid.MoveUnitSphere(Players.Client.Units[0]);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error sending command: " + ex.Message, "Send Error", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Example #2
0
 private void btnAddUnit_Click(object sender, RoutedEventArgs e)
 {
     FantasyBattle.BattleGrid.AddNewUnitSphere(Players.CreateNewUnit());
 }