public Dictionary <ICell, int> CountEachTypeCell() { var dictionary = new Dictionary <ICell, int>(); var apple = new Apple(); var chip = new Chip(); var bacterium = new Bacterium(); var slipper = new Slipper(); var cockroachTrap = new CockroachTrap(); var poison = new Poison(); dictionary[apple] = 0; dictionary[chip] = 0; dictionary[bacterium] = 0; dictionary[slipper] = 0; dictionary[cockroachTrap] = 0; dictionary[poison] = 0; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (cells[i][j] is Apple) { dictionary[apple]++; } if (cells[i][j] is Chip) { dictionary[chip]++; } if (cells[i][j] is Bacterium) { dictionary[bacterium]++; } if (cells[i][j] is Slipper) { dictionary[slipper]++; } if (cells[i][j] is CockroachTrap) { dictionary[cockroachTrap]++; } if (cells[i][j] is Poison) { dictionary[poison]++; } } } return(dictionary); }
static public Artifact StringToArtifact(string _artifactType, string artifactName, string description, int power) { Artifact behavior = null; switch (_artifactType) { case "BasiliskEye": behavior = new BasiliskEye(artifactName, description); break; case "DeadWaterBottle": behavior = new DeadWaterBottle(artifactName, description, (Bottle.VolumeType)power); break; case "Decoctum": behavior = new Decoctum(artifactName, description); break; case "Lightning": behavior = new Lightning(artifactName, description, (uint)power); break; case "LivingWaterBottle": behavior = new LivingWaterBottle(artifactName, description, (Bottle.VolumeType)power); break; case "PoisonousSaliva": behavior = new PoisonousSaliva(artifactName, description, (uint)power); break; case "Slipper": behavior = new Slipper(artifactName, description, (uint)power); break; case "None": case "EmptyArifact": behavior = new EmptyArtifact(artifactName, description); break; } return(behavior); }