Exemplo n.º 1
0
 private void Event_OnCoordinatorTurnEnd(TurnCoordinator coordinator)
 {
     if (coordinator is PlayerCoordinator)
     {
         foreach (var button in m_Targets)
         {
             button.interactable = false;
         }
     }
 }
Exemplo n.º 2
0
    private void Event_OnCoordinatorTurnBegin(TurnCoordinator coordinator)
    {
        m_PrevCoordinator = coordinator as PlayerCoordinator;
        bool enableState = m_PrevCoordinator != null;

        foreach (var button in m_Targets)
        {
            button.interactable = enableState;
        }
    }
Exemplo n.º 3
0
    private void Update()
    {
        if (m_CurrentState == TurnState.Finished)
        {
            return;
        }

        if (m_Coordinators == null || m_Coordinators.Count == 0)
        {
            return;
        }

        // Update decisions
        while (m_CoordinatorQueue.Count != 0)
        {
            var coordinator = m_CoordinatorQueue.Peek();

            if (coordinator != null)
            {
                if (m_PreviousCoordinator != coordinator)
                {
                    EventHandler.Invoke("OnCoordinatorTurnBegin", coordinator);
                    m_PreviousCoordinator = coordinator;
                }

                // Only update this decision at a frame, if pending
                if (coordinator.GenerateDecisions(m_CurrentState) == TurnCoordinator.DecisionState.Pending)
                {
                    return;
                }

                EventHandler.Invoke("OnCoordinatorTurnEnd", coordinator);
            }

            m_CoordinatorQueue.Dequeue();
        }

        // Update actions
        while (m_ActionQueue.Count != 0)
        {
            var action = m_ActionQueue[0];

            if (action.Action(m_DecisionCounter++) == TurnActionState.Pending)
            {
                return;
            }

            m_ActionQueue.RemoveAt(0);
            m_DecisionCounter = 0;
        }

        NextPhase();
    }
Exemplo n.º 4
0
        public EFISAdapterController(
            Inclinometer inclinometer,
            TurnCoordinator turnCoordinator,
            ADIVariables adiVariables,
            HSIVariables hsiVariables)
        {
            this.inclinometer    = inclinometer;
            this.turnCoordinator = turnCoordinator;
            this.adiVariables    = adiVariables;
            this.hsiVariables    = hsiVariables;

            this.categoryService     = serviceFactory.getCategoryService();
            this.airframeDataService = serviceFactory.getAirframeDataService();
            this.simSecurityService  = serviceFactory.getSimSecurityService();
            this.apDataService       = serviceFactory.getAutoPilotDataService();
        }
Exemplo n.º 5
0
    private void SetCurrentState(TurnState state)
    {
        m_CoordinatorQueue.Clear();
        m_ActionQueue.Clear();
        m_PreviousCoordinator = null;

        //UnityEngine.Debug.Log($"Next phase '{m_CurrentState}'");
        m_CurrentState = state;
        EventHandler.Invoke("OnTurnStateChange", state);

        // Update coordinator queue (If requires input, prioritise)
        foreach (var coordinator in m_Coordinators.OrderBy((c) => c.RequiresRealtimeInput ? 1 : 0))
        {
            m_CoordinatorQueue.Enqueue(coordinator);
        }
    }
Exemplo n.º 6
0
 public void UnregisterCoordinator(TurnCoordinator coordinator)
 {
     Assert.Condition(m_Coordinators.Contains(coordinator));
     m_Coordinators.Remove(coordinator);
 }
Exemplo n.º 7
0
 public void RegisterCoordinator(TurnCoordinator coordinator)
 {
     Assert.Condition(!m_Coordinators.Contains(coordinator));
     m_Coordinators.Add(coordinator);
 }
Exemplo n.º 8
0
 private void Event_OnCoordinatorTurnEnd(TurnCoordinator coordinator)
 {
     m_AttackInteractions.CloseMenu(m_CurrentCoordinator);
     m_CurrentCoordinator = null;
 }
Exemplo n.º 9
0
 private void Event_OnCoordinatorTurnBegin(TurnCoordinator coordinator)
 {
     m_CurrentCoordinator = coordinator as PlayerCoordinator;
 }