Esempio n. 1
0
    //public void Deactivate(string gobjName="", bool isCreatedNew = false, GameObject gobj =null)
    public void Deactivate()
    {
        if (GameObjectNext == null)
        {
            Debug.Log("#### Deactivate >> Object is null " + NameObject);
            return;
        }


        NameObject = "";

        GameObjectNext.SetActive(false);
        GameObjectNext.transform.SetParent(Storage.GenGrid.PanelPool.transform);
        //set default effect alpha
        //GameObjectNext.GetComponent<SpriteRenderer>().SetAlpha(1f);

        IsLock = false;

        //#TEST
        if (PoolGameObjects.IsTestingDestroy)
        {
            if (GameObjectNext == null)
            {
                Debug.Log("##########\\\\\\\\\\\\\\\\ Pool contains null object ");
            }
        }
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    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 ");
            }
        }
    }