0

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;
            }
        }
    }
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Ramy Mahrous
0

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?

0

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

Edited by Ramy Mahrous: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.