Ejemplo n.º 1
0
    // Since the GameManager doesnt delete itself between scene reloads, we need a function to cache what
    // is needed again, since those objects will be deleted. Basically this is a Start() function more or less
    void Init()
    {
        gameBegan = false;

        collectedCollecibles = 0; // reset score
        invController        = GameObject.FindGameObjectWithTag("InventoryController").GetComponent <InventoryController>();

        GameObject p = GameObject.FindGameObjectWithTag("Player");

        dragScript   = p.GetComponent <Drag>();
        adjustScript = p.GetComponent <AdjustObjects>();
        wireEditor   = p.GetComponent <WireEditor>();
    }
Ejemplo n.º 2
0
    void Start()
    {
        if (parentInteractiveObject == null)
        {
            if (transform.parent.parent.gameObject.GetComponent <InteractiveObject>() == null)
            {
                Debug.LogError("This connection point could not find it's parents InteractiveObject", gameObject);
            }
            else
            {
                parentInteractiveObject = transform.parent.parent.gameObject.GetComponent <InteractiveObject>();
            }
        }

        if (connectionID == -1)
        {
            if (!transform.parent.parent.gameObject.GetComponent <InteractiveObject>().draggable)
            {
                Debug.LogError("!!! This connection point does not have a manually set ID !!!", gameObject);
            }

            connectionID = largestNaturalConnectionID;
            largestNaturalConnectionID++;
        }

        wireEditor = GameObject.FindGameObjectWithTag("Player").GetComponent <WireEditor>();
        glowObject = transform.parent.Find("glow").gameObject;
        if (glowObject == null)
        {
            Debug.LogError("Could not find a glow object for this connection point", gameObject);
        }

        sr            = gameObject.GetComponent <SpriteRenderer>();
        defaultSprite = sr.sprite;
        lidSprite     = Resources.Load <Sprite>("socket_lid");
    }