public void Initialize(Unit unit) { Id = Guid.NewGuid(); isPlayerControlled = unit.IsHumanPlayer; if (unit.IsHumanPlayer) { StatHelper.InitializePlayerStats(stats); } else { StatHelper.InitializeCreatureStats(stats); } StatHelper.InitializeSpeedRates(speedRates); SpellHistory = new SpellHistory(); GlobalCooldown = new Cooldown(1); SpellCast = new SpellCast(); Buffs = new Buffs(unit); Spells = new SpellStorage(); PreviousTargets = new List <Guid>(); PeriodicEffects = new List <PeriodicEffectAura>(); AbsorbEffects = new List <AbsorbEffect>(); CharacterEvents = new Dictionary <int, List <SpellScriptAura> >(); for (int i = 0; i < CharacterEventTypes.Count; i++) { CharacterEvents.Add(i, new List <SpellScriptAura>()); } }
public void Dispose() { target = null; health = null; mainResourse = null; parameters = null; states = null; GlobalCooldown.Dispose(); GlobalCooldown = null; SpellCast.Dispose(); SpellCast = null; Buffs.Dispose(); Buffs = null; Spells.Dispose(); Spells = null; AbsorbEffects.Clear(); AbsorbEffects = null; PeriodicEffects.Clear(); PeriodicEffects = null; PreviousTargets.Clear(); PreviousTargets = null; for (int i = 0; i < CharacterEventTypes.Count; i++) { CharacterEvents[i].Clear(); } CharacterEvents.Clear(); CharacterEvents = null; }
/// <summary> /// Defines some default values on the start of the game /// </summary> void Start() { this.spells = this.GetComponent <SpellStorage>(); this.state = MagicSystemState.ElementSelection; this.castIndicator.gameObject.SetActive(false); }