private void pictureSelect_Click(object sender, EventArgs e) { PictureBox current = (sender as PictureBox), targetControl = parent.Field.Monsters[defenceIndex].Control; Defence newObj; parent.Field.Monsters[defenceIndex].Dispose(); parent.Field.Monsters[defenceIndex] = null; GC.Collect(); if (current == pictureFireDefence) { newObj = new FireMonster(targetControl, parent.FireDefenceImg, parent.BackgroundFlush); } else if (current == pictureLaserDefence) { newObj = new LaserMonster(targetControl, parent.LaserDefenceImg, parent.BackgroundFlush); } else if (current == pictureCritFireDefence) { newObj = new CritFireMonster(targetControl, parent.CritFireDefenceImg, parent.BackgroundFlush); } else { throw new InvalidOperationException("Что то пошло не так ..."); } parent.Field.Monsters[defenceIndex] = newObj; newObj = null; this.DialogResult = DialogResult.OK; this.Close(); }
public void RemoveFireMonster(FireMonster monster) { mFireMonster.Remove(monster); }
// Start is called before the first frame update void Start() { Instance = this; }
// 小火怪,烟雾怪 public void AddFireMonster(FireMonster monster) { mFireMonster.Add(monster); }