public void FinishSting(int enemyDamage, GameObject target, bool autoKill = false) { EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>(); targetEB.ApplyDamage(-Math.Abs(enemyDamage)); if (autoKill) { targetEB.EnemyDefeated(); } }
void Start() { lm = FindObjectOfType <LevelManager>(); eb = GetComponent <EnemyBehaviour>(); hm = FindObjectOfType <HiveManager>(); ebFound = eb != null; if (!ebFound) { eb = GetComponentInParent <EnemyBehaviour>(); ebFound = eb != null; } }
// This can be more fleshed out in future iterations of our game public void FinishSting(int score, int maxScore, GameObject target) { LevelManager lm = FindObjectOfType <LevelManager>(); EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>(); if (targetEB == null) { targetEB = target.GetComponentInParent <EnemyBehaviour>(); } stinging = false; // killing the wasps can definitely be improved upon if (score > maxScore * .9) { Debug.Log("Option1"); lm.IncrementHealth(-minDamage); targetEB.EnemyDefeated(); } else if (score > maxScore * .6) { Debug.Log("Option2"); lm.IncrementHealth(-averageDamage); targetEB.EnemyDefeated(); } else if (score > maxScore * .4) { Debug.Log("Option3"); lm.IncrementHealth(-maxDamage); targetEB.EnemyDefeated(); } else { Debug.Log("Option4"); lm.IncrementHealth(-maxDamage); } stingIndicator.SetActive(false); RearviewCameraBehaviour.RequestRearviewOff(); FindObjectOfType <PlayerControl>().StartBuzzSFX(); }
private void Start() => enemy = GetComponent <EnemyBehaviour>();
/// <summary> /// Выбираются рендомные данные врага из заданных в конфигурации /// </summary> /// <param name="enemyBehaviour">враг</param> private void ChooseRandomEnemyData(EnemyBehaviour enemyBehaviour) { var enemyType = Probability.NextInProbabilityList(spawnTypeProbability, (sp) => sp.spawnProbability); enemyBehaviour.UpdateData(enemyType.enemyType, enemyTarget); }
/// <summary> /// Инициализация врага. Задается позиция и данные врага /// </summary> /// <param name="obj">враг</param> private void InitEnemy(EnemyBehaviour obj) { ChooseRandomEnemyPosition(obj); ChooseRandomEnemyData(obj); }
/// <summary> /// Определяет рендомную точку спауна для врага /// </summary> /// <param name="enemy">враг</param> private void ChooseRandomEnemyPosition(EnemyBehaviour enemy) { enemy.transform.position = Probability.NextRandomInList(_spawnPoints); }