private void AddIndicator(Indicator indicator) { if (_indicators.ContainsKey(indicator)) { _indicators[indicator].gameObject.SetActive(true); } else { IndicatorUI indicatorUI = Instantiate(indicator.IndicatorUIPrefab, _indicatorsParent); indicatorUI.SetIndicator(indicator); _indicators.Add(indicator, indicatorUI); } }
void Start() { this.enemyType = enemy.type; this.timer = this.delay + 1.5f; //allow time for indicator this.indicatorCopy = Instantiate(indicator.gameObject).GetComponent <IndicatorUI>(); if (this.side == Side.BOTTOM || this.side == Side.TOP) { offset = this.transform.position.x; } else { offset = this.transform.position.y; } indicatorCopy.gameObject.SetActive(false); indicatorCopy.GetComponent <RectTransform>().SetParent(GameObject.Find("Canvas").transform); indicatorCopy.Init(this.enemy, this.side, offset); Signals.Get <SpawningSignal>().Dispatch(enemy.GetComponent <Enemy>().type); }