/// <summary> /// Called on start. Assign some variables and find the gamestate, the cooldownoverlay and the audiosource. /// </summary> public void Start() { spellName = GetSpellname(); cooldown = GetCooldown(); manaCost = GetManacost(); castTime = GetCastTime(); castSound = Resources.Load(GetCastSoundName(), typeof(AudioClip)) as AudioClip; impactSound = Resources.Load(GetImpactSoundName(), typeof(AudioClip)) as AudioClip; gamestate = Gamestate.gamestate; cooldownOverlay = GetComponentInChildren <Image>(); cooldownOverlay.color = new Color32(160, 160, 160, 160); cooldownOverlay.enabled = false; gamestate.AddSpell(this); cooldownTimer = cooldown; source = GetComponent <AudioSource>(); }