private BoomerangBullet SpawnBullet() { BoomerangBullet boomerangBullet = null; PoolObjectType poolObjType = PoolObjectType.BoomerangProjectile; GameObject boomerangObject = ObjectPool.Instance.GetObject(poolObjType); if (boomerangObject) { boomerangBullet = boomerangObject.GetComponent <BoomerangBullet>(); if (boomerangBullet) { boomerangBullet.transform.position = bulletSpawnPoint.position; boomerangBullet.transform.forward = transform.forward; boomerangBullet.transform.rotation = Quaternion.Euler(0f, boomerangBullet.transform.rotation.eulerAngles.y, 0f); boomerangBullet.Initialize(boomerangSpeed, damage, timeUntilBoomerangDestroyed, rayDistanceMultiplier, raycastLayermask, maxDistance, maxBounces); if (wielderStats.gameObject.CompareTag(Strings.Tags.PLAYER)) { boomerangBullet.SetShooterType(false); } else { boomerangBullet.SetShooterType(true); } } } return(boomerangBullet); }
public override void FireBullet(Vector3 firePos, Vector3 fireDirection) { if (canFire() == false) { return; } FireDelayOn(); PlayFireAnim(); useBullet(); SoundManager.Instance.PlaySoundEffect("Boomerang"); if (loadObject != null) { GameObject makeObj = GameObject.Instantiate(loadObject, TemporaryObjects.Instance.transform); if (makeObj != null) { BoomerangBullet bounceBullet = makeObj.GetComponent <BoomerangBullet>(); bounceBullet.Initialize(firePos, fireDirection, damage); } } }