コード例 #1
0
ファイル: Map.cs プロジェクト: jorgejavierfm/Wall-E
 public Map(int dimX, int dimY, Cell defaultCell)
 {
     map = new Cell[dimX, dimY];
      for (int i = 0; i < dimX; i++)
      {
     for (int j = 0; j < dimY; j++)
     {
        map[i, j] = (Cell)defaultCell.Clone();
     }
      }
 }
コード例 #2
0
ファイル: DlgEditCell.cs プロジェクト: jorgejavierfm/Wall-E
        private void btnOK_Click(object sender, EventArgs e)
        {
            string name = txtName.Text;
             int temp = (int)nudTemp.Value;
             Image image = pboxImage.Image;
             bool isHole = chkHole.Checked;
             bool isLiquid = chkLiquid.Checked;

             Cell cell = new Cell(name, temp, image, isHole, isLiquid);

             if (cellEditing == null)
             {
            cellList.Add(cell);
             }
             else
             {
            cellEditing.Name = cell.Name;
            cellEditing.Image = cell.Image;
            cellEditing.IsHole = cell.IsHole;
            cellEditing.Temperature = cell.Temperature;
            cellEditing.IsLiquid = cell.IsLiquid;
             }
        }
コード例 #3
0
ファイル: Cell.cs プロジェクト: jorgejavierfm/Wall-E
        public InteractionEventArgs(Cell happenedAt, Item happenedTo)
        {
            if (happenedTo != null)
             {
            string who = happenedTo.Name;
            string action = "";
            string where = happenedAt.Name;

            if (happenedAt.IsHole)
            {
               if (happenedTo.CanFillHoles)
                  action = "fills";
               else action = "falls in";
            }
            else if (happenedAt.Temperature >= happenedTo.TempToMelt)
               action = "melts in";
            else if (happenedAt.IsLiquid && !happenedTo.Floats){
               action = "sinks in";
            }

            if (action != "")
               this.EventDescription = string.Format("{0} {1} {2}", who, action, where);
            else this.EventDescription = InteractionEventArgs.NothingHappened;
             }
             else
             {
            this.EventDescription = InteractionEventArgs.NothingHappened;
             }
        }
コード例 #4
0
ファイル: DlgEditCell.cs プロジェクト: jorgejavierfm/Wall-E
 // Para modificar una celda del mapa
 public DlgEditCell(Cell cellToEdit)
 {
     cellEditing = cellToEdit;
      InitializeComponent();
 }