// clears the party and loads a new random party. public void generateParty(oldGrid _g, GameObject _player, int _num) { // start from scratch // TODO: Cleanup/reset charList.Clear(); // prep the name list loadNames(); // create character for (int i = 0; i < _num; i++) { // make a character oldCharacter temp = new oldCharacter(); // give it stats temp.initializeRandom(); // put it somewhere temp.worldPos = _g.getRandomTilePos(); // give it a mesh GameObject newP = Instantiate(_player, temp.worldPos, Quaternion.identity); // give it a name newP.name = getRandomName(); // assign relations newP.GetComponent <oldCharacter>().initializeCopy(temp); newP.GetComponent <oldCharacter>().setCharMesh(newP); newP.transform.SetParent(this.transform); // put it in the list charList.Add(newP.GetComponent <oldCharacter>()); } // initiative // TODO: abstract charList.Sort(SortBySpeed); }
public void initializeCopy(oldCharacter _c) { armor = _c.armor; attack = _c.attack; baseArmor = _c.baseArmor; baseAttack = _c.baseAttack; baseSpeed = _c.baseSpeed; hasMoved = _c.hasMoved; hasTakenAction = _c.hasTakenAction; hasTakenDOT = _c.hasTakenDOT; hasTakenStatus = _c.hasTakenStatus; health = _c.health; isDead = _c.isDead; isPlayerControlled = _c.isPlayerControlled; MAX_HEALTH = _c.MAX_HEALTH; speed = _c.speed; worldPos = _c.worldPos; }
// delegate for Sort() static int SortBySpeed(oldCharacter _c1, oldCharacter _c2) { return(_c2.getSpeed().CompareTo(_c1.getSpeed())); }