public void ShootAndLandMineUi(Vector2 direction = default(Vector2)) { UIJoystick Uijoy = FindObjectOfType <UIJoystick>(); //shoot bullet on left mouse click if (projectile == false && landmine == false) { Uijoy.UIBullet(); Shoot(); } else if (landmine == true && projectile == false) { GameObject obj = PoolManager.Spawn(bullets[2], transform.position, Quaternion.identity); obj.GetComponent <Landmine>().stateWepon = StateWepon; landmine = false; } }
IEnumerator OnProjectileShootRoutine() { while (true) { UIJoystick Uijoy = FindObjectOfType <UIJoystick>(); //shoot bullet on left mouse click if (projectile == false && landmine == false) { Uijoy.UIBullet(); if (Input.GetButton("Fire1")) { Shoot(); } } else if (projectile == true && landmine == false) { Uijoy.UIProjectile(); if (Input.GetButton("Fire1")) { m_BulletSpeed += Time.deltaTime * 5f; DrawLineProjectile(); } else if (Input.GetButtonUp("Fire1")) { ShootProjectile(); projectile = false; m_BulletSpeed = defaultBulletSpeed; renderLine.positionCount = 0; lastProjectilePosition.gameObject.SetActive(false); yield return(new WaitForSeconds(fireRate)); } } else if (landmine == true && projectile == false) { Uijoy.UILandmine(); if (Input.GetButton("Fire1")) { // PoolManager.Spawn(landMine, transform.position, Quaternion.identity); GameObject obj = PoolManager.Spawn(bullets[2], transform.position, Quaternion.identity); obj.GetComponent <Landmine>().stateWepon = StateWepon; landmine = false; } } else { landmine = false; projectile = false; } yield return(null); } }