Esempio n. 1
0
    protected bool isEntry(int leftx, int rightx, int y)
    {
        // First Entry
        Vector3 entryPos = myMap.getEntranceBarrierPos();

        if ((entryPos[0] == leftx && entryPos[1] == y) || (entryPos[0] == rightx && entryPos[1] == y))
        {
            return(true);
        }
        // Second Entry
        List <KeyValuePair <int, int> > entryPos2 = myMap.multi_ent_pos_set;

        if ((entryPos2[0].Key == leftx && entryPos2[0].Value == y) || (entryPos2[0].Key == rightx && entryPos2[0].Value == y))
        {
            return(true);
        }
        return(false);
    }
Esempio n. 2
0
    void Update()
    {
        //Waiting for step1
        if (!dialoguesCompleted[0])
        {
            Vector3 entryPos = myMap.getEntranceBarrierPos();
            if (!myMap.getTrainsPosSet().Contains(myMap.TwoDToOneD((int)entryPos[0] + 1, (int)entryPos[1]))) // Step 1 Fullfiled
            {
                dialoguesCompleted[0] = true;
                // Replace
                dialogues[0].SetActive(false);
                dialogues[1].SetActive(true);
            }
            else
            {
                return;
            }
        }

        //Waiting for step2
        if (!dialoguesCompleted[1])
        {
            Vector3 entryPos = myMap.getEntranceBarrierPos();
            if (!myMap.getCarsPosSet().Contains(myMap.TwoDToOneD((int)entryPos[0], (int)entryPos[1]))) // Step 2 Fullfiled
            {
                dialoguesCompleted[1] = true;
                // Replace
                dialogues[1].SetActive(false);
                dialogues[2].SetActive(true);
            }
            else
            {
                return;
            }
        }

        //Waiting for step3
        if (!dialoguesCompleted[2])
        {
            Vector3 exitPos = myMap.getExitPos();
            if (!myMap.getTrainsPosSet().Contains(myMap.TwoDToOneD((int)exitPos[0] - 1, (int)exitPos[1])) &&
                !myMap.getTrainsPosSet().Contains(myMap.TwoDToOneD((int)exitPos[0] - 2, (int)exitPos[1])))  // Step 3 Fullfiled
            {
                dialoguesCompleted[2] = true;
                // Replace
                dialogues[2].SetActive(false);
                dialogues[3].SetActive(true);
            }
            else
            {
                return;
            }
        }
        //Waiting for step4
        if (!dialoguesCompleted[3])
        {
            if (GameObject.Find("ACarObject0") == null) // Step 4 Fullfiled
            {
                dialoguesCompleted[3] = true;
                // Replace
                dialogues[3].SetActive(false);
                finishDialogues = true;
            }
            else
            {
                return;
            }
        }
    }