コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (!unlockAnimation.isPlaying && waitingTrophies.Count > 0)
     {
         trophyController.SetTrophyValues(waitingTrophies[0].name, waitingTrophies[0].descr, waitingTrophies[0].img, false);
         unlockAnimation.Play();
         Debug.Log(waitingTrophies[0].name);
         waitingTrophies.RemoveAt(0);
     }
 }
コード例 #2
0
    public void CreateTrophyObj(string name, string description, Sprite image, bool locked, GameObject container, int trophyNum, int trophyCount)
    {
        GameObject trophyObj = (GameObject)Instantiate(trophyPrefab);

        trophyObj.transform.SetParent(container.transform);
        trophyObj.transform.localScale = new Vector3(1, 1, 1);

        TrophyController trophyController = trophyObj.GetComponent <TrophyController>();

        trophyController.SetTrophyValues(name, description, image, locked);

        float width       = trophyObj.GetComponent <RectTransform>().rect.width;
        float startOffset = ((width / 2) - ((width / 2) * trophyCount));

        trophyObj.transform.localPosition = new Vector3(startOffset + (trophyNum * width), 0, 0);
    }