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;
            }
        }
    }

I don't get what you need us to help in?

You're right, I've made this unclear.

I'm looking for an approach to scripted AI sequences and what other members had to say on the subject.

A couple of ideas for approaches I've had are...

Should I create a class that holds all possible scripted variables that can be changed and then pass an object into that class to be affected?

Should I create all the scripted behaviour inside the object's class and switch between each behaviour?

Again can't get exactly what you meant! do you mean log actions done by or on objects?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.