Пример #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!(collision.gameObject.tag == "EventTrigger"))
     {
         tbc.ChangeText("Press E to interact");
     }
 }
Пример #2
0
    void OpenBook()
    {
        openbook.Invoke();
        string componentString = LanguageManager.Singleton.components.GetAlienByIndex(id) + " = " + LanguageManager.Singleton.components.GetTypeByIndex(id) + " component";
        string socketString    = LanguageManager.Singleton.sockets.GetAlienByIndex(id) + " = " + LanguageManager.Singleton.sockets.GetTypeByIndex(id) + " socket";

        TextBoxController.ChangeText(componentString + "\n" + socketString, false);
        bookOpen = true;
        SendItButton.SetActive(false);
    }
Пример #3
0
    public RepairSet CreateRepairSetLocal()
    {
        int difficulty = DifficultyManager.Singleton.Difficulty;

        //Instantiate repairset
        GameObject rsObject  = Instantiate(repairSetPrefab, repairSetHolder);
        RepairSet  repairSet = rsObject.GetComponent <RepairSet>();

        //Instantiate repairable object
        GameObject       repairable       = Instantiate(repairablePrefabs[Random.Range(0, repairablePrefabs.Length)], rsObject.transform);
        RepairableObject repairableObject = repairable.GetComponent <RepairableObject>();

        //Instantiate components
        int nComponents = componentsPerLevel[difficulty];

        SocketComponent[] components      = new SocketComponent[nComponents];
        GameObject[]      prefabSelection = Utils.RandomSelection <GameObject>(componentPrefabs, nComponents);
        for (int i = 0; i < nComponents; ++i)
        {
            GameObject g = Instantiate(prefabSelection[i], rsObject.transform);
            components[i] = g.GetComponent <SocketComponent>();

            //Place components in a circle around the repairable
            g.transform.localPosition = Quaternion.Euler(0f, 360 * i / nComponents, 0f) * (Vector3.left * componentRadius) + Vector3.up * .3f;
        }

        //Instantiate sockets
        int nSockets = socketsPerLevel[difficulty];

        Socket[] sockets = new Socket[nSockets];
        prefabSelection = Utils.RandomSelection <GameObject>(socketPrefabs, nSockets);

        string instructions = "";

        for (int i = 0; i < nSockets; ++i)
        {
            GameObject g = Instantiate(prefabSelection[i]);
            sockets[i] = g.GetComponent <Socket>();
            sockets[i].CorrectComponent = components[i].componentType;

            string ComponentString = LanguageManager.Singleton.components.TranslateToAlien(components[i].componentType);
            string SocketString    = LanguageManager.Singleton.sockets.TranslateToAlien(sockets[i].SocketType);
            instructions += ComponentString + " -> " + SocketString + "\n";
        }

        TextBoxController.ChangeText(instructions);

        //Attach sockets
        repairableObject.AddRandomSockets(sockets);

        //Set references
        repairSet.SetReferences(repairableObject, sockets, components);

        return(repairSet);
    }
Пример #4
0
    public void Interact(GameObject player)
    {
        InventoryController inv = player.gameObject.GetComponent <InventoryController>();

        if (WorldVariables.doors[doorId])
        {
            SceneManager.LoadScene(goTo);
        }
        else if (!WorldVariables.doors[doorId] && inv.HasItem(IdKey))
        {
            inv.RemoveItem(IdKey);
            WorldVariables.doors[doorId] = true;
            SceneManager.LoadScene(goTo);
        }
        else
        {
            tb.ChangeText("Locked door...");
        }
    }
Пример #5
0
    public void Interact(GameObject player)
    {
        InventoryController inv = player.gameObject.GetComponent <InventoryController>();

        if (unlocked && !opened)
        {
            ChangeState();
        }
        else if (!unlocked && inv.HasItem(IdKey))
        {
            inv.RemoveItem(IdKey);
            unlocked = true;
            ChangeState();
        }
        else if (opened)
        {
            ChangeState();
        }
        else
        {
            tb.ChangeText("Locked door. I need a key...");
        }
    }