Hello
I am having some problems with using GUITextures for input on the iPhone.
I have 3 GuiTextures - Left Movement / Right Movement / Fire
I have a script attached to the player controller. All of the buttons work individually, but I can't move and shoot at the same time. Here is the code I'm using to detect input on the three buttons:
function Update ()
{
for (var i = 0; i < Input.touchCount; ++i)
{
var evt : Touch = Input.GetTouch(i);
var myLeftHitTest = ArrowLeft.HitTest(Input.mousePosition);
var myRightHitTest = ArrowRight.HitTest(Input.mousePosition);
var FireTest = Fire.HitTest(Input.mousePosition);
if (evt.phase == TouchPhase.Stationary)
{
if(myLeftHitTest)
{
//Move player left
}
if(myRightHitTest)
{
//Move player right
}
}
if(evt.phase == TouchPhase.Began)
{
if(FireTest)
{
//instantiate bullet
}
}
}
}
Any help would be greatly appreciated!
Thanks