コード例 #1
0
ファイル: UnitSlot.cs プロジェクト: ChoiIngon/CitadelDefense
 // Use this for initialization
 void Start()
 {
     GetComponent <SpriteRenderer> ().sprite = normalSprite;
     touch.onTouchDown += (Vector3 position) =>
     {
         GameManager.Instance.uiHeroShopPanel.gameObject.SetActive(true);
         GameManager.Instance.selectedSlot = this;
         foreach (CitadelParts parts in GameManager.Instance.citadel.citadelParts)
         {
             parts.slot.selected = false;
         }
         this.selected = true;
         if (null != equippedUnit)
         {
             GameManager.Instance.selectedUnit = equippedUnit;
             for (int i = 0; i < GameManager.Instance.uiHeroShopPanel.content.childCount; i++)
             {
                 ContentHeroShop contentHeroShop = GameManager.Instance.uiHeroShopPanel.content.GetChild(i).GetComponent <ContentHeroShop>();
                 if (equippedUnit == contentHeroShop.unit)
                 {
                     GameManager.Instance.uiHeroInfoPanel.gameObject.SetActive(false);
                     GameManager.Instance.uiHeroInfoPanel.contentHeroShop = contentHeroShop;
                     GameManager.Instance.uiHeroInfoPanel.gameObject.SetActive(true);
                     break;
                 }
             }
         }
     };
 }
コード例 #2
0
 void Init()
 {
     while (0 < content.childCount)
     {
         Transform child = content.GetChild(0);
         child.SetParent(null);
         Object.Destroy(child.gameObject);
     }
     foreach (var itr in GameManager.Instance.citadel.heros)
     {
         HeroUnit        unit            = itr.Value;
         ContentHeroShop contentHeroShop = GameObject.Instantiate <ContentHeroShop>(contentPrefab);
         contentHeroShop.SetUnit(unit);
         contentHeroShop.transform.SetParent(content);
         contentHeroShop.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
     }
 }