private void Awake() { // color nest var renderers = _nestGO.GetComponentsInChildren <Renderer>(); for (int i = 0; i < renderers.Length; i++) { if (renderers[i].GetComponent <ParticleSystem>() == null) { renderers[i].material.color = _color; } } // setup nest reference _nest = _nestGO.GetComponent <NestStructure>(); _nest.controller = this; }
private void Awake() { _entityPools = new Dictionary <UnitType, UnitPool>(new UnitTypeComparer()) { { UnitType.Harvester, new UnitPool(_harvesterPrefab, this.gameObject, _initialInstanceCount) }, { UnitType.Blaster, new UnitPool(_blasterPrefab, this.gameObject, _initialInstanceCount) }, { UnitType.Warrior, new UnitPool(_warriorPrefab, this.gameObject, _initialInstanceCount) } }; _units = new List <UnitBase>(_initialInstanceCount); var nests = FindObjectsOfType <NestStructure>(); for (int i = 0; i < nests.Length; i++) { if (ReferenceEquals(nests[i], this)) { continue; } this.enemyNest = nests[i]; break; } }
/// <summary> /// Determines whether the specified nest is allied. /// </summary> /// <param name="nest">The nest.</param> /// <returns><c>true</c> if the other nest is allied; otherwise, <c>false</c>.</returns> public bool IsAllied(NestStructure nest) { return(ReferenceEquals(this.nest, nest)); }