Exemplo n.º 1
0
	public override void PrepareAction (){
		base.PrepareAction ();
		if (splashesPooler == null) {
			GameObject splashesObject = (GameObject) Instantiate (splashesPoolerPrefab, Vector3.zero, Quaternion.identity);
			splashesPooler = splashesObject.GetComponent<ObjectsPooler> ();
		}
	}
Exemplo n.º 2
0
    private List <GameObject> pooledObjects; //list de TOUT les objets...

    #endregion

    #region Initialization

    /// <summary>
    /// Init
    /// </summary>
    public void SetSingleton()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 3
0
 private void Awake()
 {
     if (sharedInstance == null)
     {
         sharedInstance = this;
         Debug.Log("sharedinstance created");
     }
     else if (sharedInstance != this)
     {
         Destroy(gameObject);
         Debug.Log("destroyed dup");
     }
 }
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            DestroyImmediate(gameObject);
        }

        instance = this;

        var filePath = Path.Combine(Application.streamingAssetsPath, "pools.json");

        if (File.Exists(filePath))
        {
            var json = File.ReadAllText(filePath);
            pools = JsonConvert.DeserializeObject <Pool[]>(json).ToDictionary(pool => pool.Id);
        }

        SetPoolContainers();
        StartCoroutine(PrewarmPools());
    }
 private void Awake()
 {
     Instance = this;
 }