How to execute more then one function in requested order with time delay?

Hello

I trying to do some simple game for kids. The objective is to get player to the specific red field. But the way of object needs to be put as sequence of code first and it is executed by pressing “RUN CODE” button.
I created functions for moves and list of variables to store sequence but I don’t know how to assign those functions to variables and run sequence of those functions chosen by player, one by one with requested time delay. Please help :wink:

You want to parse what a user inputs into functions to run? If I understand correctly you will want to take advantage of invoking your functions with a delegate type Dictionary:

    Dictionary<string, Action> myAction = new Dictionary<string, Action>()
    {
        {"Move", new Action(Move) },
    };

    void ParseAction()
    {
        //Here you will do the logic that takes in a string (Or int) by whatever way you want to parse the sequence, Im just showing you how "Move" will work. 
        CallInvoke("Move");
    }

    void CallInvoke(string myFunct)
    {
        System.Threading.Thread.Sleep(1000);
        myAction[myFunct].DynamicInvoke();
    }

    public static void Move()
    {
        print("Im moving");
    }

Or you can use a switch statement, but I like this dictionary / invoke better since it’s cleaner. Just keep adding your functions as new Actions as you need.

Let me know if you have questions.