designing diversion objects
i recently started operative little diversion possess amusement, controlling microsoft xna c#. doubt regards conceptualizing diversion vigilant objects get it. i'm going interpretation diversion vigilant something rendered screen. this, i solid bottom category objects need rendered inherit, called gameobject. formula next category i made:
class gameobject
{
private denote model = null;
private boyant scale = 1f;
private vector3 position = vector3.zero;
private vector3 series = vector3.zero;
private vector3 quickness = vector3.zero;
private bool alive = false;
stable contentmanager content;
#region constructors
open gameobject(contentmanager content, twine modelresource)
{
this.content = content;
denote = content.load<model>(modelresource);
}
open gameobject(contentmanager content, twine modelresource, bool alive)
: this(content, modelresource)
{
this.alive = alive;
}
open gameobject(contentmanager content, twine modelresource, bool alive, boyant scale)
: this(content, modelresource, alive)
{
this.scale = scale;
}
open gameobject(contentmanager content, twine modelresource, bool alive, boyant scale, vector3 position)
: this(content, modelresource, alive, scale)
{
this.position = position;
}
open gameobject(contentmanager content, twine modelresource, bool alive, boyant scale, vector3 position, vector3 rotation)
: this(content, modelresource, alive, scale, position)
{
this.rotation = rotation;
}
open gameobject(contentmanager content, twine modelresource, bool alive, boyant scale, vector3 position, vector3 rotation, vector3 velocity)
: this(content, modelresource, alive, scale, position, rotation)
{
this.velocity = velocity;
}
#endregion
}
i've left out additional methods things such rotate, move, pull object. i wanted emanate another object, ship, i'd emanate boat class, get gameobject. illustration formula below:
class boat : gameobject
{
private int num_missiles = 20; // array missiles boat have alive during any given time
private missile[] missiles;
private boyant max_missile_distance = 3000f; // max widen barb boat before dies
#region constructors
open ship(contentmanager content, twine modelresource)
: base(content, modelresource)
{
initship();
}
open ship(contentmanager content, twine modelresource , bool alive)
: base(content, modelresource, alive)
{
initship();
}
open ship(contentmanager content, twine modelresource, bool alive, boyant scale)
: base(content, modelresource, alive, scale)
{
initship();
}
open ship(contentmanager content, twine modelresource, bool alive, boyant scale, vector3 position)
: base(content, modelresource, alive, scale, position)
{
initship();
}
open ship(contentmanager content, twine modelresource, bool alive, boyant scale, vector3 position, vector3 rotation)
: base(content, modelresource, alive, scale, position, rotation)
{
initship();
}
open ship(contentmanager content, twine modelresource, bool alive, boyant scale, vector3 position, vector3 rotation, vector3 velocity)
: base(content, modelresource, alive, scale, position, rotation, velocity)
{
initship();
}
#endregion
}
again, i've left out any additional ship-specific methods, banishment missile. cruise arrange settlement good should softened somehow altered completely? seems constructors child classes messy, nonetheless maybe that's wholly proceed it. i've never finished anything am wondering i'm proceed off track.
thanks everybody left an answer. unequivocally helpful. there seems whole settle changing around an mvc settlement best. i'm going feeling offer accurately that. i'll also stealing many constructors have only constructor, since arguments after modelresource aren't required emanate object, altered after by slight calls.
Comments
Post a Comment