Ejemplo n.º 1
0
    // Erstellen der logischen und sichtbaren Auswahl an "Things" die man nach anklicken eines "Things" zur Verfügung hat --- GETESTET UND FUNKTIONIERT
    IEnumerator SwitchGrid(Thing ts1)
    {
        yield return null;
        foreach (Thing t in ThingsInDaGame)
            t.Darken();

        ts1.Brighten();

        if (toSwitch[0].transform.position.x == xCoordinates[0])
        {
            Debug.LogError("Thing ist ganz links");
            foreach (Thing t in ThingsInDaGame)
                if (t.transform.position == new Vector3(xCoordinates[1], toSwitch[0].transform.position.y, 0))
                    t.Brighten();
        }

        else if (toSwitch[0].transform.position.x == xCoordinates[xCoordinates.Length-1])
        {
            Debug.LogError("Thing ist ganz rechts");
            foreach (Thing t in ThingsInDaGame)
                if (t.transform.position == new Vector3(xCoordinates[xCoordinates.Length-2], toSwitch[0].transform.position.y, 0))
                    t.Brighten();
        }

        else
        {
            Debug.LogError("Thing ist in der Mitte. X");
            foreach (Thing t in ThingsInDaGame)
                if (t.transform.position == new Vector3(toSwitch[0].transform.position.x-0.5f, toSwitch[0].transform.position.y, 0) ||
                    t.transform.position == new Vector3(toSwitch[0].transform.position.x+0.5f, toSwitch[0].transform.position.y, 0))
                    t.Brighten();
        }

        if (toSwitch[0].transform.position.y == yCoordinates[0])
        {
            Debug.LogError("Thing ist ganz oben");
            foreach (Thing t in ThingsInDaGame)
                if (t.transform.position == new Vector3(toSwitch[0].transform.position.x, yCoordinates[1], 0))
                    t.Brighten();
        }

        else if (toSwitch[0].transform.position.y == yCoordinates[yCoordinates.Length-1])
        {
            Debug.LogError("Thing ist ganz unten");
            foreach (Thing t in ThingsInDaGame)
                if (t.transform.position == new Vector3(toSwitch[0].transform.position.x, yCoordinates[yCoordinates.Length-2], 0))
                    t.Brighten();
        }

        else
        {
            Debug.LogError("Thing ist in der Mitte. Y");
            foreach (Thing t in ThingsInDaGame)
                if (t.transform.position == new Vector3(toSwitch[0].transform.position.x, toSwitch[0].transform.position.y-0.5f, 0) ||
                    t.transform.position == new Vector3(toSwitch[0].transform.position.x, toSwitch[0].transform.position.y+0.5f, 0))
                    t.Brighten();
        }
    }