Ejemplo n.º 1
0
        private static bool ResolveUseStairs(UseStairsAction action, EncounterState state)
        {
            var actorPosition = state.GetEntityById(action.ActorId).GetComponent <PositionComponent>().EncounterPosition;
            var stairs        = state.EntitiesAtPosition(actorPosition.X, actorPosition.Y)
                                .FirstOrDefault(e => e.GetComponent <StairsComponent>() != null);

            if (stairs != null)
            {
                state.ResetStateForNewLevel(state.Player, state.DungeonLevel + 1);
                state.WriteToFile();
                return(true);
            }
            else
            {
                state.LogMessage("No jump point found!", failed: true);
                return(false);
            }
        }