Esempio n. 1
0
        private static void loadFan(String s)
        {
            string[] data   = s.Split(':');
            float    width  = float.Parse(data[2]) * MULTI;
            float    height = float.Parse(data[3]) * MULTI;
            float    x      = float.Parse(data[0]) * MULTI;
            float    y      = (float.Parse(data[1]) * MULTI * -1) - height;

            int        power     = int.Parse(data[4]);
            EDirection direction = EDirection.UP;

            switch (data[5])
            {
            case "UP": direction = EDirection.UP; break;

            case "DOWN": direction = EDirection.DOWN; break;

            case "LEFT": direction = EDirection.LEFT; break;

            case "RIGHT": direction = EDirection.RIGHT; break;
            }

            FanTile tile = new FanTile(new Vector2(x, y));

            tile.setRectangle((int)x, (int)y, (int)width, (int)height);
            tile.setPower(power);
            tile.setDirection(direction);
            if (data.Length == 7)
            {
                int time = int.Parse(data[6]);
                tile.setTime(time);
            }

            Game1.middle.Add(tile);
        }
Esempio n. 2
0
        private void btnProperties_Click(object sender, EventArgs e)
        {
            Tile selected = Game1.selector.getSelected();

            if (selected is EnemyTile)
            {
                MessageBox.Show("There is no property for enemys!");
                return;
            }
            else if (selected is PropTile)
            {
                PropTile prop  = (PropTile)selected;
                PropForm pform = new PropForm(game, prop);
                pform.Show();
                return;
            }
            else if (selected is FanTile)
            {
                FanTile fan     = (FanTile)selected;
                FanForm fanForm = new FanForm(game, fan);
                fanForm.Show();
                return;
            }
            PropertyForm form = new PropertyForm(game, selected);

            form.Show();
        }
Esempio n. 3
0
 public void addFan()
 {
     if (currentLayer == ELayer.MIDDLE)
     {
         FanTile t = new FanTile(camera.getCenterPos());
         middle.Add(t);
         selector.setSelected(t);
     }
 }
Esempio n. 4
0
 private static void addFans(List <string> list)
 {
     list.Add("[Fans]");
     foreach (Tile t in Game1.middle)
     {
         if (t is FanTile)
         {
             FanTile   tile = (FanTile)t;
             Rectangle rec  = t.getRecHit();
             String    s    = rec.X / DIVID + ":" + ((rec.Y * -1) - rec.Height) / DIVID + ":" + rec.Width / DIVID + ":" + rec.Height / DIVID + ":" + tile.getPower() + ":" + tile.getDirection().ToString();
             if (tile.getTime() != 0)
             {
                 s += ":" + tile.getTime();
             }
             list.Add(s);
         }
     }
 }
Esempio n. 5
0
        public FanForm(Game1 game, FanTile tile)
        {
            InitializeComponent();
            this.game = game;
            this.tile = tile;
            switch (tile.getDirection())
            {
            case EDirection.UP:
            case EDirection.DOWN:
                nrAmount.Value = tile.getRecHit().Width / 50;
                break;

            case EDirection.LEFT:
            case EDirection.RIGHT:
                nrAmount.Value = tile.getRecHit().Height / 50;
                break;
            }
            nrPower.Value = tile.getPower();
            nrTime.Value  = tile.getTime();
            setDirection(tile.getDirection());
        }