コード例 #1
0
ファイル: PoolGameObjects.cs プロジェクト: TD6370/TheCell
    public override string ToString()
    {
        string infoObj = GameObjectNext == null ? "NOT" : GameObjectNext.name +
                         " pool:" + GameObjectNext.GetComponent <EventsObject>().PoolCase.Name + " " +
                         GameObjectNext.GetComponent <EventsObject>().PoolCase.NameObject;
        string info = "[" + TimeCreate.TimeOfDay + "] " + Name + " " + NameObject + " -- " + Tag + " " + infoObj;

        //return base.ToString();
        return(info);
    }
コード例 #2
0
ファイル: PoolGameObjects.cs プロジェクト: TD6370/TheCell
    public void Activate(string nameObj, string tag, Vector3 pos)
    {
        //#TEST
        if (PoolGameObjects.IsTestingDestroy)
        {
            if (GameObjectNext == null)
            {
                Debug.Log("##########\\\\\\\\\\\\\\\\ Pool contains null object ");
            }
        }

        IsLock     = true;
        NameObject = nameObj;

        TimeCreate = DateTime.Now;
        if (GameObjectNext == null)
        {
            Debug.Log("#### Activate >> Object is null " + NameObject);
            return;
        }

        //GameObjectNext.SetActive(true);
        GameObjectNext.transform.SetParent(null);
        SpriteRenderer renderer = GameObjectNext.GetComponent <SpriteRenderer>();

        if (renderer != null) //FIX portal
        {
            //#FIX TAG
            if (GameObjectNext.tag == "Field")
            {
                GameObjectNext.tag = tag;
            }
            if (GameObjectNext.tag == "PrefabField" || GameObjectNext.tag == PoolGameObjects.TypePoolPrefabs.PoolFloor.ToString())
            {
                //fix alpha field
                renderer.sortingLayerName = Helper.LayerFloorName;
            }
            renderer.color = Color.white;
            //set default effect alpha
            renderer.SetAlpha(1f);
        }
        GameObjectNext.transform.position = pos;
        GameObjectNext.name = nameObj;

        var movement = GameObjectNext.GetComponent <MovementBoss>();

        if (movement == null)
        {
            //Debug.Log("SetActive NO NPC " + nameObj);
            GameObjectNext.SetActive(true);
        }

        //#TEST
        if (PoolGameObjects.IsTestingDestroy)
        {
            if (GameObjectNext == null)
            {
                Debug.Log("##########\\\\\\\\\\\\\\\\ Pool contains null object ");
            }
        }
    }