public OutcomeVisualizer(PathVisualizer pathVisualizer) { this.pathVisualizer = pathVisualizer; redHexes = new List <HexEntry>(); rangeIndicators = new List <IUnitController>(); }
void Start() { uiHandler = GameObject.FindGameObjectWithTag("GameController").GetComponent <UIHandler>(); spriteContainerTransform = transform.FindChild("SpriteHolder"); UnitBackground = spriteContainerTransform.FindChild("Background").GetComponent <SpriteRenderer>(); BaseTypeSprite = spriteContainerTransform.FindChild("Base Type").GetComponent <SpriteRenderer>(); BaseTypeSprite.color = Config.Palette.unitIconFill; BaseTypeBorder = BaseTypeSprite.transform.FindChild("Base Type Border").GetComponent <SpriteRenderer>(); BaseTypeBorder.color = Config.Palette.border; WeaponSprite = spriteContainerTransform.FindChild("Weapon").GetComponent <SpriteRenderer>(); WeaponSprite.color = Config.Palette.unitIconFill; WeaponSpriteBorder = WeaponSprite.transform.FindChild("Weapon Border").GetComponent <SpriteRenderer>(); WeaponSpriteBorder.color = Config.Palette.border; Border = spriteContainerTransform.FindChild("Border").GetComponent <SpriteRenderer>(); Border.color = Config.Palette.border; pathVisualizer = uiHandler.GetComponent <PathVisualizer>(); shaking = false; shakeSeed = Random.Range(0.0f, 20000.0f);// So that units do not shake identically flashFadeActive = false; isThisUnitSelected = false; visualizingCombat = false; animatingCombat = false; cursorHovered = false; altButtonDown = false; GameObject healthBarObject = Instantiate(healthBarPrefab, Vector3.zero, Quaternion.identity); healthBarObject.transform.SetParent(GameObject.Find("WorldCanvas").transform); healthBarObject.transform.localScale = Vector3.one; HealthBar = healthBarObject.GetComponent <RectTransform>(); HealthFill = HealthBar.FindChild("HealthFill").GetComponent <RectTransform>(); initialized = true; UnitType = _unitType; WeaponType = _weaponType; PlayerOwner = _playerOwner; VisiblePosition = _visiblePosition; MaxHealthDisplay = _maxHealthDisplay; CurrentHealthDisplay = _currentHealthDisplay; ShowExtraInfo(UnitInfoDisplaySource.CombatAnimation, false);//Technically renders it true if AlwaysDisplayHealthBars is true }