Example #1
0
    void Start()
    {
        CustomCatalog = catalog.GetCatalog();
        string objectName = gameObject.name;

        foreach (var item in CustomCatalog)
        {
            if (item.category == objectName)
            {
                GameObject newPrefab = Instantiate(prefab, startPosition, transform.rotation) as GameObject;
                newPrefab.name = item.title;
                AchievmentPrefab achievmentPrefab = newPrefab.GetComponent <AchievmentPrefab>();
                newPrefab.transform.SetParent(GameObject.FindGameObjectWithTag("martial").transform, false);
                //achievmentPrefab.SetExp(item.experience.ToString());
                achievmentPrefab.SetTitle(item.title);
                startPosition += delta;
            }
        }
    }
Example #2
0
    public void CreateGoals()
    {
        for (int i = 0; i < gameObject.transform.childCount; i++)
        {
            Destroy(transform.GetChild(i).gameObject);
        }

        for (int i = 0; i < goalsList.Count; i++)
        {
            GameObject newPrefab = Instantiate(prefab, startPosition, transform.rotation);
            newPrefab.name = goalsList[i].title;
            AchievmentPrefab achievmentPrefab = newPrefab.GetComponent <AchievmentPrefab>();
            newPrefab.transform.SetParent(gameObject.transform, false);
            achievmentPrefab.SetTitle(goalsList[i].title);
            achievmentPrefab.SetIndex(i);
            achievmentPrefab.SetId((goalsList[i].id));
            startPosition += delta;
        }
        startPosition = new Vector2(-10, -35);
    }