Ejemplo n.º 1
0
        protected override void Awake()
        {
            base.Awake();

            Astral.onClick.AddListener(OnAstralClick);
            Darkness.onClick.AddListener(OnDarknessClick);
            Ice.onClick.AddListener(OnIceClick);
            Iron.onClick.AddListener(OnIronClick);
            Storm.onClick.AddListener(OnStormClick);
            Nature.onClick.AddListener(OnNatureClick);
            Fire.onClick.AddListener(OnFireClick);

            astralLevel   = Astral.GetComponentInChildren <TextMeshProUGUI>();
            darknessLevel = Darkness.GetComponentInChildren <TextMeshProUGUI>();
            iceLevel      = Ice.GetComponentInChildren <TextMeshProUGUI>();
            ironLevel     = Iron.GetComponentInChildren <TextMeshProUGUI>();
            stormLevel    = Storm.GetComponentInChildren <TextMeshProUGUI>();
            natureLevel   = Nature.GetComponentInChildren <TextMeshProUGUI>();
            fireLevel     = Fire.GetComponentInChildren <TextMeshProUGUI>();

            void OnAstralClick() => Owner.ElementSystem.LearnElement((int)ElementType.Astral);
            void OnDarknessClick() => Owner.ElementSystem.LearnElement((int)ElementType.Darkness);
            void OnIceClick() => Owner.ElementSystem.LearnElement((int)ElementType.Ice);
            void OnIronClick() => Owner.ElementSystem.LearnElement((int)ElementType.Iron);
            void OnStormClick() => Owner.ElementSystem.LearnElement((int)ElementType.Storm);
            void OnNatureClick() => Owner.ElementSystem.LearnElement((int)ElementType.Nature);
            void OnFireClick() => Owner.ElementSystem.LearnElement((int)ElementType.Fire);

            Buttons = new Button[] { Astral, Darkness, Ice, Iron, Storm, Nature, Fire };
        }