private void Attack(AttackType inAttack) { if (AttackType.None == inAttack) { return; } PlayerAttackIndex index = _playerControllerScript.ConvertAttackTypeToPlayerAttackIndex(inAttack); if (PlayerAttackIndex.None == index) { return; } Attack attack = _playerControllerScript.GetAttackAt(index); if (AttackType.Super == inAttack) { int x = 1; } if (null == attack) { return; } if (null != _playerControllerScript.CurrentEnemy && _playerControllerScript.CurrentEnemy.Dead) { _playerControllerScript.CurrentEnemy = null; } if (null == _playerControllerScript.CurrentEnemy) { GameObject target = _playerControllerScript.GetNearestEnemyInRange(); if (null == target) { return; } _playerControllerScript.CurrentEnemy = target.GetComponent <EnemyController>(); _playerControllerScript.CurrentEnemy.Targetted(_playerControllerScript); } attack.DoAttack(_playerControllerScript.CurrentEnemy); if (AttackType.Super != inAttack) { UpdateSuperBar(inAttack); } else { ResetSuperBar(); } }
private void UpdateSuperBar(AttackType inAttack) { if (AttackType.None == inAttack) { return; } PlayerAttackIndex index = _playerControllerScript.ConvertAttackTypeToPlayerAttackIndex(inAttack); if (PlayerAttackIndex.None == index) { return; } Attack attack = _playerControllerScript.GetAttackAt(index); if (null == attack || 0 == attack.AttackInfo.SuperBarValue) { return; } IncrementSuperBar(attack.AttackInfo.SuperBarValue); }
public Attack GetAttackAt(PlayerAttackIndex index) { return(Attacks[(int)index]); }