コード例 #1
0
    public void LoadDrops(Model_SaveData data)
    {
        if (data.drops == null)
        {
            if (Debug.isDebugBuild)
            {
                Debug.Log("No drops data to load.");
            }
            return;
        }

        Model_PersistentDrop[] dropsData = data.drops;
        foreach (Model_PersistentDrop drop in dropsData)
        {
            float[] vectorArray       = drop.location;
            Vector3 location          = new Vector3(vectorArray[0], vectorArray[1], vectorArray[2]);
            int     dropLevelBehavior = drop.levelBehavior;

            if (game.InstantiateDropById(drop.itemId, location, dropLevelBehavior))
            {
                Debug.Log($"Successful load of persistent drop {drop.itemId}");
            }
            else
            {
                Debug.LogError($"Error in loading persistent drop {drop.itemId}");
            }
        }
    }