Beispiel #1
0
            /// <summary>
            /// Starts an encounter.
            /// </summary>
            /// <param name="encounterType">The type of encounter that was engaged.</param>
            /// <param name="fieldSize">The size of the encounter zone.</param>
            /// <param name="units">The units initially engaged in the encounter.</param>
            public void BeginEncounter(EncounterTypes encounterType, AreaOfEffect fieldSize, List <Unit> units)
            {
                encounterActive = true;
                currentRound    = 0;
                this.fieldSize  = fieldSize;
                turnOrder       = CreateTurnOrder(units);
                OrganizeTurnOrder();

                UtilityFunctions.GetActiveUnitDetector().AddIndicatorTiles(fieldSize.GetAllTiles(), TileIndicatorTypes.Encounter);


                foreach (Unit unit in units)
                {
                    Debug.Log(unit.GetType());
                }

                switch (encounterType)
                {
                case EncounterTypes.Advantage:
                    GrantPriorityToAllOfType(TargetTypes.Ally);
                    break;

                case EncounterTypes.Disadvantage:
                    GrantPriorityToAllOfType(TargetTypes.Enemy);
                    break;
                }

                //playerController.inputsDisabled = false;
                //uiController.PushUI(UIScreens.EncounterScreen, true);
                controllerReference.StartCoroutine(EncounterLoop());
            }
Beispiel #2
0
            /// <summary>
            /// Logic for the beginning of an encounter turn.
            /// </summary>
            /// <param name="unitTurn">The <see cref="UnitTurn"/> of the current unit's turn.</param>
            void StartTurn(UnitTurn unitTurn)
            {
                UtilityFunctions.GetActiveUnitDetector()
                .FlagDelegate(DelegateFlags.OnEncounterTurnStart, new TurnStartHookBundle(unitTurn), GetEncounterUnitList());

                unitTurn.isActive     = true;
                currentTurn           = unitTurn;
                currentUnitMoveBounds = new AreaOfEffect(unitTurn.unit.position, 5);
                UtilityFunctions.GetActiveUnitDetector().AddIndicatorTiles(currentUnitMoveBounds.GetAllTiles(), TileIndicatorTypes.Movement);

                Debug.Log(UtilityFunctions.GetUnitName(unitTurn) + ":turn started; waiting");

                if (CanUnitTakeAction(currentTurn))
                {
                    if (unitTurn.unit.GetTargetType() == TargetTypes.Enemy)
                    {
                        //CheckEncounterAI(unitTurn);
                    }
                    else
                    {
                        //playerController.SetPlayerUnit(currentTurn.unit);
                        //uiController.PushUI(UIScreens.EncounterScreen, true);
                    }
                }
                else
                {
                    Debug.Log("due to impairment, unit cannot take action");
                    EndTurn(currentTurn);
                }
            }