c# - Good code architecture for this problem? -


I am developing a space shooter game with customizable ships. You can increase the strength of properties in any number of ships through a pair of radar chart *. Internally, I present each ship as a subclassified SpaceObject class, in which there is a Ship Info that describes the various properties of that vessel .

is a relatively simple API that gives me the feed in the properties of all ships for a block of relative powers (allowing maximum maximum radar chart) (some of these are the underlying real set of properties Simplicity) and a Ship Info class I can assign to a playerships class (an object that is immediately ready to be a player ship).

I can develop the code to make changes between simplified and actual properties, but I would like some recommendations as provided by this translator to reduce the pain of interaction with the code Ways to go with architecture 5 + arguments or any other crap. Anyone have any ideas?

* = Actually not implemented yet, but this is the plan.

What about builder patterns? You can have a static FillDefaults method on your Ship Info class and then assigns each property of Ship Infoband through an example method that is working the way you are doing Returns from:

  ShipInfo.FillDefaults () CalculateSomething (50) .AssignName ("test ...") RelativeFiringPower (10) .ApplyTo (myShip) ..  

Within ShipInfo, this will look something like this:

  Public Static Ship Info Fill Defaults () {ShipInfo New Instance = ...; // Some default setup returns new internals here; } Calculate the Public ShipInfo count some (int base) {// some calculation // return some values ​​internally; } // Follow this pattern of methods: Apply Public Zero (SpaceObject obj) {// Some checks are here if you obj.ShipInfo = this; }  

Comments