public static void Generate([NotNull] ForesterArgs args) { if (args == null) { throw new ArgumentNullException("args"); } args.Validate(); List <Tree> treeList = new List <Tree>(); if (args.Operation == ForesterOperation.Conserve) { FindTrees(args, treeList); } if (args.TreeCount > 0 && treeList.Count > args.TreeCount) { treeList = treeList.Take(args.TreeCount).ToList(); } if (args.Operation == ForesterOperation.Replant || args.Operation == ForesterOperation.Add) { switch (args.Shape) { case TreeShape.Rainforest: PlantRainForestTrees(args, treeList); break; case TreeShape.Mangrove: PlantMangroves(args, treeList); break; default: PlantTrees(args, treeList); break; } } if (args.Operation == ForesterOperation.ClearCut) { return; } ProcessTrees(args, treeList); if (args.Foliage) { foreach (Tree tree in treeList) { tree.MakeFoliage(); } } if (args.Wood) { foreach (Tree tree in treeList) { tree.MakeTrunk(); } } }
public Forester(ForesterArgs foresterArgs) { if (foresterArgs == null) { throw new ArgumentNullException("foresterArgs"); } args = foresterArgs; args.Validate(); }
public Forester( ForesterArgs foresterArgs ) { if( foresterArgs == null ) throw new ArgumentNullException( "foresterArgs" ); args = foresterArgs; args.Validate(); }
public Forester(ForesterArgs _args) { args = _args; args.Validate(); }
public Forester(ForesterArgs _args) { args = _args; args.Validate(); }