Exemplo n.º 1
0
    public void ChangeFriendOrFoeDesignation(DetectedUnitInfo detectedUnit, GameConstants.FriendOrFoe friendOfFoe)
    {
        GameManager.Instance.NetworkManager.Send(OrderFactory.CreateFriendOrFoeDesignationOrder(detectedUnit.Id, friendOfFoe));

        GameManager.Instance.MessageManager.AddMessage(string.Format(
                                                           "Changing FriendOrFoe Designation on : {0} to: {1}",
                                                           detectedUnit.Id, friendOfFoe.ToString()), GameManager.MessageTypes.Detection, detectedUnit.Position);
    }
Exemplo n.º 2
0
        //private void SetFormation()
        //{
        //    BaseUnitInfo unit = lstUnits.SelectedItem as BaseUnitInfo;
        //    if (unit != null)
        //    {
        //        GroupInfo group = _Groups.Find(g => g.Id == unit.GroupId);
        //        if (group != null)
        //        {
        //            if (group.Formation != null)
        //            {
        //                UnitOrder order =
        //                    new UnitOrder(GameConstants.UnitOrderType.SetNewGroupFormation, unit.Id);
        //                Formation newForm = group.Formation.Clone();
        //                if (newForm.FormationPositions.Count > 2)
        //                {
        //                    newForm.FormationPositions[1] = new FormationPosition()
        //                    {
        //                        PositionOffset = new PositionOffset(1000, 1000)
        //                    };
        //                }
        //                order.Formation = newForm;
        //                _gameClient.Send(order);
        //                ShowInfo("*** New Formation order sent to unit " + unit.ToShortString());
        //            }
        //        }
        //        else
        //        {
        //            ShowInfo(string.Format("Unit {0} has no group", unit.ToShortString()));
        //        }
        //    }

        //}

        private void btnDesignateHostile_Click(object sender, RoutedEventArgs e)
        {
            DetectedUnitInfo unit = lstDetections.SelectedItem as DetectedUnitInfo;

            if (unit != null)
            {
                ShowInfo("Designate " + unit.ToString() + " as hostile.");
                var req = OrderFactory.CreateFriendOrFoeDesignationOrder(unit.Id, GameConstants.FriendOrFoe.Foe);
                _gameClient.Send(req);
            }
        }