IEnumerator Shoot() { CycleMove moves = GetComponent <CycleMove>(); moves.enabled = false; yield return(new WaitForSeconds(3)); Debug.Log("Shot"); line.enabled = true; OnTriggerDamage OTD = line.GetComponent <OnTriggerDamage>(); OTD.damage = true; yield return(new WaitForSeconds(0.2f)); line.enabled = false; OTD.damage = false; moves.enabled = true; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name.Contains("Enemy")) { EnemyStart1 ES = collision.GetComponent <EnemyStart1>(); ES.move = false; CycleMove CM = collision.GetComponent <CycleMove>(); CM.enabled = true; EnemyShooting EnS = collision.GetComponent <EnemyShooting>(); if (EnS != null) { EnS.enabled = true; } LaserShoot las = collision.GetComponent <LaserShoot>(); if (las != null) { las.enabled = true; } } }