public static void UpdateState(ASCII_FPS game, GraphicsDeviceManager graphics) { if (!game.IsActive) { return; } screenWidth = graphics.PreferredBackBufferWidth; screenHeight = graphics.PreferredBackBufferHeight; kbState0 = kbState1; kbState1 = Keyboard.GetState(); gpState0 = gpState1; gpState1 = GamePad.GetState(0); mState = Mouse.GetState(); // TODO: better smoothing algorithm mouseDelta -= mouseDeltaBuffer[mouseDeltaBufferCtr] / mouseDeltaBufferSize; mouseDeltaBuffer[mouseDeltaBufferCtr] = mState.X * 2f / screenWidth - 1f; mouseDelta += mouseDeltaBuffer[mouseDeltaBufferCtr] / mouseDeltaBufferSize; mouseDeltaBufferCtr++; mouseDeltaBufferCtr %= mouseDeltaBufferSize; Mouse.SetPosition(screenWidth / 2, screenHeight / 2); }
public Scene(ASCII_FPS game) { this.game = game; zones = new List <Zone>(); obstacles = new ObstacleSet(); gameObjects = new List <GameObject>(); }
public static Scene Load(BinaryReader reader, ASCII_FPS game) { Scene scene = new Scene(game); scene.Camera = new Camera(0.5f, 1000f, (float)Math.PI / 2.5f, 16f / 9f) { CameraPos = GameSave.ReadVector3(reader), Rotation = reader.ReadSingle() }; scene.ExitRoom = new Point(reader.ReadInt32(), reader.ReadInt32()); int xsize = reader.ReadInt32(); int ysize = reader.ReadInt32(); scene.Visited = new bool[xsize, ysize]; scene.CorridorLayout = new bool[xsize, ysize, 4]; scene.Collectibles = new Collectible.Type?[xsize, ysize]; for (int i = 0; i < xsize; i++) { for (int j = 0; j < ysize; j++) { scene.Visited[i, j] = reader.ReadBoolean(); for (int k = 0; k < 4; k++) { scene.CorridorLayout[i, j, k] = reader.ReadBoolean(); } int type = reader.ReadInt32(); if (type != -1) { scene.Collectibles[i, j] = (Collectible.Type)type; } } } Zone[] zones = Zone.LoadAll(reader); foreach (Zone zone in zones) { scene.AddZone(zone); } int gameObjectsCount = reader.ReadInt32(); for (int i = 0; i < gameObjectsCount; i++) { scene.AddGameObject(GameObject.Load(reader)); } scene.obstacles.Load(reader); return(scene); }
public SceneGeneratorDefault(ASCII_FPS game, int floor) : base(game) { monsterHP = 8f + floor * 2f; monsterDamage = 4f + floor; monstersPerRoom = 4 + (int)Math.Floor(floor / 3.0); float monsterChanceShotgun = floor < 2 ? 0f : 0.3f * (1 - 1 / (0.7f * (floor - 1) + 1f)); float monsterChanceSpinny = floor < 3 ? 0f : 0.1f * (1 - 1 / (0.3f * (floor - 2) + 1f)); float monsterChanceSpooper = floor < 4 ? 0f : 0.2f * (1 - 1 / (0.4f * (floor - 3) + 1f)); monsterChances = new float[] { 1f - monsterChanceShotgun - monsterChanceSpinny - monsterChanceSpooper, monsterChanceShotgun, monsterChanceSpinny, monsterChanceSpooper }; }
public SceneGeneratorIce(ASCII_FPS game, int floor) : base(game) { monsterHP = 8f + floor * 2f; monsterDamage = 4f + floor; monstersPerRoom = 4 + (int)Math.Floor(floor / 3.0); float monsterChanceShotgun = floor < 2 ? 0f : 0.3f * (1 - 1 / (0.7f * (floor - 1) + 1f)); float monsterChanceSpinny = floor < 3 ? 0f : 0.1f * (1 - 1 / (0.3f * (floor - 2) + 1f)); float monsterChanceSpooper = floor < 4 ? 0f : 0.2f * (1 - 1 / (0.4f * (floor - 3) + 1f)); float iceShotgunChance = Math.Clamp((floor - 1) / 4 * 0.16f, 0f, 1f); monsterChances = new float[] { 0.5f * (1f - monsterChanceShotgun - monsterChanceSpinny - monsterChanceSpooper), 0.5f * (1f - monsterChanceShotgun - monsterChanceSpinny - monsterChanceSpooper), (1 - iceShotgunChance) * monsterChanceShotgun, iceShotgunChance *monsterChanceShotgun, monsterChanceSpinny, monsterChanceSpooper }; }
public PlayerLogic(ASCII_FPS game) { this.game = game; }
public HUD(ASCII_FPS game, Console console) { this.console = console; this.game = game; Scene = null; }
public SceneGenerator(ASCII_FPS game) { this.game = game; rand = new Random(); }
public static Generator JungleBushes(ASCII_FPS game, Random rng, float monsterChance) => (Scene scene, Zone zone, Vector3 roomCenter) => { new List <(int, int)> { (-1, -1), (-1, 1), (1, -1), (1, 1) } .ForEach(((int, int)p) =>