I am having an issue with using mouse pick. I need to be able to store a game object based on what the mouse is over and perform a certain action. I have a simple state with 3 mouse pick actions in it, each checking a different layer. Each mouse pick action will store a global did pick object bool, and store the object in a global game object variable. ( I hope this is making sense so far)
The variable/layers are treasure, enemy, structure
Here is the problem I am having:
The global bool variable is updating just fine every frame, however, the global Store Game Object will only store the object on the mouse pick at the bottom of the stack. Currently in the state I have:
Mouse Pick - Structure
Mouse Pick - Treasure
Mouse Pick - Enemy
The global Store Game Object will only update if I am over an object on the enemy layer. As I mentioned, the bool value of all of the mouse pick actions will change depending on what I am hovering over, but the game object will not change. If I change the order of the mouse picks, say put Mouse Pick - Treasure at the bottom of the stack, then only objects from the treasure layer will be stored.
Eventually, there will be a bool test on another fsm that will determine what action is taken, but I need the stored game object for the player to interact with.
Any help with this would be greatly appreciated.
Thanks!
Edit:
I just wanted to add what I am trying to accomplish in case there is a better solution.
Basically, this has Diablo style gameplay.
Left click on an area of the terrain - move to that point (This part works great)
Left click on an enemy - Attack that enemy (Either move to enemy and attack, or attack at range depending on what type of attack)
Left click on treasure - Move to treasure location and interact
Left click on structure - Do nothing (unless structure can be entered)
Thanks again!