public GameObject Spawn() { Vector3 spawnPosition = foodSource.transform.position + Random.onUnitSphere * 2f; GameObject unit = MonoBehaviour.Instantiate(unitPrefab, spawnPosition, unitPrefab.transform.rotation); unit.transform.parent = GameManager.gameManager.units.transform; Unit unitComponent = unit.GetComponent <Unit>(); unitComponent.speciesName = speciesName; UpdateUnit(unitComponent); UnitActions.DisableSelectionGraphic(unitComponent); //if (unitComponent.CompareTag("Preview")) // GameManager.gameManager.previewUnitList.Add(unitComponent); if (unitComponent.CompareTag("Pet")) { GameManager.gameManager.petList.Add(unitComponent); } else if (unitComponent.CompareTag("Hostile")) { GameManager.gameManager.enemyList.Add(unitComponent); } return(unit); }
public void DeselectUnit() { unitInfoPanel.Hide(); UnitActions.DisableSelectionGraphic(selectedUnit); //UnitActions.DisableAllSelectionGraphics(); selectedUnit = null; }