Beispiel #1
0
    private void SendHeartBeat(ControlledDivision Host)
    {
        RememberedDivision CommanderSendingOrder = GetRememberedDivisionFromHost(Host, CommanderSendingOrderId);
        RememberedDivision rememberedTarget      = GetRememberedDivisionFromHost(Host, RememberedTargetId);

        Host.SendOrdersTo(rememberedTarget, new List <Order>(), ref Host.RememberedDivisions);

        /*
         * DivisionController HeartBeatMessenger;
         * if (Host.TryCreateNewDivision(out HeartBeatMessenger))
         * {
         *  HeartBeatMessenger.name = "Heatbeat messenger";
         *
         *  Debug.Log($" heartbeat {Host.DivisionId} {RememberedTargetId}");
         *  HeartBeatMessenger.AttachedDivision.ReceiveOrders(
         *      new List<Order>()
         *      {
         *      new FindDivision(
         *          HeartBeatMessenger.AttachedDivision,
         *          Host.DivisionId,
         *          RememberedTargetId),
         *      new SendMessage(
         *          HeartBeatMessenger.AttachedDivision,
         *          Host.DivisionId,
         *          new List<Order>(),
         *          RememberedTargetId,
         *          Host.DivisionId)
         *      });
         *
         * }
         */
    }
    public override void Proceed(ControlledDivision Host)
    {
        if (Host.FindVisibleDivision(RememberedTargetId, out _visibleTarget))
        {
            if (RememberedTargetId == _endTargetId)
            {
                _visibleTarget.ReceiveOrders(_message);
            }
            else
            {
                _visibleTarget.SendOrdersTo(GetRememberedDivisionFromHost(_visibleTarget, _endTargetId),
                                            _message, ref _visibleTarget.RememberedDivisions);
            }

            _hasFoundTarget = true;
        }
    }