Search Unity

Need some HEEEULLPSSS! :confused:

Discussion in 'Editor & General Support' started by Xeong-Hu, Dec 22, 2013.

  1. Xeong-Hu

    Xeong-Hu

    Joined:
    Dec 22, 2013
    Posts:
    3
    Hey dude's whats up. i'm some what new to Unity. I've been using it every now and then. But now i want to use it more seriously because i want to seriously make a game.

    So like i'm trying to start off with something simple like an elemental advantages and disadvantages. For Example. Fire > Grass _ Grass > Water _ Water > Fire. You know like a pokemon elements wheel cycle.


    When ever i run the game. I want to be able to click on Water and then click on Fire, and like make the Object Fire disappear when that happens. Kind of like a simple card game of elements vs elements.

    http://i56.servimg.com/u/f56/13/98/73/49/my_lit10.jpg

    That's how it looks.


    Help me out if you can please. I'd give much respect. :)
     
  2. yustinusadika

    yustinusadika

    Joined:
    Sep 3, 2013
    Posts:
    8
    If you are using MouseClick, you can combine it with RayCast. And check if the RayCast hit the collider (for example, the Fire Icon), you can save it to a temporary variable of the gameobject. Then if you click Grass, and check your temporary variable not empty, then you can do the comparison, for example:
    Code (csharp):
    1.  
    2. GameObject tempVariable;
    3.  
    4. If(Raycast hit not null)
    5. {
    6.      If(tempVariable not null)
    7.      {
    8.            if(hit.collider.name == "Fire"  tempVariable.name == "Grass")
    9.                 tempVariable.SetActive(false);
    10.      }
    11. }
    12.  
    Hopefully it helps :)