Hi,
In our game,I can trigger a bomb when a button is pressed and next bomb could only be placed after 3 seconds.so we created a timer that start when we hit that button .Everything worked fine when i used GetKey for web platform.But now we are converting game to android so i used GetTouch.My problem is
-->Bomb instantiates and timer starts but it stops when i stop touching the button.It again continues only if i touch it again.
-->What can I do to make timer run continuously even if i touch fire button once.
if(Bomb_Button.HitTest(Input.GetTouch(0).position))
{
if(Instance == true)
{
Bomb_Temp = Instantiate (Bomb, Bomb_Place.transform.position, Quaternion.Euler (0, 0, 0)) as GameObject;
Explosion_Position = Bomb_Temp.transform.position;
Explosion_Rotation = Bomb_Temp.transform.rotation;
Bomb_Click = true;
Instance = false;
Expose_Instance = true;
}
}
if(Bomb_Click == true)
{
Bomb_Time += Time.deltaTime;
if(Bomb_Time >= 3f)
{
Destroy(Bomb_Temp);
Bomb_Time = 0;
Bomb_Click = false;
Bomb_Visible = true;
}
}
if(Bomb_Visible == true)
{
if(Expose_Instance == true)
{
audio.PlayOneShot (Explosion_Sound);
Explosion_Temp = Instantiate (Explosion, Explosion_Position, Explosion_Rotation)as GameObject;
Expose_Instance = false;
}
Explosion_Time += Time.deltaTime;
if(Explosion_Time >= 2f)
{
Destroy(Explosion_Temp);
Explosion_Time = 0;
Bomb_Visible = false;
Instance = true;
}
}