示例#1
0
        public void FinishSting(int enemyDamage, GameObject target, bool autoKill = false)
        {
            EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>();

            targetEB.ApplyDamage(-Math.Abs(enemyDamage));
            if (autoKill)
            {
                targetEB.EnemyDefeated();
            }
        }
示例#2
0
        void Start()
        {
            lm      = FindObjectOfType <LevelManager>();
            eb      = GetComponent <EnemyBehaviour>();
            hm      = FindObjectOfType <HiveManager>();
            ebFound = eb != null;

            if (!ebFound)
            {
                eb      = GetComponentInParent <EnemyBehaviour>();
                ebFound = eb != null;
            }
        }
示例#3
0
        // 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();
        }
示例#4
0
 private void Start() => enemy = GetComponent <EnemyBehaviour>();
示例#5
0
        /// <summary>
        /// Выбираются рендомные данные врага из заданных в конфигурации
        /// </summary>
        /// <param name="enemyBehaviour">враг</param>
        private void ChooseRandomEnemyData(EnemyBehaviour enemyBehaviour)
        {
            var enemyType = Probability.NextInProbabilityList(spawnTypeProbability, (sp) => sp.spawnProbability);

            enemyBehaviour.UpdateData(enemyType.enemyType, enemyTarget);
        }
示例#6
0
 /// <summary>
 /// Инициализация врага. Задается позиция и данные врага
 /// </summary>
 /// <param name="obj">враг</param>
 private void InitEnemy(EnemyBehaviour obj)
 {
     ChooseRandomEnemyPosition(obj);
     ChooseRandomEnemyData(obj);
 }
示例#7
0
 /// <summary>
 /// Определяет рендомную точку спауна для врага
 /// </summary>
 /// <param name="enemy">враг</param>
 private void ChooseRandomEnemyPosition(EnemyBehaviour enemy)
 {
     enemy.transform.position = Probability.NextRandomInList(_spawnPoints);
 }