示例#1
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            MugicObjectManager.SendShapes();

            p.Update();

            //Collision checking
            List <Building> buildingsToRemove = new List <Building>();

            foreach (Building b in buildings)
            {
                b.Update();
                if (b.isColliding(p))
                {
                    Console.Write("\nLOOK OUT JC A COLLISION (with " + b.ToString() + ")!\n");
                }
                if (p.currentPunch != null && b.isColliding(p.currentPunch))
                {
                    b.health--;
                    b.hit = true;
                    if (b.health <= 0)
                    {
                        buildingsToRemove.Add(b);
                    }
                }
            }
            foreach (Building b in buildingsToRemove)
            {
                buildings.Remove(b);
            }
        }
示例#2
0
 public Rectangle(float x, float y, int z, int w, int h)
 {
     bounds   = new Bounds(w, h);
     position = new Vector3(x, y, z);
     MugicObjectManager.Register(this);
 }