示例#1
0
 // Use this for initialization
 void Start()
 {
     pf = GameObject.Find("ScriptTester").GetComponent <Pathfinder>();
     pf.initializePathfinding();
     g  = GameObject.Find("Grid").GetComponent <Grid>();
     au = GameObject.Find("AudioManager").GetComponent <AudioManager>();
     t  = GameObject.Find("ScriptTester").GetComponent <Tactician>();
     // au.playExampleBGM();
     party   = GameObject.Find("ScriptTester").GetComponent <tempscript>().Party;
     enemies = GameObject.Find("ScriptTester").GetComponent <tempscript>().Enemies;
     for (int i = 0; i < party.Count; i++)
     {
         Tile allyTile = null;
         do
         {
             allyTile = g.getTileByRowCol(Random.Range(0, g.Height), Random.Range(0, g.Width));
         } while (allyTile.thisTileTerrType == Tile.terrainType.environment);
         party[i].setCharacterTile(allyTile);
         party[i].name = "Char " + (i + 1);
     }
     for (int i = 0; i < enemies.Count; i++)
     {
         Tile enemyTile = null;
         do
         {
             enemyTile = g.getTileByRowCol(Random.Range(0, g.Height), Random.Range(0, g.Width));
         } while (enemyTile.thisTileTerrType == Tile.terrainType.environment);
         enemies[i].setEnemyTile(g.getTileByRowCol(Random.Range(0, g.Height), Random.Range(0, g.Width)));
         enemies[i].name = "Enemy " + (i + 1);
     }
 }
示例#2
0
    /// <summary>
    /// Class constructor
    /// </summary>
    /// <param name="data">Serialized faction data</param>
    /// <param name="race">Race of the faction</param>
    /// <param name="unitTypes">Faction's unit types: id => unit type</param>
    public Faction(FactionData data, Race race, Dictionary <int, UnitType> unitTypes)
    {
        _data          = data;
        _race          = race;
        _lowercaseName = _data.name.Replace(' ', '_').ToLower() + "_faction";
        _provinces     = new Dictionary <int, Province>();

        // NOTE: here we can differentiate factions by assigning different AIs
        _strategicAI = new Strategos(this);
        _tacticalAI  = new Tactician(_data.level);
    }
示例#3
0
    /// <summary>
    /// Sets up combat participants and parameters
    /// </summary>
    /// <param name="province">Combat location</param>
    /// <param name="attackers">A list of attacking unit stacks</param>
    /// <param name="defenders">A list of defending unit stacks</param>
    /// <param name="isRealCombat">Whether the combat takes place or whether a Strategos simulates it during planning phase</param>
    public Combat(Province province, List <UnitStack> attackers, List <UnitStack> defenders, bool isRealCombat)
    {
        _province  = province;
        _attackers = attackers;
        _defenders = defenders;

        _attackerRollResults = new List <AttackRollResultsCollection>();
        _defenderRollResults = new List <AttackRollResultsCollection>();

        _currentTurn      = 1;
        _currentPhase     = 0;
        _currentSpellType = Spell.SpellType.UNIT_CREATION;

        _isDefenderPC = isRealCombat && province.GetOwnersFaction().IsPC();
        _isAttackerPC = isRealCombat && _attackers[0].GetProvinceToRetreat().GetOwnersFaction().IsPC();

        _attackingTactician = _attackers[0].GetProvinceToRetreat().GetOwnersFaction().GetTactician();
        _defendingTactician = province.GetOwnersFaction().GetTactician();
    }