Пример #1
0
    private void Awake()
    {
        //Singleton pattern
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        //Pipes list
        pipes = new List <Pipe>();

        //Initialize pool
        GameObject poolObject = new GameObject("CloudPool");

        poolObject.transform.parent = transform;
        pipePool = poolObject.AddComponent <PipePool>();

        //Set pool properties
        pipePool.SetPrefab(pipePrefab);
        pipePool.AddObjects(20);

        timer = 0f;
    }
Пример #2
0
        public static async Task InitializeAsync(Shell.IAsyncServiceProvider provider)
        {
            await Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            {
                s_ServerId = SERVER_PREFIX;// + System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
                s_PipePool = new PipePool(s_ServerId);
                s_PipePool.Start();
            }
            {
                s_Service = await provider.GetServiceAsync(typeof(SVsShellDebugger)) as IVsDebugger;

                s_DTE = await provider.GetServiceAsync(typeof(SDTE)) as DTE;
            }
            if (s_Service != null)
            {
                s_Service.AdviseDebuggerEvents(Instance, out s_Cookie);
                s_Service.AdviseDebugEventCallback(Instance);
            }
            try
            {
                await Task.Run(() => InitAdresses());
            }
            catch (Exception ex)
            {
                service.Output.WriteError(ex.ToString());
            }
        }
Пример #3
0
    void Start()
    {
        if (BirdPrefab == null)
        {
            Debug.LogError("Bird prefab was null");
            return;
        }
        var birdGO = Instantiate(BirdPrefab);

        bird = birdGO.GetComponent <Bird>();
        var camera     = Camera.main;
        var halfHeight = camera.orthographicSize;

        birdSpawnXPos = -(camera.aspect * halfHeight) + BirdSpawnXOffset;

        pipePool = new PipePool();
        Button.onClick.AddListener(StartGame);
        pipePool.InitializePool();
    }
Пример #4
0
 private void Awake()
 {
     _pipePool = new Queue <GameObject>();
     instance  = this;
     FillPool();
 }