コード例 #1
0
 void Awake()
 {
     _pool = new Stack <TimeLabel>();
     for (int i = 0; i < POOLS_SIZE; i++)
     {
         Transform timeLabelTF = Instantiate(timeLabelPrefab, timeLabelPrefab.position, Quaternion.identity) as Transform;
         timeLabelTF.parent = timePenaltyParent;
         TimeLabel timeLabel = timeLabelTF.GetComponent <TimeLabel>();
         timeLabel.OnReturnToPool.AddListener += OnReturnToPoolEvent;
         timeLabel.Init(timeLabelPrefab.position, timeLabelPrefab.position - 0.2f * Vector3.up);
         _pool.Push(timeLabel);
     }
 }