Ejemplo n.º 1
0
        /*
        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 (bullet1.Intersects(Ship.Bounds))
            {
                Ship.Health -= 10; // DO STUFF
                return true;
            } else {
                int destSize = Destructibles.Count;
                // Go through destructables, check if each one is hit
                for (int i = 0; i < destSize; i++)
                {
                    DestructibleObject curDest = Destructibles.Dequeue();
                    if (curDest.Intersects(bullet1))
                    {
                        // Maybe spawn some debris here, because somethings been hit?
                        curDest.Damage(curBullet);
                        if (!curDest.IsDead())
                        {
                            Destructibles.Enqueue(curDest);
                        } else {
                            score += 100;
                            // something's been killed, do stuff!
                            trySpawnRewards(curDest.Position);
                        }
                        return true;
                    } else {
                        Destructibles.Enqueue(curDest);
                    }
                }
            }
            return false;
        }
 internal void Damage(BulletObject curBullet)
 {
     hit = true;
     Health -= curBullet.GetDamage();
 }