Why it cant shoot the ammo? I have already put break under the condition
void Update()
{ ammo2time += Time.deltaTime;
gameObject.transform.position += new Vector3(0, -0.02f, 0);
}
void Switch()
{
switch (caseswitch)
{
case 0:
break;
case 1:
if (ammo2time > 0.30f)
{
Vector3 Bullet_pos = Ship.transform.position + new Vector3(0, 0.6f, 0);
Instantiate(ammo2, Bullet_pos, Ship.transform.rotation);
ammo2time = 0;
}
return;
}
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.tag == "plane")
{
Destroy(gameObject);
caseswitch = 1;
}
}
}