// caching private void Awake() { _playerInput = GetComponent <PlayerInput>(); _playerHealth = GetComponent <Health>(); _controller = GetComponent <CharacterController>(); _abilityScript = GetComponent <AbilityLoadout>(); _camTransform = Camera.main.transform; }
/// <summary> /// Returns the cooldown in milliseconds for a given ability, after applying cooldown reduction. /// </summary> protected int GetCooldownForAbility(AbilityKey ability) { AbilityLoadout abilities = GameState.ActivePlayer.Abilities; ChampionCosts costs = ChampionInfo.Costs; float cdr = GameState.ActivePlayer.Stats.CooldownReduction; return(ability switch { AbilityKey.Q => (int)(costs.Q_Cooldown[abilities.Q_Level - 1] * (1 - cdr)), AbilityKey.W => (int)(costs.W_Cooldown[abilities.W_Level - 1] * (1 - cdr)), AbilityKey.E => (int)(costs.E_Cooldown[abilities.E_Level - 1] * (1 - cdr)), AbilityKey.R => (int)(costs.R_Cooldown[abilities.R_Level - 1] * (1 - cdr)), _ => 0, });
private void Start() { abilityLoadout = GameObject.Find("Player").GetComponent <AbilityLoadout>(); }
private void Awake() { _animator = GetComponent <Animator>(); _movementScript = GetComponent <ThirdPersonMovement>(); // some workflows might have the animator as a child object, so _abilityScript = GetComponent <AbilityLoadout>(); // keep in mind that this might be filled as an inspector reference }
private void Awake() { abilityLoadout = GetComponentInChildren <AbilityLoadout>(); player = GetComponent <Health>(); }
private void Awake() { _movementScript = GetComponent <ThirdPersonMovement>(); _loadoutScript = GetComponent <AbilityLoadout>(); _playerHealth = GetComponent <Health>(); }