Beispiel #1
0
 public override void think()
 {
     base.think();
     if (rand.NextDouble() < 0.01) {
         Ent e = new EntPaperBall(position - Vector3.UnitX * size);
         manager.queueAdd(e);
     }
 }
Beispiel #2
0
        public override void think(GameTime gt)
        {
            base.think(gt);
            double currentTime = gt.TotalGameTime.TotalMilliseconds;

            if (startTime == 0)
            {
                startTime = currentTime;
            }

            foreach (Ent e in entities.Ents)
            {
                if (e is EntBullet)
                    entities.queueRemove(e);

                if (e is EntBalloon)
                {
                    if (Ent.rand.NextDouble() < 0.0005)
                    {

                        Vector3 d = (Epc.position - e.Position);

                        d.Normalize();

                        d *= 0.1f;

                        EntPaperBall pb = new EntPaperBall(e.Position);

                        pb.velocity = d;

                        entities.queueAdd(pb);
                    }
                }

            }
            entities.dequeAll();

            if (Epc.lives > 0)
                Epc.score = (int)(currentTime - startTime) / 1000;
        }