Exemple #1
0
        public bool onMouseClick(MouseClickEventArgs e)
        {
            EntityManager.findCriteria d = delegate(Entity en)
            {
                if (en is Board)
                {
                    int x = MetaData.InputManager.MouseX;
                    int y = MetaData.InputManager.MouseY;

                    return (en as Board).detectMouseAt(new Vector2(x, y));
                }
                return false;
            };

            Entity[] entity = EntityManager.FindEntities(d);

            if (entity.Length > 0)
            {
                Board b = (entity[0] as Board);
                if (b != null)
                {
                    Vector2 coord = b.GetGridAt(e.X, e.Y);
                    BoardComponent c = b.GridOccipiedWithAt(coord);

                    if (c == null && e.Button == EMouseButton.Left)
                        b.AddComponent(new DummyComponent(), coord);
                    else if(e.Button == EMouseButton.Right)
                    {
                        b.RemoveComponent(c);
                        EntityManager.Manager.RemoveEntity(c);
                    }
                }
            }
            return true;
        }
Exemple #2
0
 public void onMouseClick(MouseClickEventArgs e)
 {
     foreach (Entity en in entities)
     {
         if (en is IMouseEvents)
         {
             if ((en as IMouseEvents).detectMouseAt(new Vector2(e.X, e.Y)))
                 if ((en as IMouseEvents).onMouseClick(e))
                     return;
         }
     }
 }
Exemple #3
0
 public bool onMouseClick(MouseClickEventArgs e)
 {
     return false; ;
 }
Exemple #4
0
 public bool onMouseClick(MouseClickEventArgs e)
 {
     toggleMouse();
     return false;
 }
Exemple #5
0
 public void onMouseClick(object sender, MouseClickEventArgs e)
 {
     EntityManager.Manager.onMouseClick(e);
     player.onMouseClick(e);
 }