示例#1
0
    public void Attack(BaseUnitInfo attacker, DetectedUnitInfo attackee, GameConstants.EngagementOrderType engagementOrderType, string weaponClassID, int roundCount)
    {
        if (attacker != null && attackee != null)
        {
            //~ ShowInfo(string.Format("*** Unit {0} to engage target {1}", unit.UnitName, det.DetectedUnitDescription));
            UnitEngagementOrder order = OrderFactory.CreateEngagementOrder(attacker.Id, attackee.Id, weaponClassID, engagementOrderType,
                                                                           GameConstants.EngagementStrength.DefaultAttack, false);
            //order.DetectedUnitId = attackee.Id;
            //order.Id = attacker.Id;
            //if (weaponClassID != null)
            //{
            //    order.WeaponClassID = weaponClassID;
            //}
            //if (roundCount != null && roundCount > 0)
            //{
            //    order.RoundCount = roundCount;
            //}

            //order.EngagementType = engagementOrderType;
            GameManager.Instance.NetworkManager.Send(order);

            GameManager.Instance.MessageManager.AddMessage(string.Format("Attacking {0} with unit {1}", attackee.Id, attacker.Id), GameManager.MessageTypes.Battle, attackee.Position);
        }
        else
        {
            //~ ShowInfo("Select own unit and detected unit to engage.");
        }
    }
示例#2
0
    public void LaunchAttack(BaseUnitInfo unit, DetectedUnitInfo det, List <CarriedUnit> unitsToLaunch, Coordinate coord)
    {
        List <string> units = new List <string>();

        foreach (CarriedUnit cui in unitsToLaunch)
        {
            units.Add(cui.UnitInfo.Id);
        }
        UnitMovementOrder moveOrder = new UnitMovementOrder();

        if (coord != null)
        {
            moveOrder.Waypoints.Add(new WaypointInfo(new PositionInfo(coord.Latitude, coord.Longitude)));
        }
        GameManager.Instance.NetworkManager.Send(OrderFactory.CreateAircraftLaunchOrder(unit.Id, units, moveOrder));

        GameManager.Instance.NetworkManager.Send(OrderFactory.CreateEngagementOrder(unit.Id, det.Id, string.Empty, GameConstants.EngagementOrderType.CloseAndEngage,
                                                                                    GameConstants.EngagementStrength.DefaultAttack, true));
    }
示例#3
0
    public void Attack(string attackerId, string detectedInfoId, GameConstants.EngagementOrderType engagementOrderType, WeaponInfo weaponInfo, GameConstants.EngagementStrength strength, bool isGroupAttack)
    {
        GameManager.Instance.NetworkManager.Send(OrderFactory.CreateEngagementOrder(attackerId, detectedInfoId, weaponInfo == null ? string.Empty : weaponInfo.Id, engagementOrderType, strength, isGroupAttack));

        GameManager.Instance.MessageManager.AddMessage(string.Format("Attacking {0} with unit {1}", attackerId, detectedInfoId), GameManager.MessageTypes.Battle, null);
    }