Пример #1
0
    private void SpawnObject()
    {
        GameObject effectObject  = EffectObjectPool.instance.GetObject(GetRandomSpawnObject());
        Bounds     bounds        = effectObject.GetComponent <SpriteRenderer>().bounds;
        Vector3    spawnPosition = new Vector3(Random.Range(0, Screen.width), Random.Range(Screen.height * 11f / 10, Screen.height * 12f / 10));

        spawnPosition = CameraManager.mainCamera.ScreenToWorldPoint(spawnPosition);
        spawnPosition = ObjectUtils.ClampXPositionToScreen(spawnPosition, bounds);

        effectObject.transform.position = new Vector3(spawnPosition.x, spawnPosition.y, 0);
        effectObject.GetComponent <IShootableObject>().StartObject(_currentIncreasePercentage);
    }