// Use this for initialization IEnumerator Start() { playerUnitPanels = new List <PlayerUnitPanel>(); canvas = GetComponentInChildren <Canvas>(); player = transform.root.GetComponent <Player>(); targetManager = player.GetComponentInChildren <TargetManager>(); formationManager = player.GetComponentInChildren <FormationManager>(); dialogManager = player.GetComponentInChildren <DialogManager>(); playerUnitBar = GetComponentInChildren <PlayerUnitBar>(); enemyUnitBar = GetComponentInChildren <EnemyUnitBar>(); selectionIndicator = GetComponentInChildren <SelectionIndicator>(); abilityBar = GetComponentInChildren <AbilityBar>(); // upperBar = GetComponentInChildren<UpperBar>(); generalIndicatorBar = GetComponentInChildren <GeneralIndicatorBar>(); enemyCountBar = GetComponentInChildren <EnemyCountBar>(); unitPanelWrapper = GetComponentInChildren <UnitPanelWrapper>(); animator = GetComponent <Animator>(); if (player && player.human) { while (!animator || !player || !targetManager || !formationManager) { yield return(new WaitForSeconds(0.1f)); } } ResourceManager.StoreSelectBoxItems(selectBoxSkin, healthy, damaged, critical); SetCursorState(CursorState.Select); buildAreaHeight = Screen.height - RESOURCE_BAR_HEIGHT - SELECTION_NAME_HEIGHT - 2 * BUTTON_SPACING; List <AudioClip> sounds = new List <AudioClip>(); List <float> volumes = new List <float>(); sounds.Add(clickSound); volumes.Add(clickVolume); audioElement = new AudioElement(sounds, volumes, "HUD", null); Cursor.lockState = CursorLockMode.Locked; cursorPosition = new Vector3(Screen.width / 2, Screen.height / 2); lastCursorPosition = new Vector3(Screen.width / 2, Screen.height / 2); }
void Awake() { instance = this; }