/// <summary> /// Initializes UI elements for the NPC to control. /// </summary> public void InitNpcButtons() { // get npc reference m_npcRef = GetComponent <DAS.NPC>(); // get canvas holding buttons m_buttonCanvas = transform.GetChild(2).GetComponent <Canvas>(); // get button holder UI object. m_buttonHolder = m_buttonCanvas.transform.GetChild(0).GetComponent <RectTransform>(); // get slider holder UI object. m_sliderHolder = transform.GetChild(3).GetComponent <RectTransform>(); // find and get effects manager reference. effectsManager = FindObjectOfType <EffectsManager>(); }
// Use this for initialization void Start() { myMoodImage = GetComponent <Image>(); spriteRef = MoodIconHolder.MyInstance; npcRef = GetComponentInParent <DAS.NPC>(); Debug.Assert(myMoodImage); Debug.Assert(spriteRef); Debug.Assert(npcRef); npcRef.moodVisualizerRef = this; Debug.Assert(npcRef.moodVisualizerRef); myMoodImage.sprite = spriteRef.iconSpriteHappy; //Set default sprites on all sprites. happySprite = spriteRef.iconSpriteHappy; confusedSprite = spriteRef.iconSpriteConfused; sadSprite = spriteRef.iconSpriteSad; alienSprite = spriteRef.iconSpriteAlien; miserableSprite = spriteRef.iconSpriteMiserable; demotivatedSprite = spriteRef.iconSpriteDemotivated; coldSprite = spriteRef.iconSpriteCold; }