コード例 #1
0
    private void Start()
    {
        this.dict = new Dictionary <int, Star>();

        foreach (CollectibleStar star in FindObjectsOfType <CollectibleStar>())
        {
            if (!star.IsBigStar)
            {
                Star uiStar = Instantiate <Star>(uiPrefab);
                dict.Add(star.gameObject.GetInstanceID(), uiStar);
                uiStar.transform.SetParent(starHolder.transform);
            }
            else
            {
                if (bigStar != null)
                {
                    throw new UnityException("Only one big star is allowed!");
                }
                this.bigStar = star;
            }
        }
        if (bigStar == null)
        {
            throw new UnityException("No big star in scene!");
        }
    }
コード例 #2
0
 public void SetCollectible(CollectibleStar star)
 {
     this.collectible = star;
 }