Ejemplo n.º 1
0
    public GameObject Spawn(string name)
    {
        if (m_objectStack.ContainsKey(name))
        {
            Stack <GameObject> stack = m_objectStack[name];
            if (stack.Count > 0)
            {
                GameObject t = stack.Pop();

                if (m_resetAction != null)
                {
                    m_resetAction(t);
                }

                t.SetActive(true);
                return(t);
            }
            else
            {
                print("pool is not enough! " + this.name + " " + name);
                GameObject go    = PrefabUtils.GetPrefab(name, prefabType);
                GameObject child = PrefabUtils.AddChild(this.gameObject, go);
                child.layer = go.layer;
                child.name  = name;
                gameObjectToKey.Add(child, name);
                child.SetActive(true);
                return(child);
            }
        }
        else
        {
            Debug.LogWarningFormat("pool no name:[{0}]", name);
            return(null);
        }
    }
Ejemplo n.º 2
0
    public GameObject Instantiate(BattleMapMonsterType monsterType, int sortingOrder)
    {
        string str = monsterType.ToString().ToLower().Replace("_", "");

        GameObject prefab = PrefabUtils.GetPrefab(this, str);

        GameObject go = Instantiate(prefab) as GameObject;

        go.GetComponent <SpriteRenderer>().sortingOrder = sortingOrder;

        return(go);
    }
Ejemplo n.º 3
0
    public GameObject Instantiate(MapObjectType objectType, int sortingOrder)
    {
        string objType = objectType.ToString().Replace("_", "");
        objType = objType.ToLower();

        GameObject prefab = PrefabUtils.GetPrefab(this, objType);

        GameObject go = Instantiate(prefab) as GameObject;

        go.GetComponent<SpriteRenderer>().sortingOrder = sortingOrder;

        return go;
    }
Ejemplo n.º 4
0
    public GameObject Instantiate(BattleMapTile bmt)
    {
        GameObject prefab = PrefabUtils.GetPrefab(this, bmt.MapTileViewType.ToString().ToLower());

        GameObject go = Instantiate(prefab) as GameObject;

        go.name = bmt.Name;

        go.transform.position = bmt.GetMapTilePosition();

        go.GetComponent <SpriteRenderer>().sortingOrder = SORTING_ORDER;

        return(go);
    }
Ejemplo n.º 5
0
 public void ShouImageHui()                                 //根据传来的会牌值   决定是否显示会牌图片
 {
     print("   shou image  " + Game.MJMgr.cardHui);
     if (Game.MJMgr.cardHui != -1)
     {
         GameObject hui = PrefabUtils.GetPrefab(Game.MJMgr.cardHui.ToString(), MyPrefabType.MJ);
         detail.Image_Hui.sprite = hui.transform.FindChild("Image").GetComponent <Image>().sprite;
         detail.Image_Hui.gameObject.SetActive(true);
         detail.Image_BG.gameObject.SetActive(true);
     }
     else
     {
         detail.Image_Hui.gameObject.SetActive(false);
         detail.Image_BG.gameObject.SetActive(false);
     }
 }
    public GameObject Instantiate(EffectType effectType, GameObject parent)
    {
        string str = effectType.ToString().ToLower().Replace("_", "");

        GameObject prefab = PrefabUtils.GetPrefab(this, str);

        GameObject go = Instantiate(prefab);

        // 親のひとつ前に表示
        ParticleSystem attackEffectPs = go.GetComponent <ParticleSystem>();

        attackEffectPs.GetComponent <Renderer>().sortingOrder
            = parent.GetComponent <SpriteRenderer>().sortingOrder + 1;

        // 破棄用リストに追加
        gameObjectList.Add(go);

        return(go);
    }