Ejemplo n.º 1
0
        /// <summary>
        /// Create a new Unit and initialize default equipment and weapons
        /// </summary>
        public Unit CreateNewUnit(string unitUID, string characterUID, CombatantFactionEnum faction)
        {
            UnitVO      unitVO = metadataMap.GetVO <UnitVO>(unitUID);
            CharacterVO charVO = metadataMap.GetVO <CharacterVO>(characterUID);

            List <Equipment> defaultEquipment = GetEquipmentListFromUIDs(unitVO.equipmentUIDs);

            List <Equipment> defaultWeapons = GetEquipmentListFromUIDs(unitVO.weaponsUIDs);

            Unit unit = new Unit(unitVO, charVO, faction, defaultEquipment, defaultWeapons);

            return(unit);
        }
        public void StartEncounter(List <Unit> playerUnits, List <Unit> enemyUnits, List <Unit> neutralUnits)
        {
            // Initialize a new encounter
            CurrentEncounter              = new EncounterData();
            CurrentEncounter.PlayerUnits  = playerUnits;
            CurrentEncounter.EnemyUnits   = enemyUnits;
            CurrentEncounter.NeutralUnits = neutralUnits;

            // Set the current turn to -1
            CurrentTurn = -1;

            // Set the player to move first since the player always moves first
            CurrentFaction = CombatantFactionEnum.Neutral;
            GoToNextStep();
        }
Ejemplo n.º 3
0
        public Unit(
            UnitVO vo,
            CharacterVO pilot,
            CombatantFactionEnum faction,
            List <Equipment> equipment,
            List <Equipment> weapons)
        {
            this.vo = vo;

            this.pilot   = pilot;
            this.faction = faction;

            // Initialize the unit with max supplies
            hp   = vo.hp;
            ammo = vo.ammo;
            fuel = vo.fuel;

            this.equipment = equipment;
            this.weapons   = weapons;
        }
Ejemplo n.º 4
0
        public void BeginFactionTurn(CombatantFactionEnum faction)
        {
            // At the beginning of the turn copy over the remaining units to the pending list

            UnitsPendingAction.Clear();

            switch (faction)
            {
            case CombatantFactionEnum.Player:
                UnitsPendingAction.AddRange(PlayerUnits);
                break;

            case CombatantFactionEnum.Enemy:
                UnitsPendingAction.AddRange(EnemyUnits);
                break;

            case CombatantFactionEnum.Neutral:
                UnitsPendingAction.AddRange(EnemyUnits);
                break;
            }

            AddLog(faction.ToString() + " Time to ACT!");
        }
        /// <summary>
        /// Goes to the next faction in the sequence.
        ///
        /// Player --> Enemy --> Neutral
        ///
        /// After the neutral faction is done then the turn is done
        /// </summary>
        public void GoToNextStep()
        {
            // TODO: Make an FSM to handle this
            switch (CurrentFaction)
            {
            case CombatantFactionEnum.Player:
                CurrentFaction = CombatantFactionEnum.Enemy;
                break;

            case CombatantFactionEnum.Enemy:
                CurrentFaction = CombatantFactionEnum.Neutral;
                break;

            case CombatantFactionEnum.Neutral:
                CurrentFaction = CombatantFactionEnum.Player;
                CurrentTurn++;

                CurrentEncounter.AddLog("TURN: " + CurrentTurn);
                break;
            }

            CurrentEncounter.BeginFactionTurn(CurrentFaction);
        }