Forum rules - please read before posting.

Show pending interaction whilst action/interaction is running during cutscene?

13»

Comments

  • GetMovingTo will only be set for interactions specified in the Hotspot Inspector. As with the other related thread, I will look to see if unhandled use behaviour can be defined in the Hotspot. Please share your Settings Manager's full "Interaction settings".


  • Let me know if you need any other information, thanks!

  • After upgrading to 1.70, I'm getting this error: Assets\Verb1txtVerb2.cs(100,21): error CS1061: 'Hotspot' does not contain a definition for 'IsInventoryButton' and no accessible extension method 'IsInventoryButton' accepting a first argument of type 'Hotspot' could be found (are you missing a using directive or an assembly reference?)

    Here's the script that worked before the update:

    `using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;
    using AC;

    public class Verb1txtVerb2 : MonoBehaviour
    {

    public Text textBox1;
    public Text textBox2;
    public GameObject bg;
    private bool textOnce;
    private bool textOnEvent;
    private string newLabel;
    private bool amInteraction;
    private bool amCutscene = true;
    Interaction myInteraction;
    private bool invInteraction;
    
    private Animator _animator;
    public float heightofclick;
    
    private void Start()
    {
        _animator = GetComponent<Animator>();
    }
    
    private void OnEnable()
    {
        EventManager.OnHotspotInteract += MyUse;
        EventManager.OnExitGameState += ExitGameState;
        EventManager.OnEnterGameState += EnterGameState;
        EventManager.OnBeginActionList += OnBeginActionList;
        EventManager.OnEndActionList += OnEndActionList;
        EventManager.OnInventoryInteract += OnInventoryInteract;
    }
    
    private void OnDisable()
    {
        EventManager.OnHotspotInteract -= MyUse;
        EventManager.OnExitGameState -= ExitGameState;
        EventManager.OnEnterGameState -= EnterGameState;
        EventManager.OnBeginActionList -= OnBeginActionList;
        EventManager.OnEndActionList -= OnEndActionList;
        EventManager.OnInventoryInteract -= OnInventoryInteract;
    
    }
    
    private void OnInventoryInteract(InvItem invItem, int iconID)
    {
        invInteraction = true;
        print("is inventory");
        int language = Options.GetLanguage();
        newLabel = KickStarter.cursorManager.GetLabelFromID(iconID, language) + " " + invItem.GetLabel(language);
    }
    
    private void OnEndActionList(ActionList actionList, ActionListAsset actionListAsset, bool isSkipping)
    {
        if (invInteraction == true)
        {
            invInteraction = false;
            print("inventory actionlist cancel");
    
        }
    }
    
    private void EnterGameState(GameState gamestate)
    {
        if (gamestate == GameState.Cutscene)
        {
            amCutscene = true;
        }
    }
    private void ExitGameState(GameState gamestate)
    {
        if (gamestate == GameState.Cutscene)
        {
            textOnEvent = false;
            amInteraction = false;
            amCutscene = false;
        }
    }
    private void OnBeginActionList(ActionList actionList, ActionListAsset actionListAsset, int startingIndex, bool isSkipping)
    {
        if (actionList is Interaction)
        {
            amInteraction = true;
            myInteraction = actionList as Interaction;
        }
    
    }
    private void MyUse(Hotspot hotspot, AC.Button button)
    {
        textOnEvent = true;
        if (button != null)
        {
            int language = Options.GetLanguage();
            newLabel = KickStarter.cursorManager.GetLabelFromID(button.iconID, language) + " " + hotspot.GetName(language);
        }
        if (hotspot.IsInventoryButton(button))
        {
            int language = Options.GetLanguage();
            newLabel = KickStarter.playerInteraction.GetLabelPrefix(hotspot, KickStarter.runtimeInventory.SelectedItem, language) + " " + hotspot.GetName(language);
        }
    }
    
    private void Update()
    {
        bool doHold = false;
    
        if (KickStarter.playerInteraction.GetHotspotMovingTo() != null
            )
        {
            if (textOnce == false)
            {
                textBox2.text = textBox1.text;
                textBox2.enabled = true;
                bg.SetActive(true);
                textOnce = true;
            }
    
        }
        else
        {
            textBox2.text = textBox1.text;
            textBox2.enabled = false;
            bg.SetActive(false);
            textOnce = false;
        }
        if (textOnEvent == true || invInteraction == true)
        {
            textBox1.text = newLabel;
        }
        if (KickStarter.playerInteraction.GetHotspotMovingTo() == null
            && amInteraction == false
            )
        {
            textOnEvent = false;
        }
    
        if (myInteraction != null)
        {
            if (!myInteraction.AreActionsRunning())
            {
                //textOnEvent = false;
                amInteraction = false;
                // Interaction is set, but no Actions are running
            }
        }
    
        //Highlight Script
    
        if (KickStarter.playerInteraction.GetHotspotMovingTo() != null
            || amInteraction == true
            //||  textOnEvent == true
                )
        {
            doHold = true;
        }
        _animator.SetBool("Hold", doHold);
    
        if (Input.GetMouseButtonDown(0) &&
            KickStarter.playerInteraction.GetActiveHotspot() == null &&
            Camera.main.ScreenToViewportPoint(Input.mousePosition).y >= heightofclick
            && amInteraction == false
            && amCutscene == false
            )
        {
            _animator.SetTrigger("Flash");
        }
    
    }
    

    }`

  • See the upgrade notes in the Changelog, specifically:

    The Hotspot script's IsInventoryButton function has been replaced with GetButtonInteractionType

    Replace:

    if (hotspot.IsInventoryButton(button))
    

    with:

    if (hotspot.GetButtonInteractionType (button) == HotspotInteractionType.Inventory)
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!