public BlinkAbility(GameObject player, Stat[] attributes) : base(player, attributes) { BlinkDistanceStat distanceStat = (BlinkDistanceStat)Attributes[0]; BlinkChargesStat chargeStat = (BlinkChargesStat)Attributes[1]; chargeStat.Apply(this); distanceStat.Apply(this); Cooldown = 5f; _character = player.GetComponent <CharacterBehaviour>(); _playerMono = player.GetComponent <MonoBehaviour>(); }
// --- End Singleton Pattern public void ApplyNewCharacterStats(GameObject character, string name, CharacterTypes type) { CharacterBehaviour behaviour = character.GetComponent <CharacterBehaviour>(); CharacterLoadout loadout = character.GetComponent <CharacterLoadout>(); if (type == CharacterTypes.Munch) { behaviour.Name = name; behaviour.Level = 1; behaviour.Experience = 0; behaviour.Id = System.Guid.NewGuid().ToString(); loadout.moveSpeedStat = new MoveSpeedStat(1); BlinkDistanceStat blinkDistanceStat = new BlinkDistanceStat(1); BlinkChargesStat blinkChargesStat = new BlinkChargesStat(1); loadout.Ability1 = new BlinkAbility(character, new Stat[] { blinkDistanceStat, blinkChargesStat }); loadout.Ability2 = new ReviveProjectileAbility(character, new Stat[] { }); } else { throw new UnityException($"Unknown type of character {type}"); } loadout.Init(); }