| | 1 | | using System.Collections.Generic; |
| | 2 | | using DCL.Configuration; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL |
| | 6 | | { |
| | 7 | | public class Asset_AB_GameObject : Asset_WithPoolableContainer |
| | 8 | | { |
| | 9 | | internal AssetPromise_AB ownerPromise; |
| 349 | 10 | | public override GameObject container { get; set; } |
| | 11 | | public bool isInstantiated; |
| | 12 | |
|
| 16 | 13 | | public Asset_AB_GameObject() |
| | 14 | | { |
| 16 | 15 | | isInstantiated = false; |
| 16 | 16 | | container = new GameObject("AB Container"); |
| | 17 | | // Hide gameobject until it's been correctly processed, otherwise it flashes at 0,0,0 |
| 16 | 18 | | container.transform.position = EnvironmentSettings.MORDOR; |
| 16 | 19 | | } |
| | 20 | |
|
| | 21 | | public override void Cleanup() |
| | 22 | | { |
| 17 | 23 | | AssetPromiseKeeper_AB.i.Forget(ownerPromise); |
| 17 | 24 | | Object.Destroy(container); |
| 17 | 25 | | } |
| | 26 | |
|
| | 27 | | public void Show(System.Action OnFinish) |
| | 28 | | { |
| 24 | 29 | | OnFinish?.Invoke(); |
| 24 | 30 | | } |
| | 31 | |
|
| | 32 | | public void Hide() |
| | 33 | | { |
| 1 | 34 | | container.transform.parent = null; |
| 1 | 35 | | container.transform.position = EnvironmentSettings.MORDOR; |
| 1 | 36 | | } |
| | 37 | | } |
| | 38 | | } |