public DefenseGrid GET() { DefenseGrid dg = new GridFactory().Create("Defense", 15, 15) as DefenseGrid; BuildingFactory art = new BuildingFactory(); Block blks = dg.grid[5, 5]; blks.building = art.Create("Artillery", "Art1"); blks.state = State.Healthy; return(dg); }
public ElevatorMovements() { _building = BuildingFactory.Create(2, 10, 3); }
private void SelectFactory(string line, NetFactory netFactory, BuildingFactory buildingFactory, PropFactory propFactory, ResourceFactory resourceFactory, TreeFactory treeFactory, WaterFactory waterFactory) { if (!line.IsNullOrWhiteSpace()) { List <string> arguments = line.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList(); float[] points; float angle; switch (arguments[0]) { case "Resource": points = ReturnFloatsFromArg(arguments); NaturalResourceManager.Resource resource = (NaturalResourceManager.Resource)Enum .Parse(typeof(NaturalResourceManager.Resource), arguments[1], true); resourceFactory.CreateResource(new Vector2(points[0], points[1]), resource); timesResourceUsed++; break; case "Water": points = ReturnFloatsFromArg(arguments); var flowInOut = arguments[3].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(x => uint.Parse(x, CultureInfo.InvariantCulture)) .ToArray(); waterFactory.NewWaterSource(new Vector2(points[0], points[1]), flowInOut[0], flowInOut[1], flowInOut[2]); timesWaterUsed++; break; case "Net": points = ReturnFloatsFromArg(arguments); netFactory.Create(new Vector2(points[0], points[1]), new Vector2(points[2], points[3]), arguments[1]); timesNetUsed++; break; case "Building": points = ReturnFloatsFromArg(arguments); angle = float.Parse(arguments[3], CultureInfo.InvariantCulture); buildingFactory.Create(new Vector2(points[0], points[1]), angle, arguments[1]); timesBuildingUsed++; break; case "Tree": points = ReturnFloatsFromArg(arguments); treeFactory.Create(new Vector2(points[0], points[1]), arguments[1]); timesTreeUsed++; break; case "Prop": points = ReturnFloatsFromArg(arguments); angle = float.Parse(arguments[3], CultureInfo.InvariantCulture); propFactory.Create(new Vector2(points[0], points[1]), angle, arguments[1]); timesPropUsed++; break; case "Error": UnityEngine.Debug.Log(arguments[1]); break; default: UnityEngine.Debug.Log(arguments[0]); break; } } }
public BuildingHarness() { _building = BuildingFactory.Create(2, 10, 3); }