public static void Main() { // by only changing this instance of AbstractUnitFactory to another - all the code will continue to work AbstractUnitFactory unitFactory = new ZergUnitFactory(); // AbstractUnitFactory unitFactory = new TerranUnitFactory(); GathererUnit gatherer = unitFactory.GetGatherer(); FighterUnit fighter = unitFactory.GetFighter(); FlyingUnit flyer = unitFactory.GetFlyer(); gatherer.Gather(); fighter.Engage(); flyer.Fly(); }
private void Awake() { state = State.Idle; manager = FindObjectOfType <GameManager>(); extractorList = new List <Extractor>(); storageNodeList = new List <StorageNode>(); unit = GetComponent <GathererUnit>(); inventoryText = gameObject.GetComponentInChildren <TextMesh>(); inventorySpace = 50; UpdateInventoryText(); gathererUI = this.GetComponent <GathererUI>(); GameManager.OnExtractorDemolishListeners += RemoveExtractorFromPlan; GameManager.OnStorageDemolishListeners += RemoveStorageFromPlan; }