示例#1
0
        private void ProcessEngagement(EnemyEntity enemyEntity)
        {
            var engagedHeroData = _leadingEntity.EntityData;
            var enemyData       = enemyEntity.EntityData;

            CombatHandler.AttackTarget(engagedHeroData, enemyData);

            if (enemyData.HealthPoint > 0)
            {
                CombatHandler.AttackTarget(enemyData, engagedHeroData);
                if (engagedHeroData.HealthPoint <= 0)
                {
                    RemoveCurrentHero();
                    if (_heroInCaravans.Count <= 0)
                    {
                        TriggerGameOver();
                        PauseCaravan();
                    }
                }
            }
            else
            {
                Signaler.Instance.Broadcast(this, new EnemyKilled {
                    HeroesInCaravan = _heroInCaravans
                });
                _levelGrid.RemoveEnemyFromPosition(_currentPositionOnGrid);
                _enemySpawner.RemoveEnemyEntityFromGridPos(_currentPositionOnGrid);
                Destroy(enemyEntity.gameObject);

                _moveTimerMax -= _increaseSpeedStep;
                _moveTimerMax  = Mathf.Clamp(_moveTimerMax, _minimumTimerMax, float.MaxValue);
            }
        }