internal static Entity Parse(World w, string p) { switch (p.First()) { case 'H': return Human.Create(w, p.Substring(2)); case 'D': return Door.Create(p.Substring(2)); case 'W': return Workplace.Create(p.Substring(2)); case 'R': return Robot.Create(w, p.Substring(2)); case 'C': return Crate.Create(p.Substring(2)); case 'E': return ExplosiveCrate.Createueue(p.Substring(2)); case 'S': return SentryGun.Create(p.Substring(2)); case 'A': return Camera.Create(p.Substring(2)); case 'I': return Incinerator.Create(p.Substring(2)); default: throw new Exception(); } }
internal static void LinkToNode(World w, string p) { var split = p.Split(':'); w.entities[int.Parse(split[0])].Pathnode = w.Pathnodes[int.Parse(split[1])]; }
public override void Update() { if (RM.IsPressed(InputAction.RestartLevel)) { world = new World(RM.Levels[currentLevel]); } if (!Victorious && !world.editorEnabled && ((world.allowEditor && IM.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.N)) || world.entities.OfType<Human>().All(x => !x.Alive))) { Victorious = true; world.score += (1000 - world.timer / 6); if (world.timer / 60 < 15) { Achievements.Achieve("speedhunt"); } if (world.DarkMode) { Achievements.Achieve("finishdark"); } if (world.killedAtLeast3BeforeAlarm) { Achievements.Achieve("kill3withoutalarm"); } if (world.killedAllAfterAlarm) { Achievements.Achieve("killallafteralarm"); } } if (!paused) { world.Update(); } else { if (RM.IsPressed(InputAction.Accept)) { g.Showscreen(new MainMenuScreen()); } } if (Victorious && RM.IsPressed(InputAction.Accept)) { currentLevel++; if (currentLevel >= RM.Levels.Count) { currentLevel = 0; } world = new World(RM.Levels[currentLevel]); Victorious = false; } if (RM.IsPressed(InputAction.Back)) { paused = !paused; } if (RM.NextMusic.Count <= 0) { if (Victorious) { RM.NextMusic.Enqueue("music4"); RM.NextMusic.Enqueue("music4"); RM.NextMusic.Enqueue("music4"); RM.NextMusic.Enqueue("music3"); } else if (world.IsAlarmRinging) { RM.NextMusic.Enqueue("music3"); RM.NextMusic.Enqueue("music3"); RM.NextMusic.Enqueue("music3"); RM.NextMusic.Enqueue("music4"); } else { RM.NextMusic.Enqueue("music2"); } } // camera.position.Y = island.CheckHeightCollision(camera.position); }
public GameScreen(int level) { camera = new Camera3d(); world = new World(RM.Levels[level]); currentLevel = level; }
public Pathnode(World world) { HudIcons.Add(new HudIcon() { texture = RM.GetTexture("escapeicon"), text = "Evac point", Action = () => EvacPoint = !EvacPoint }); HudIcons.Add(new HudIcon() { texture = RM.GetTexture("deleteicon"), text = "Remove", Action = () => { world.Pathnodes.Remove(this); LinkedNodes.ForEach(l => l.LinkedNodes.Remove(this)); LinkedNodes.Clear(); world.SelectedNode = null; } }); }
internal static Pathnode Create(World w, string p) { var split = p.Split(':'); return new Pathnode(w) { EvacPoint = split[0] == "1", Location = new Vector2(int.Parse(split[1].Split(',')[0]), int.Parse(split[1].Split(',')[1])) }; }