public bool Fall(Vector2 a_newPos, ISpundObserver a_soundEffect) { if (a_newPos.Y > g_levelHeight + 1) { a_soundEffect.DeathSound(); return true; } return false; }
public bool IsCollidingAtTrap(Vector2 a_newPos, Vector2 a_size, ISpundObserver a_soundEffect) { Vector2 topLeft = new Vector2(a_newPos.X, a_newPos.Y - a_size.Y); // (a_newPos.X / 2.0f, a_newPos.Y - a_size.Y); Vector2 bottomRight = new Vector2(a_newPos.X, a_newPos.Y); 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 + 0.8f) continue; if (topLeft.Y > (float)y + 0.8f) continue; if (m_tiles[x, y] == Tile.T_TRAP) { a_soundEffect.DeathSound(); return true; } } } return false; }
private bool CollideWithEnemyTwo(Vector2 a_newPos, ISpundObserver a_soundEffect) { for (int i = 0; i < m_enemy.Count; i++) { if ((m_enemy[i].GetPosition() - a_newPos).Length() < 0.5f) { a_soundEffect.DeathSound(); return true; } } return false; }