Forum rules - please read before posting.

2 Interaction Modes

Hi,

I would like to be able to press a button and then have all the interaction modes of my hotspots change to single click options rather than the click then select interaction I'm using.

I thought about maybe hiding all current hotspots and having a seperate set appear with the "single use interaction" option checked. Having looked into this though it seems like I'd have to have an action list that hides every single hotspot in the scene by name and then shows the second set individually by name. 

I was wondering if there's either a way to hide/unhide hotspots based on a layer tag or if there's just a better way to do this in general? 

I would also like to change the cursor icon while in the 2nd mode, is there a way to do this? 

Thanks. 

Comments

  • After some fiddling I've got it half working. I made all the hotspots a child of a hotspot that is off screen called "normal" and I do the enabling/disabling on this and have it affect children.

    I now have a button that turns the hotspots on and off so am half way there. I can see it being easy enough to add the extra hotspots. This is still quite long winded but my programming isn't great so I'm happy to do things a bit of a fudgey way as long as they work.

    I'd still be happy to accept any better ideas people have.

    Now I just need to figure out the cursor change. 




  • I couldn't find an option to set them single click in AC acitons.

    but you could call a script with a for loop that goes through each of the hotspots and sets it via code.

    Im not into all the AC scripting, so cant help with that, but would be something like AC.Kickstarter.something at a guess...

  • That would be my suggestion, too.  The Hotspot's entry in the Scripting Guide can be found here.

    public void SwitchHotspots (bool state)
    {
      AC.Hotspot[] hotspots = FindObjectsOfType (typeof (AC.Hotspot)) as AC.Hotspot[];

      foreach (AC.Hotspot hotspot in hotspots)
      {
        if (hotspot.oneClick == state)
        {
          hotspot.TurnOff ();
        }
        else
        {
          hotspot.TurnOn ();
        }
      }
    }
  • Thanks I've not really looked into the scripting yet.

    Is there a way to change the cursor/ hotspot icon at all? 
  • Which one?  You can define cursors for each verb in the Cursor Manager.
  • What about the icon that shows up on top of hotspots i.e. that little white dot in the walking dead UI.

    Also the mouse cursor.

    When I say change I mean change on the fly as in it stars with one texture then changes to another. 
  • You can change the mouse cursor from the top of the Cursor Manager as well.  To animate it, and any other cursor, make sure the cursor texture has animation frames in a grid, and check Animate? below the field in the Cursor Manager.  You can then fill in the fields that appear below.

    The icon over Hotspots can be set in the Hotspot settings near the bottom of the Settings Manager.
  • I don't think I'm explaining very well what I need.

    I know I can change those textures in those places but is it possible to change them during gameplay? 

    Not animate them but to change them entirely from one flat image to another. 


  • Yes - with custom Actions, you can control any such variable through script, and insert it into your ActionLists.

    Hotspot cursor icons are stored in CursorManager's cursorIcons List:

    AC.KickStarter.cursorManager.cursorIcons;

    Each CursorIcon has a texture variable, that you can set through script, eg:

    AC.KickStarter.cursorManager.cursorIcons[0].texture = myTexture;
  • Ok so I'm trying to create a script and I get this error whenever I save a new one:

    Assets/Scripts/Change_cursor.cs(23,37): error CS0246: The type or namespace name `Action' could not be found. Are you missing a using directive or an assembly reference?

    I assume this is because it's expecting a C# script but it's using different syntax. Was there something I should've done first? 
  • edited January 2016
    All of AC's scripts use the "AC" namespace, so you'll either need to use "AC.Action", or ensure this is at the top of your C# script:

    using AC;
  • Hello again sorry to keep bothering you and thanks loads for the help.

    How do I assign a texture to a variable. I tried something like:

    Texture2D AimTexture = aim_cursor.png;

    Then:


    I can't seem to find anywhere that says how you use a file name in script. 
  • You need to expose a public variable outside of your function, e.g.:

    public Texture2D AimTexture;

    You'll then be able to assign it in your scripts Inspector.

    Bear in mind, though, that you should ask general scripting questions on the official Unity forum - they're better equipped to help.
  • edited January 2016
    Sorry I was under the impression that the AC scripting was somehow different to normal C# coding.

    I feel like I'm nearly there now I have my custom action but when I go to create a custom action in the action list it says:

    "This Action type has been disabled in the Actions Manager"

    I can't see any options in the action manager that say it's disabled so I'm stumped once again. 
  • What title and category have you given the Action, inside the script?  A tutorial on custom Actions can be found here.
  • I have used the action template from the AC folder. I've only changed/added the following:

    namespace AC.Cursorchange
    {

    [System.Serializable]
    public class Cursorchange : Action
    {
    public Texture2D AimTexture;
    // Declare variables here

    public Cursorchange ()
    {
    this.isDisplayed = true;
    category = ActionCategory.Custom;
    title = "Change Cursor";
    description = "Change cursor to crosshair and back";
    }

    override public float Run ()
    {
    AC.KickStarter.cursorManager.cursorIcons[0].texture = AimTexture;
    if (!isRunning)
    {
    isRunning = true;
    return defaultPauseTime;
    }
    else
    {
    isRunning = false;
    return 0f;
    }
    }

    What ever I change the category to I get the same "This Action type has been disabled in the Actions Manager" error whenever I try and do that kind of action. 
  • edited January 2016
    Change your first line to just "namespace AC;".
  • Yay that did it thanks :)
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.