Example #1
0
        /// <summary>
        /// Performs necessary tasks to load asset from saved data. Specifically
        /// creates the GameObject.
        /// </summary>
        /// <param name="data"></param>
        public static void LoadSavedAsset(GameAssetData data)
        {
            // Get the asset
            var asset = GetAssetByStringID(data.AssetTypeID);
            // Create the game object
            var assetGameObject = Instantiate(asset.AssetPrefab, data.Position,
                                              Quaternion.Euler(data.RotationEuler).normalized);

            data.GameObject = assetGameObject;
            // Initialize GameData from save
            data.InitializeFromSave();
        }
Example #2
0
 /// <summary>
 /// Creates a container with the given data & GO. Type is assigned in constructor.
 /// No more stupid long calls to get the Type. You're welcome.
 /// </summary>
 /// <param name="data"></param>
 /// <param name="assetGameObject"></param>
 public GameAssetContainer(GameAssetData data, GameObject assetGameObject)
 {
     Data       = data;
     Type       = AssetManager.GetAssetByStringID(data.AssetTypeID);
     GameObject = assetGameObject;
 }
Example #3
0
 public GameAssetContainer(GameAssetData data, GameAsset assetType, GameObject assetGameObject)
 {
     Data       = data;
     Type       = assetType;
     GameObject = assetGameObject;
 }
Example #4
0
 public AssetCreatedEventArgs(GameAssetData data, GameAsset asset, GameObject gameObject)
 {
     Container = new GameAssetContainer(data, asset, gameObject);
 }