public void LoadBlock()
    {
        gameObject.name = objectName;
        gameObject.tag  = objectTag;
        blockRb         = gameObject.GetComponent <Rigidbody>();

        if (isInventoryObJect)
        {
            transform.SetParent(GameObject.FindGameObjectWithTag("Inventory").transform);
            transform.position   = transform.parent.position;
            transform.rotation   = transform.parent.rotation;
            transform.localScale = objectScale;
            blockRb.useGravity   = false;
            gameObject.SetActive(false);
        }
        else
        {
            transform.position = objectPosition;

            transform.rotation   = Quaternion.Euler(objectRotation);
            transform.localScale = objectScale;

            if (hasGlueScript == true)
            {
                //Debug.Log("GlueScriptAdded");
                GlueScript glueScript = gameObject.AddComponent <GlueScript>();
                glueScript.justLoaded = true;
            }
        }
    }
Exemple #2
0
 // Start is called before the first frame update
 void Start()
 {
     active      = true;
     glueS       = glue.GetComponent <GlueScript>();
     glueBuildup = MINIMUM_GLUE_BUILDUP;
 }