예제 #1
0
 public void OnEndItemDrag()
 {
     Debug.LogWarning("OnEndItemDrag");
     // Instruct Battle screen to update units highlight
     CoroutineQueueManager.Run(TriggerNewUnitHasBeenActivatedEvent());
     // SetHighlight();
 }
예제 #2
0
    //public bool ActivateNextUnit()
    //{
    //    //Debug.Log("ActivateNextUnit");
    //    canActivate = false;
    //    if (CanContinueBattle())
    //    {
    //        // find next unit, which can act in the battle
    //        PartyUnitUI nextUnitUI = FindNextUnit();
    //        //Debug.Log("Next unit is " + nextUnit);
    //        if (nextUnitUI)
    //        {
    //            // found next unit
    //            // save it for later needs
    //            ActiveUnitUI = nextUnitUI;
    //            // activate it
    //            Queue.Run(NextUnit());
    //            canActivate = true;
    //        }
    //        else
    //        {
    //            // no other units can be activated
    //            // go the next turn
    //            canActivate = StartTurn();
    //        }
    //    }
    //    else
    //    {
    //        Queue.Run(EndBattle());
    //    }
    //    return canActivate;
    //}

    public void ActivateNextUnit()
    {
        //Debug.Log("ActivateNextUnit");
        if (CanContinueBattle())
        {
            // find next unit, which can act in the battle
            PartyUnitUI nextUnitUI = FindNextUnit();
            //Debug.Log("Next unit is " + nextUnit);
            if (nextUnitUI)
            {
                // found next unit
                // activate it
                CoroutineQueueManager.Run(SetNextUnitActive(nextUnitUI));
            }
            else
            {
                // no other units can be activated
                // start next turn
                StartTurn();
            }
        }
        else
        {
            CoroutineQueueManager.Run(EndBattle());
        }
    }
    public void SetActive(UniquePowerModifierData uniquePowerModifierData)
    {
        // save UPM data
        this.uniquePowerModifierData = uniquePowerModifierData;
        // update current duration left value
        UpdateDurationLeftText();
        // get UPM UI config
        UniquePowerModifierConfig uniquePowerModifierConfig = uniquePowerModifierData.GetUniquePowerModifierConfig();

        // update text button colors
        textButton.NormalColor      = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextNormalColor;
        textButton.HighlightedColor = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextHighlightedColor;
        textButton.PressedColor     = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextPressedColor;
        textButton.DisabledColor    = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextDisabledColor;
        // update text current color
        symbolText.color = textButton.NormalColor;
        // update text symbol
        symbolText.text = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.symbol;
        // update background image color
        backgroundImage.color = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconBackgroundColor;
        // activate game object
        gameObject.SetActive(true);
        // Start animation
        CoroutineQueueManager.Run(FadeBackground());
    }
예제 #4
0
 IEnumerator SetNextUnitActive(PartyUnitUI nextUnitUI)
 {
     // save it for later needs
     ActiveUnitUI = nextUnitUI;
     UpdateBattleControlPanelAccordingToUnitPossibilities();
     ExecutePreActivateActions();
     ProcessBuffsAndDebuffs();
     CoroutineQueueManager.Run(ActivateUnit());
     yield return(null);
 }
예제 #5
0
 public void OnWait()
 {
     Debug.Log("OnWait");
     // set unit is waiting status
     ActiveUnitUI.LPartyUnit.UnitStatus = UnitStatus.Waiting;
     // execute wait animation
     CoroutineQueueManager.Run(WaitingAnimation());
     // activate next unit without setting hasMoved flag
     ActivateNextUnit();
 }
예제 #6
0
 public void OnRetreat()
 {
     Debug.Log("OnRetreat");
     // set unit is escaping status
     ActiveUnitUI.LPartyUnit.UnitStatus = UnitStatus.Escaping;
     // execute animation
     CoroutineQueueManager.Run(ReatreatingAnimation());
     // proceed with default post-move actions
     Proceed();
 }
 public void OnUniquePowerModifierHasBeenRemovedEvent(UniquePowerModifierData uniquePowerModifierData)
 {
     // verify if this is the same as this UPM data
     if (uniquePowerModifierData.UniquePowerModifierID == this.uniquePowerModifierData.UniquePowerModifierID)
     {
         // Remove this UPM status icon
         Debug.Log("Remove this UPM status icon");
         // Do it via coroutine and global queue, to make sure that it is removed after all other animation has finished
         CoroutineQueueManager.Run(RemoveThisStatusIcon());
     }
 }
예제 #8
0
    public void ActOnClick()
    {
        Debug.Log("Wait");
        // get battle screen, structure: BattleScreen-CtrlPnlFight-This
        BattleScreen battleScreen = transform.root.GetComponentInChildren <UIManager>().GetComponentInChildren <BattleScreen>();

        // set unit is waiting status
        battleScreen.ActiveUnitUI.LPartyUnit.UnitStatus = UnitStatus.Waiting;
        // execute wait animation
        //battleScreen.Queue.Run(Wait());
        CoroutineQueueManager.Run(Wait());
        // activate next unit
        battleScreen.ActivateNextUnit();
    }
예제 #9
0
 //public virtual void Run(Text text, CoroutineQueue coroutineQueue)
 //{
 //    Debug.Log("Running " + GetType().Name);
 //    // set text color
 //    text.color = textAnimationConfig.textColor;
 //    // fade text over time
 //    coroutineQueue.Run(FadeOutText(text, textAnimationConfig.duration));
 //}
 public virtual void Run(Text text)
 {
     Debug.Log("Running " + textAnimationConfig.name);
     // set text color
     text.color = textAnimationConfig.textColor;
     // fade text over time and
     // pass animation script
     // and coroutine group id parameter for the animation which should be running at he same time whith other animation
     // (example: life drain ability deals damage and heals or magic damage which deals damage to entire party)
     // verify if group id is set
     if (textAnimationConfig.coroutineGroupID != null)
     {
         CoroutineQueueManager.Run(FadeOutText(text, textAnimationConfig.duration), textAnimationConfig.coroutineGroupID.GUID);
     }
     else
     {
         CoroutineQueueManager.Run(FadeOutText(text, textAnimationConfig.duration));
     }
 }
예제 #10
0
    IEnumerator ActivateUnit()
    {
        //Debug.Log("ActivateUnit");
        // Wait while all previously triggered actions are complete
        //while (queueIsActive)
        //{
        //    Debug.Log("Queue is active");
        //    yield return new WaitForSeconds(1f);
        //}
        //// Set Queue is active flag
        //queueIsActive = true;
        UnitStatus unitStatus = ActiveUnitUI.LPartyUnit.UnitStatus;

        switch (unitStatus)
        {
        case UnitStatus.Active:
            // Activate highlights of which cells can or cannot be targeted
            // Trigger event for all required listeners
            CoroutineQueueManager.Run(TriggerNewUnitHasBeenActivatedEvent());
            // SetHighlight();
            // verify if active unit's party panel is AI controlled => faction not equal to player's faction
            if (ActiveUnitUI.GetUnitPartyPanel().IsAIControlled)
            {
                // give control to battle AI
                CoroutineQueueManager.Run(battleAI.Act());
            }
            else
            {
                // wait for user to act
            }
            // canActivate = true;
            break;

        case UnitStatus.Escaping:
            // If there were debuffs applied and unit has survived,
            // then unit may escape now
            // Escape unit
            CoroutineQueueManager.Run(EscapeUnit());
            break;

        case UnitStatus.Dead:
            // This unit can't act any more
            // This can happen here due to applied debuffs
            // Skip post-move actions and Activate next unit
            // canActivate = ActivateNextUnit();
            ActivateNextUnit();
            break;

        case UnitStatus.Waiting:
        case UnitStatus.Escaped:
            Debug.LogError("This status [" + unitStatus.ToString() + "] should not be here.");
            break;

        default:
            Debug.LogError("Unknown unit status " + unitStatus.ToString());
            break;
        }
        // Unblock mouse input
        // InputBlocker inputBlocker = transform.root.Find("MiscUI/InputBlocker").GetComponent<InputBlocker>();
        InputBlocker.SetActive(false);
        Debug.Log("Unit has been activated");
        yield return(null);
    }