public override void OnDraw() { m_Playfield.Draw(GetRenderer()); m_ScoreWidget.Text = PlayerSaveInfo <T> .GetPlayerInfo().Score.ToString(); base.OnDraw(); }
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; } } } }
public override void Destroying() { ((SoundBuffer <T>)DataAssetCache <T> .Instance.GetAsset(typeof(SoundBuffer <T>), "AsteroidExplosion")).PlayAnAvailableCopy(); if (Radius.GreaterThan(MinSplitRadius)) { PlayerSaveInfo <T> .GetPlayerInfo().Score += this.Radius.Multiply(20).ToDouble(); Random rand = new Random(); Rock <T> newRock = new Rock <T>(this.Radius.Divide(2), m_RockList); newRock.Position = this.Position; newRock.m_MaxDamage = this.MaxDamage.Divide(2); m_RockList.Add(newRock); newRock = new Rock <T>(this.Radius.Divide(2), m_RockList); newRock.Position = this.Position; newRock.m_MaxDamage = this.MaxDamage.Divide(2); newRock.m_Velocity.Set(M.New <T>(rand.NextDouble() * 200), M.New <T>(rand.NextDouble() * 200)); m_RockList.Add(newRock); } }