Esempio n. 1
0
    void ProcessCombat()
    {
        if (!bCombatStarted)
        {
        }
        else
        {
            if (bActionInProgress && bFighterInInitialPosition)
            {
                if (!waitedOneFrame)
                {
                    waitedOneFrame = true;
                }
                else
                {
                    ActionEnded();
                    waitedOneFrame = false;
                }
            }

            if (!bTurnInProgress && !fighterMouvementManager.bMoveFighterJoiningToPosition)
            {
                if (protoScript != null)
                {
                    if (protoScript.combat != null)
                    {
                        protoScript.combat.NextTurn();
                    }
                }

                currentFighter = GetNextFighter();


                actionLaunched = false;
                actionWheel.SetFighter(currentFighter);

                if (currentFighter.eCreatureType == CreatureType.Monster)
                {
                    // actionWheel.SetAction(ActionType.FEAR, ((GroupHumanFighter)humanGroupFighter).bCanBeFeared);
                    // actionWheel.SetAction(ActionType.TALK, ((GroupHumanFighter)humanGroupFighter).bCanListen);
                }

                currentGroupLogic = GetGroupLogicOfFighter(currentFighter);
                bTurnInProgress   = true;
                targetChoosed     = null;
                PutFighterInFightPosition();
            }
            else if (!bActionInProgress && bFighterInFightPosition)
            {
                if (currentGroupLogic.GetLogicType() == LogicType.IA)
                {
                    if (!bActionChoosed)
                    {
                        if (protoScript != null && protoScript.combat != null && protoScript.combat.currentTurn != null)
                        {
                            actionChoosed = ActionType.GetActionTypeWithID(protoScript.combat.currentTurn.ActionCode);
                        }
                        else
                        {
                            actionChoosed = ((GroupIA)currentGroupLogic).SelectAction(monsterGroupFighter.lFighters, humanGroupFighter.lFighters);
                        }

                        bActionChoosed = true;

                        if (actionChoosed.GetTargetType() == ActionType.ActionTargetType.OneTarget)
                        {
                            bActionRequireTarget = true;
                        }
                        else
                        {
                            bActionRequireTarget = false;
                        }
                    }
                    else if (bActionRequireTarget && !bTargetChoosed)
                    {
                        targetChoosed  = ((GroupIA)currentGroupLogic).SelectTarget(monsterGroupFighter.lFighters, humanGroupFighter.lFighters);
                        bTargetChoosed = true;
                    }
                    else
                    {
                        // Current Fighter perform action on target
                        PerformAction();
                    }
                }
                else  // If LogicType = Player
                {
                    if (!bActionChoosed)
                    {
                        if (currentFighter.eCreatureType == CreatureType.Monster)
                        {
                            if (((Monster)currentFighter).isBoss)
                            {
                                actionChoosed  = ActionType.FEAR;
                                bActionChoosed = true;


                                AkSoundEngine.PostEvent("Play_" + currentFighter.sName + "Fear", gameObject);
                            }
                        }
                        // Choose action
                    }
                    else if (bActionRequireTarget && !bTargetChoosed)
                    {
                        // Chose Target
                    }
                    else
                    {
                        // Current Fighter perform action on target
                        // Debug.Log("Action in progress player");
                        PerformAction();
                    }
                }
            }
        }
    }