/* * public delegate somethingSomethingSomething?? * * public void PrototypicalRedundanyReducer(theDelegate method, queueToProces objects) * { * int size = objects.Count; * for (int i = 0; i < size; i++) * { * theDelegate(objects); * } * } * * public methodForDelegateStuff1(queueToProcess????) * { * * } * * public methodForDelegateStuff2(queueToProcess????) * { * * } */ private bool TryHit(BulletObject curBullet) { bullet1.Center = (new Vector3(curBullet.Position, 0f)); if (!curBullet.isFriendly() && bullet1.Intersects(Ship.Bounds)) { Ship.Health -= 10; // DO STUFF return(true); } else if (curBullet.isFriendly()) { int destSize = EnemyShips.Count; // Go through destructables, check if each one is hit for (int i = 0; i < destSize; i++) { EnemyShip curDest = EnemyShips.Dequeue(); if (curDest.Intersects(bullet1)) { // Maybe spawn some debris here, because somethings been hit? curDest.Damage(curBullet); if (!curDest.IsDead()) { EnemyShips.Enqueue(curDest); } else { score += 100; // something's been killed, do stuff! trySpawnRewards(curDest.Position); } return(true); } else { EnemyShips.Enqueue(curDest); } } } return(false); }
/* public delegate somethingSomethingSomething?? public void PrototypicalRedundanyReducer(theDelegate method, queueToProces objects) { int size = objects.Count; for (int i = 0; i < size; i++) { theDelegate(objects); } } public methodForDelegateStuff1(queueToProcess????) { } public methodForDelegateStuff2(queueToProcess????) { } */ private bool TryHit(BulletObject curBullet) { bullet1.Center = (new Vector3(curBullet.Position, 0f)); if (!curBullet.isFriendly() && bullet1.Intersects(Ship.Bounds)) { Ship.Health -= 10; // DO STUFF return true; } else if (curBullet.isFriendly()) { int destSize = EnemyShips.Count; // Go through destructables, check if each one is hit for (int i = 0; i < destSize; i++) { EnemyShip curDest = EnemyShips.Dequeue(); if (curDest.Intersects(bullet1)) { // Maybe spawn some debris here, because somethings been hit? curDest.Damage(curBullet); if (!curDest.IsDead()) { EnemyShips.Enqueue(curDest); } else { score += 100; // something's been killed, do stuff! trySpawnRewards(curDest.Position); } return true; } else { EnemyShips.Enqueue(curDest); } } } return false; }