public void InitializeAttack() { _cooldownTimer = 0; _aimColor = aimLeftSpriteRenderer.color; enemyMovement = GetComponent <EnemyMovement>(); state = State.Moving; HideAim(); if (GetComponent <IRangedAttackType>() != null) { // TODO : Might not need this enemyType = GetComponent <IRangedAttackType>().GetAttackType(); } playerPosition = enemyMovement.FindNearestPlayer(); Timing.RunCoroutine(AttackSignal().CancelWith(gameObject)); }
private static string GetRangedEnemyNameFromMovementProbability(SpawnData spawnData, EnemyType.RangedEnemyType enemyType) { RangedMovement rangedMovement = spawnData.RangedMovementProbability.rangedProbabilities.Find(movement => movement.enemyType == enemyType); RangedEnemyTypeToNameContainer nameContainer = spawnData.NameContainer.rangedEnemyTypeToNameContainer.Find(container => container.rangedEnemyType == enemyType); float randomValue = Random.value; string enemyName = randomValue < rangedMovement.rushChance ? nameContainer.rangedEnemyNames[0] : nameContainer.rangedEnemyNames[1]; return(enemyName); }