Search Unity

SOLVED point and click system to move the player using camera Rays, need to turn it off for buttons

Discussion in 'Scripting' started by jfonz001, Jul 20, 2017.

  1. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    EDIT: WOOO! Figured it out, added a condition to my if-statement in WorldInteractions:

    Line 16:
    https://pastebin.com/k1XjAXqb

    Seems sort of like a band-aid solution, but I'd like for the whole game to stop when dialogue is active, so I might be able to integrate this onto other NPCs/Enemy classes in the future somehow.
    --------------------------------------------------------
    Hey guys I'm brand new to Unity and C#, so forgive me if I mix up my syntax/vocab, but I've been following along with this tutorial fairly well up until now:



    Here is the script on the player object responsible for player movement and object interaction:

    https://pastebin.com/EQn91nmX

    My scripts have a S*** load of comments, sorry bout that it's just how I wrap my head around things. I'm used to Ruby and Ruby on Rails, which feels like a walk in the park compared to this stuff.

    He's making a simple RPG with a point and click move system. It worked great until I introduced the dialogue system. It all works, but when I click the continue button the player moves towards it. I can't tell if the RayCast is hitting the button or the ground. I suspect it is properly passing through the UI layer and triggering the ground anyway. A little debugging seemed to imply my Rays weren't touching the button.

    I also have a script for Interactionable(s), the DialogueSystem and the NPC (who simple inherits from Interactionable and overwrites it's interation() method.) I think the problem and solution lies in the player (WorldInteraction) script, but here is the DialogueSystem if it helps:

    DialogueSystem:

    https://pastebin.com/ks2qT26w


    And screw it, here's the InteractableScript, but I don't think this pertains to much. The YouTuber guy seems pretty good at keeping things modular:

    https://pastebin.com/qU1ty5X1


    Anyway I tried messing with the Layers and checking for collisions with the button, not really sure what to do here...
     
    Last edited: Jul 20, 2017