public Cubicle(float x, float y, int width, int height, Game1 game, Direction orientation, Texture2D texture) { this.width = width; this.height = height; this.game = game; this.orientation = orientation; this.texture = texture; this.walls = new Wall[3]; if (orientation == Direction.North) { walls[0] = new Wall(texture, null, new Vector2(x, y), Direction.North, false, false, 10, height); walls[1] = new Wall(texture, null, new Vector2(x, y + height), Direction.East, false, false, width + 10, 10); walls[2] = new Wall(texture, null, new Vector2(x + width, y), Direction.North, false, false, 10, height); } else if (orientation == Direction.South) { walls[0] = new Wall(texture, null, new Vector2(x, y + 10), Direction.South, false, false, 10, height); walls[1] = new Wall(texture, null, new Vector2(x, y), Direction.East, false, false, width + 10, 10); walls[2] = new Wall(texture, null, new Vector2(x + width, y + 10F), Direction.South, false, false, 10, height); } else if (orientation == Direction.West) { walls[0] = new Wall(texture, null, new Vector2(x, y), Direction.West, false, false, height, 10); walls[1] = new Wall(texture, null, new Vector2(x + height, y), Direction.South, false, false, 10, width + 10); walls[2] = new Wall(texture, null, new Vector2(x, y + width), Direction.West, false, false, height, 10); } else { walls[0] = new Wall(texture, null, new Vector2(x + 10, y), Direction.East, false, false, height, 10); walls[1] = new Wall(texture, null, new Vector2(x, y), Direction.South, false, false, 10, height + 10); walls[2] = new Wall(texture, null, new Vector2(x + 10, y + height), Direction.East, false, false, height, 10); } this.objects = new List<GameObject>(); }
public AIPath(Npc npc, Game1 game, int[] path, int[] delays, Direction[] directions) { this.npc = npc; this.player = game.getPlayer(); this.collisionManager = game.getInputManager().getCollisionManager(); this.path = path; this.delays = delays; this.directions = directions; }
public Npc(Game1 game, Texture2D texture, Texture2D sight, Vector2 location, SoundEffectInstance effect, Direction direction, NpcDefinition def, int[] offsets, int maxHealth, int velocity, int radius, int reactTime, bool wander) : base(texture, location, effect, direction, maxHealth, velocity) { this.game = game; this.def = def; this.offsets = offsets; this.radius = radius; this.reactTime = reactTime; this.wander = wander; this.sight = sight; this.origin = new Vector2(texture.Width / 2F, texture.Height / 2F); this.origLoc = new Vector2((int) location.X, (int) location.Y); this.origDir = direction; this.origVel = velocity; }
public InputManager(Game1 game, Player player, Level level, Target target, PlayerManager playerManager, Screen[] screens, MindRead mindRead) { this.game = game; this.player = player; this.level = level; this.target = target; this.playerManager = playerManager; this.mindRead = mindRead; this.collisionManager = new CollisionManager(player, level); this.velocity = player.getVelocity(); this.width = game.getWidth(); this.height = game.getHeight() - 40; this.font = game.getDropFont(); this.gameState = GameState.Normal; this.prevLevel = level; }
public Level(Game1 game, Player player, Texture2D map, Npc[] npcs, GameObject[] objects, int index) { this.game = game; this.player = player; this.map = map; this.npcs = new List<Npc>(npcs.Length); this.npcs.AddRange(npcs); this.deadNpcs = new List<Npc>(npcs.Length); this.objects = new List<GameObject>(objects.Length); this.objects.AddRange(objects); this.tokens = new List<Token>(); this.doors = new List<Door>(); this.keys = new List<Key>(); this.barriers = new List<Barrier>(); this.walls = new List<Wall>(); this.pressButtons = new List<PressButton>(); this.pits = new List<Pit>(); this.sortObjects(); this.cubicles = new List<Cubicle>(); this.active = true; this.projectiles = new List<Projectile>(); this.index = index; this.takenCollectibles = new List<Collectible>(); }
static void Main() { using (var game = new Game1()) { game.Run(); } }
public Npc(Game1 game, Texture2D texture, Texture2D sight, Vector2 location, SoundEffectInstance effect, Direction direction, NpcDefinition def, int radius, int reactTime) : this(game, texture, sight, location, effect, direction, def, new int[0], radius, 10, false) { }
public Npc(Game1 game, Texture2D texture, Texture2D sight, Vector2 location, SoundEffectInstance effect, Direction direction, NpcDefinition def, int[] offsets, int radius, int reactTime, bool wander) : this(game, texture, sight, location, effect, direction, def, offsets, 100, 3, radius, 10, wander) { }
/// <summary> /// Returns whether or not the game object is currently on the screen /// </summary> /// <param name="game">The game instance to check its viewport bounds</param> /// <returns>Returns true if the game object is currently on the screen; otherwise, false</returns> public bool isOnScreen(Game1 game) { return location.X >= -texture.Width && location.X <= game.getWidth() && location.Y >= -texture.Height && location.Y <= game.getHeight() - 40; }
/// <summary> /// Updates the projectile's direction, position, bounds, and active status /// </summary> /// <param name="game">The game instance</param> /// <param name="entity">The entity to inherit direction from</param> public void update(Game1 game, Entity entity) { if (direction == Direction.None) { direction = entity.getDirection(); rotate(); } if (direction == Direction.North) { deriveY(-velocity); } else if (direction == Direction.South) { deriveY(velocity); } else if (direction == Direction.West) { deriveX(-velocity); } else if (direction == Direction.East) { deriveX(velocity); } rotation += rotationSpeed; active = isOnScreen(game); }