예제 #1
0
        public void MoveBoss(Entity boss)
        {
            var hero         = _pool.GetHero();
            var heroPosition = hero.position.Value;

            var pathToHero = _movementCalculator.CalculateMoveToTarget(
                boss.position.Value,
                LocalDirections.ToDirection(boss.rotation.Value),
                heroPosition);

            if (!pathToHero.HasStepsLeft)
            {
                return;
            }

            var nextStep = pathToHero.NextStep();

            if (nextStep.Position != heroPosition)
            {
                if (Debug.isDebugBuild)
                {
                    DrawBossPath(pathToHero);
                }

                boss.ReplacePosition(nextStep.Position);

                var knockedObjectInFront = _pool.KnockObjectsInFront(nextStep.Position, nextStep.Direction, false, 0.4f);
                if (knockedObjectInFront)
                {
                    boss.HasBumpedIntoObject(true);
                }
                else if (_pool.GetTileAt(nextStep.Position + nextStep.Direction) == null)
                {
                    boss.HasRecoveredAtEdge(true);
                }
            }
            else
            {
                boss.IsAttacking(true);
                hero.ReplaceHealth(hero.health.Value - 1);
                _pool.SwitchCurse();
            }

            boss.ReplaceRotation(LocalDirections.ToRotation(nextStep.Direction));
        }
예제 #2
0
 public void Execute(List <Entity> entities)
 {
     _pool.SwitchCurse();
 }