Sending event to engine

Tue 16. Jan 2018, 12:01

Hi!
I want to create a scenario when characters talk to each other but at some points they pause the conversation to play an animation. Let's say we have Bob and Marry and it goes like that:

Code: Select all
Bob: Hi Marry!
Marry: Hi Bob!
//put some chit-chat between Bob and Marry
Marry: Do you have the chocolade?

if(Bob.HasChocolade)
{
    Bob: Yes, I have.
    Unity.CallEvent("Play Bob giving the chocolade");//<- here we wait for animation to end
    Marry: Thanks you!
}
else
{
    Bob: No, I don't.
    Marry: Oh, it's a bummer.
}

Marry: Let's go back to school.
//The conversation still goes as the kids are walking down to the school


As far as I've found there is no dedicated Flow Fragment for doing such a thing. I could listen to a particular variable and ask story designers to put animation requests that way in Instruction Fragments. But it might be too much error-prone as we are going to implement also much more complicated branching and events. Is there a better way to do such a thing?
Xaon
 
Posts: 4
Joined: Tue 16. Jan 2018, 11:41

Re: Sending event to engine

Tue 16. Jan 2018, 17:50

Hi Xaon,

There are two good practises to achieve this:

- In Articy you can call methods inside instructions and conditions, which you implement later inside Unity. In Articy the only thing you must do is write something like MyMethod(“myArg0”). After exporting the project to Unity, you must implement the IScriptMethodProvider interface.
You can find an example in the Maniac Manfred demo project. The script “SceneHandler” implements the method “restart()“, which gets called in Articy.

- Another good practise is to create a template for a hub (or any other kind of flow objects). In the features of a template you can store all information you need and access them inside Unity. There is also an example in the Maniac Manfred SceneHandler script (at the end of OnFlowPlayerPaused()) which shows you how you can check if a flow object has a specific feature and how to access the data.
User avatar
[Articy] Christian Schildt
Articy Staff
Articy Staff
 
Posts: 62
Joined: Tue 16. Jan 2018, 17:03
Location: Bochum

Re: Sending event to engine

Wed 17. Jan 2018, 13:56

Thanks Christian!

Now I get it. When importing project to Unity it will generate IScriptMethodProvider with method declarations based on methods added in the Articy:Draft project itself. It seams great as this will add some flexibility for story designers to declare what they need to be done in game logic and it give me statically typed declaration of what I have to implement.
I love the idea but I must also say that it makes tutorials harder to read and understand. So please add more notes about which types are dynamically created by the plugin on import.

[Edit - I'm also testing new IDE and I don't have fully working intellisense or autocompletion yet.]
Xaon
 
Posts: 4
Joined: Tue 16. Jan 2018, 11:41

Re: Sending event to engine

Thu 18. Jan 2018, 16:45

Hi Xaon,
You can find all classes that are dynamically generated by the plugin on import inside the Assets\ArticyContent\Generated\ folder of your Unity project. Furthermore it can be helpful to look into the Articy.* namespaces. There you can see that there is a nested namespace (named like your project technical name) for generated classes.

Here you will find some examples how to work with the generated data (e.g. in chapter “Object Templates”): https://www.nevigo.com/articy-importer/unity/html/2eba717d-94e4-46c4-8ecd-40477e614a7d.htm
All types that are part of the plugin itself you can find here: https://www.nevigo.com/articy-importer/unity/html/reference.htm
User avatar
[Articy] Christian Schildt
Articy Staff
Articy Staff
 
Posts: 62
Joined: Tue 16. Jan 2018, 17:03
Location: Bochum

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 59 guests

Who We Are
Contact Us
Social Links