Exemplo n.º 1
0
        /// <summary>Moves an existing seed into this pit.</summary>
        /// <param name="seed">The seed to be moved here.</param>
        public void MoveSeedHere(Seed seed, Point newTopLeftCorner)
        {
            Logging.I.LogMessage("Pit.MoveSeedHere (" + seed + ", (" + newTopLeftCorner + "))\n", Logging.LogLevel.DeepDebug);
            // Add the seed to the list of seeds in this pit:
            _seeds.Add(seed);

            // Set the coordinates of the seed to the new position:
            seed.SetTopLeftCorner(newTopLeftCorner);

            // Modify the number that is shown for this pit:
            _numberField.Text = _seeds.Count.ToString();
            PositionNumberFieldCorrectly();
        }
Exemplo n.º 2
0
        /// <summary>Adds one seed to the pit.</summary>
        public void AddNewSeed()
        {
            // Create a new seed and add it to the list:
            Seed newSeed = new Seed();
            _seeds.Add(newSeed);
            _numberField.Text = _seeds.Count.ToString();
            PositionNumberFieldCorrectly();

            Point newTopLeftCorner = FindPlaceForNewSeed(newSeed.GetWidth(), newSeed.GetHeight());
            newSeed.SetTopLeftCorner(newTopLeftCorner);

            //DEBUG     Logging.Inst.LogMessage(this.ToString() + ": Added " + newSeed + " at (" + newTopLeftCorner + "). Image.coords: (" +
            //DEBUG                             Canvas.GetLeft(newSeed.GetImage()).ToString() + ";" + Canvas.GetTop(newSeed.GetImage()).ToString() + ")\n");
            _canvasToPaintOn.Children.Add(newSeed.GetImage());
        }