I would like to write a class that handles a series of timed events for an object.
I would need to deal with class properties not being set, and therefore making no change to the object.
I've gone with the "?" nullable operator for my first attempt but I would like to know how others would approach this topic.
public class Scripter
{
public Vector2? direction;
public float? speed;
public Scripter() { }
public void PlayScript(ScriptedObject o)
{
if (direction.HasValue)
{
o.Direction = direction.Value;
}
if (speed.HasValue)
{
o.Speed = speed.Value;
}
}
}