public string GetOffspringDna(GameObject _parentA, GameObject _parentB) { string dnaA = _parentA.GetComponent <PlayerUnit>().stats.dna; string dnaB = _parentB.GetComponent <PlayerUnit>().stats.dna; return(DnaGenerator.CreateDna(dnaA, dnaB)); }
public void SpawnRandomUnit(Vector3 _target) { GameObject newUnit = Instantiate(unitBase, _target, Quaternion.identity); newUnit.GetComponent <PlayerUnit>().Initialize(DnaGenerator.CreateDna(), UnityEngine.Random.Range(18, 30)); AddUnit(newUnit); }