AddUnit() public method

public AddUnit ( Unit, unit ) : void
unit Unit,
return void
Beispiel #1
0
    void Populate(Alliances alliance, List <Unit> team, List <Tile> openTiles)
    {
        for (int i = 0; i < 6; ++i)
        {
            int  rnd  = UnityEngine.Random.Range(0, openTiles.Count);
            Tile tile = openTiles[rnd];
            openTiles.RemoveAt(rnd);

            int  lvl  = UnityEngine.Random.Range(7, 11);
            Unit unit = alliance == Alliances.Hero ? UnitFactory.CreateHero(lvl) : UnitFactory.CreateMonster(lvl);
            unit.alliance = alliance;
            team.Add(unit);

            unit.Place(tile);
            unit.Dir = (Directions)UnityEngine.Random.Range(0, 4);
            unit.Match();

            SkillSet atk = new SkillSet();
            atk.name = "Attack";
            atk.skills.Add(Resources.Load <Ability>("Abilities/_lightAttack"));
            //	atk.skills.Add(Resources.Load<Ability>("Abilities/_mediumAttack"));
            //	atk.skills.Add(Resources.Load<Ability>("Abilities/_heavyAttack"));
            unit.capability.Add(atk);

            SkillSet temp = new SkillSet();
            temp.name = "Black Magic";
            temp.skills.Add(Resources.Load <Ability>("Abilities/Fire"));
            unit.capability.Add(temp);

            turnController.AddUnit(unit);
        }
    }