public WaypointMap(Color startColor, Color endColor, Waypoint[] points, Point scale)
 {
     myScale = scale;
     Waypoints = new List<Waypoint>();
     for (int index = 0; index < points.Length; index++) {
         Add(points[index]);
     }
     Drawer = new ColorWaypointDrawer(startColor, endColor, this, scale);
 }
 public void Add(Waypoint point)
 {
     Waypoints.Add(point);
     point.Map = this;
 }
示例#3
0
        public override bool OnClick(Pointer jQueryEvent)
        {
            clicking = true;
            selectedWaypoint = null;
            selectedTower = null;

            Point point = new Point(jQueryEvent.X / Scale.X, jQueryEvent.Y / Scale.Y);
            switch (myClickState.Data) {
                case 0:
                    selectedKingdom = null;

                    foreach (var kingdom in Kingdoms) {
                        foreach (var tower1 in kingdom.Value.Towers) {
                            if (tower1.X == point.X && tower1.Y == point.Y) {
                                selectedKingdom = kingdom.Value;
                                selectedTower = tower1;
                                break;
                            }
                        }
                    }
                    break;
                case 1:
                    foreach (var waypointMap in WaypointMaps) {
                        foreach (var p in waypointMap.Waypoints) {
                            if (p.X == point.X && p.Y == point.Y) {
                                selectedWaypoint = p;
                                break;
                            }
                        }
                    }
                    break;
                case 2:
                    break;
                case 3:

                    if (selectedKingdom != null) {
                        if (TowerExistsAt(point.X, point.Y) == null) {
                            Tower tower = new SingeShotTower(selectedKingdom.Color, point.X, point.Y);
                            selectedKingdom.Towers.Add(selectedTower = tower);
                            tower.Drawer.Init();
                        }
                    }
                    break;
            }

            return base.OnClick(jQueryEvent);
        }