Example #1
0
 /// <summary>
 /// This method is used to trigger different behaviours depending on the result or outcome of an interaction by the user.
 /// </summary>
 public void ContinueFlow(IArticyObject aObject)
 {
     // if the object is a location, we load a new level
     if (aObject is ILocation)
     {
         var loc = aObject as ArticyObject;
         // we want to leave, so we trigger our transition effect
         transition.TransitionOut();
         // the new scene name is the same as the technical name of the supplied location
         // we start a coroutine because we want to delay the loading of the level a bit for the transition to finish
         StartCoroutine(LoadNextLevel(loc.TechnicalName));
     }
     else if (aObject is IEntity)
     {
         // if the object is an item, that usually means that the item is given to the player.
         var item = aObject as Item;
         if (aObject is Item)
         {
             ArticyDatabase.DefaultGlobalVariables.SetVariableByString(item.Template.VariableBinding.VariableName.RawScript, true);
         }
     }
     else if (aObject != null)
     {
         // if we are about to open a new dialog, we better stop the user from using any items
         inventory.StopUsingItem();
         // we enable the dialog ui
         dialogShown = true;
         dialogWidget.SetActive(dialogShown);
         // and we assign the object as the start node
         flowPlayer.StartOn = aObject;
     }
 }
Example #2
0
    // This is called everytime the flow player reaches and object of interest.
    public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        if (aObject != null)
        {
            IArticyObject articyObj = aObject as IArticyObject;
        }
        // To show text in the ui of the current node
        // we just check if it has a text property by using the object property interfaces,
        // if it has the property we use it to show the text in our main text label.
        var modelWithText = aObject as IObjectWithText;

        if (modelWithText != null)
        {
            textLabel.text = modelWithText.Text;
        }
        else
        {
            EndDialog();
        }
        //textLabel.text = string.Empty;

        // this will make sure that we find a proper preview image to show in our ui.
        ExtractCurrentPausePreviewImage(aObject);
    }