public void CollideRocksAndPlayer() { foreach (Rock <T> aRock in m_RockList) { IVector <T> BulletRelRock = m_Player.Position.Subtract(aRock.Position); T BothRadius = aRock.Radius.Add(m_Player.Radius); T BothRadiusSqrd = BothRadius.Multiply(BothRadius); if (BulletRelRock.GetMagnitudeSquared().LessThan(BothRadiusSqrd)) { aRock.TakeDamage(m_Player.GiveDamage()); m_Player.TakeDamage(M.New <T>(20)); } } }
public void CollideBulletsAndRocks() { foreach (Rock <T> aRock in m_RockList) { foreach (Bullet <T> aBullet in m_BulletList) { IVector <T> BulletRelRock = aBullet.Position.Subtract(aRock.Position); T BothRadius = aRock.Radius.Add(aBullet.Radius); T BothRadiusSqrd = BothRadius.Multiply(BothRadius); if (BulletRelRock.GetMagnitudeSquared().LessThan(BothRadiusSqrd)) { aRock.TakeDamage(aBullet.GiveDamage()); PlayerSaveInfo <T> .GetPlayerInfo().Score += 2; } } } }