//KONSTRUKTORN SOM HÅLLER DE VÄRDEN SOM SKALL SPARAS public Save(Player a_player, StateHandler a_stateHandler, Levels a_levels, Model a_model) { m_model = a_model; m_player = a_player; m_stateHandler = a_stateHandler; m_levels = a_levels; }
public Model(Player a_player, StateHandler a_stateHandler, Levels a_levels, Enemy a_enemy, EnemyBolt a_enemyBolt) { m_enemy = new List<Enemy>(); m_boltEnemy = new List<EnemyBolt>(); m_player = a_player; m_stateHandler = a_stateHandler; m_levels = a_levels; m_modelEnemy = a_enemy; m_modelEnemyBolt = a_enemyBolt; // m_view = new View.View(a_manager, a_contentLoader, a_graphics); m_save = new Save(m_player, m_stateHandler, m_levels, this); SetEnemies(); // m_view = a_view; }
public bool IsCollidingAtEnemy(Vector2 a_newPos, Vector2 a_size, Player a_player) { float playerRadius = 0.75f; float enemyRadius = 1.5f; Vector2 topLeft = new Vector2(a_newPos.X, a_newPos.Y - a_size.Y); Vector2 bottomRight = new Vector2(a_newPos.X, a_newPos.Y); //Vector2 topLeft = new Vector2(a_newPos.X - a_size.X / 2.0f, a_newPos.Y - a_size.Y); //Vector2 bottomRight = new Vector2(a_newPos.X + a_size.X / 2.0f, a_newPos.Y); /* Enemy enemy; enemy = new Enemy(); BoundingSphere enemySphere = new BoundingSphere(); BoundingSphere playerSphere = new BoundingSphere(new Vector3(a_player.GetPosition().X, a_player.GetPosition().Y - a_player.GetSize().Y / 2, 0), playerRadius); for (int i = 0; i < enemyPosition.Count; i++) { if (m_enemy != null) { enemySphere = new BoundingSphere(new Vector3(m_enemy[i].GetPosition().X + 0.5f, m_enemy[i].GetPosition().Y, 0), enemyRadius); if (playerSphere.Intersects(enemySphere)) { return true; } } } return false; }*/ for (int x = 0; x < g_levelWidth; x++) { for (int y = 0; y < g_levelHeight; y++) { if (bottomRight.X < (float)x) continue; if (bottomRight.Y < (float)y) continue; if (topLeft.X > (float)x + 1.1f) continue; if (topLeft.Y > (float)y + 1.0f) continue; if (m_tiles[x, y] == Tile.T_RUSHINGENEMY || m_tiles2[x,y] == TileLevel2.T_RUSHINGENEMY || m_tiles3[x,y] == TileLevel3.T_RUSHINGENEMY) { return true; } } } return false; }
public PlayerLevelStatsSave(Player a_player) { m_player = a_player; }
internal void DoSave(Player a_player, StateHandler a_stateHandler, Levels a_levels, Model a_model, Save a_save) { a_save = new Save(m_player, a_stateHandler, a_levels, a_model); a_save.InitiateSave(); }