I have seen a tutorial when one person made a 3d menu and when you select it it moves closer to the camera(it pulls out). I made it but the tutorial shows only when i do it with keyboard buttons (up and down). I want to do it with the mouse(when i mouse over it). How you see in MenuManager there is if(Input.GetAxisRaw("vertical"). Is there a way to do it with mouse ?? I mean i can pull out selected objects with up and down button of the keyboard. I want to pull out objects when i mouse over it. Can you pls help ?
Pls help
I will show you the java script:
menuItem
function OnSelected(on:boolean)
{
//I just got selected
if(on)
{
iTween.MoveTo(gameObject,{"z":-5, "time":0.5});
}
else //I just got deselected
{
iTween.MoveTo(gameObject,{"z":-2, "time":0.5});
}
}
MenuManager
var menuItems:menuItem[]; // list of MenuItem(s)
var currentMenuItem:int = 0;
var keyDelay:float = 0.25;
function Start()
{
menuItems[currentMenuItem].OnSelected(true);
while(true)
{
if(Input.GetAxisRaw("Vertical") > 0.9)
{
menuItems[currentMenuItem].OnSelected(false);
currentMenuItem--;
if(currentMenuItem < 0) currentMenuItem = 0;
menuItems[currentMenuItem].OnSelected(true);
yield new WaitForSeconds(keyDelay);
}
else if(Input.GetAxisRaw("Vertical") < -0.9)
{
menuItems[currentMenuItem].OnSelected(false);
currentMenuItem++;
if(currentMenuItem >= menuItems.length) currentMenuItem = menuItems.length - 1;
menuItems[currentMenuItem].OnSelected(true);
yield new WaitForSeconds(keyDelay);
}
yield;
}
}