コード例 #1
0
ファイル: Level.cs プロジェクト: DieselPuppet/DatingDash
    public void configure(LevelDesc desc)
    {
        _desc = desc;

        CustomerSpawn cs = (CustomerSpawn)_desc.customersQueue[0];

        _spawnDelay = cs.delay;

        _lastSpawnTime = Time.time;
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     instance          = this;
     transferScene     = FindObjectOfType <TransferScene>();
     customerSpawn     = FindObjectOfType <CustomerSpawn>();
     objmanager        = FindObjectOfType <objmanager>();
     start             = true;
     _runtime          = gameObject.GetComponent <Slider>();
     _runtime.value    = startTime;
     _runtime.minValue = 0f;
     _runtime.maxValue = 250f;
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        ok       = true;
        usingplace.Clear();

        place.Add(new Vector3(15.5f, -3.3f, 0f));
        place.Add(new Vector3(22f, -3.3f, 0f));
        place.Add(new Vector3(15.5f, 1.9f, 0));
        place.Add(new Vector3(22f, 1.9f, 0f));
        place.Add(new Vector3(22f, 6.7f, 0f));
        place.Add(new Vector3(15.5f, 6.7f, 0f));
    }
コード例 #4
0
    public void CheckFood()
    {
        inventory = FindObjectOfType <Inventory>();
        inventory.GetItemInList();
        Item[] PlayerSelectedFood = inventory.GetItemInList();
        CS = FindObjectOfType <CustomerSpawn>();
        Recipe CorrectRecipeFoods   = Resources.Load <Recipe>("recipes/" + CS.chosenDish);
        int    counter              = CorrectRecipeFoods.foods.Length;
        int    PlayerSelectedLength = PlayerSelectedFood.Length;

        for (var i = 0; i < CorrectRecipeFoods.foods.Length; i++)
        {
            bool correct = false;

            for (var k = 0; k < PlayerSelectedLength; k++)
            {
                if (CorrectRecipeFoods.foods[i] == PlayerSelectedFood[k])
                {
                    PlayerSelectedFood[k] = null;
                    counter--;
                    Debug.Log("counter:" + counter);
                    correct = true;
                    break;
                }
            }

            if (correct == false)
            {
                setWrong();
                return;
            }

            if (counter == 0)
            {
                for (var k = 0; k < PlayerSelectedLength; k++)
                {
                    if (PlayerSelectedFood[k] != null)
                    {
                        setWrong();
                        return;
                    }
                }

                setCorrect();
                CS = FindObjectOfType <CustomerSpawn>();
                CS.Invoke("destroyCustomer", destroyWait);
            }
        }
    }
コード例 #5
0
    public void parse(TextAsset sources)
    {
        XmlDocument doc = new XmlDocument();

        doc.LoadXml(sources.text);

        XmlNode rootNode = doc.FirstChild;
        XmlNode levels   = doc.SelectSingleNode("Levels");

        XmlNodeList levelsList = levels.ChildNodes;

        foreach (XmlNode node in levelsList)
        {
            LevelDesc desc = new LevelDesc();
            string    name = node.Name;

            XmlNodeList linesList = node.SelectNodes("Lines/SpawnLine");
            foreach (XmlNode line in linesList)
            {
                foreach (XmlNode customer in line.ChildNodes)
                {
                    CustomerSpawn cs = new CustomerSpawn();
                    cs.delay = float.Parse(customer.Attributes["Delay"].Value);
                    cs.type  = customer.Name;

                    int ordersCount = customer.SelectNodes("Order").Count;
                    cs.orders = new string[ordersCount];

                    int i = 0;
                    foreach (XmlNode order in customer.SelectNodes("Order"))
                    {
                        cs.orders[i++] = order.Attributes["Name"].Value;
                    }

                    desc.customersQueue.Add(cs);
                }
            }

            _levelsDict.Add(name, desc);
        }
    }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        // Don't update if the game is over
        if (!CustomerSpawn.GameIsOver())
        {
            // Decrease timer at rate determined by customer satisfaction
            timer -= Time.deltaTime * anger;

            // When timer elapses, customer leaves and deducts points in dissatisfaction
            if (timer <= 0.0)
            {
                if (anger == 1.0)
                {
                    P1Movement.ScorePenalty(BASE_PENALTY * numIngredients);
                    P2Movement.ScorePenalty(BASE_PENALTY * numIngredients);
                }

                // Determine which player(s) deserve(s) the penalty
                else
                {
                    if (aScale > 0)
                    {
                        P1Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2);
                    }
                    else if (aScale < 0)
                    {
                        P2Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2);
                    }
                    else
                    {
                        P1Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2);
                        P2Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2);
                    }
                }
                CustomerSpawn.SetOccupied(custID, false);
                Destroy(gameObject);
            }
        }
    }
コード例 #7
0
ファイル: Level.cs プロジェクト: DieselPuppet/DatingDash
    // move to courutine?
    public void process(GameMode mode)
    {
        if (!_isComplete)
        {
            float currentTime = Time.time;
            if ((currentTime - _lastSpawnTime) > _spawnDelay)
            {
                CustomerSpawn cs = (CustomerSpawn)_desc.customersQueue[0];
                spawnCustomer(CustomersCollection.instance.getDesc(cs.type), cs.orders);

                _desc.customersQueue.RemoveAt(0);

                if (_desc.customersQueue.Count > 0)
                {
                    cs          = (CustomerSpawn)_desc.customersQueue[0];
                    _spawnDelay = cs.delay;
                }

                _lastSpawnTime = currentTime;
            }

            if (_customerQueue.Count > 0 && spawnArea.freePointExist())
            {
                Customer customer = (Customer)_customerQueue[0];
                customer.gameObject.SetActive(true);
                spawnArea.placeCustomer(customer);

                _customerQueue.RemoveAt(0);
            }

            if (mode == GameMode.COMPANY && checkTasks())
            {
                _isComplete = true;
            }
        }
    }
コード例 #8
0
    // Checks proximity with stations and interacts with them
    void CheckObjects(Vector3 pos)
    {
        // Cutting board: hold still and chop a vegetable if player is holding one
        if (Vector3.Distance(pos, chopBoard.transform.position) <= 1.5)
        {
            if (leftHandOccupied && leftHandVeggie.tag != "Salad")
            {
                boardVeggie = Instantiate(leftHandVeggie) as GameObject;
                Vector3 surface = chopBoard.transform.position;
                surface.x -= 0.25f;
                surface.z -= 0.75f;
                boardVeggie.transform.position = surface;
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }

                // Start timer for chopping veggie
                canMove   = false;
                moveTimer = COOLDOWN;
            }
            else if (chopBoardOccupied)
            {
                if (!leftHandOccupied)
                {
                    leftHandVeggie = Instantiate(boardSalad) as GameObject;
                    boardSalad.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                    leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    leftHandOccupied  = true;
                    chopBoardOccupied = false;
                    Destroy(boardSalad);
                }
                else if (!rightHandOccupied)
                {
                    rightHandVeggie = Instantiate(boardSalad) as GameObject;
                    boardSalad.GetComponent <SaladType>().MoveSalad(rightHandVeggie);
                    rightHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    rightHandOccupied = true;
                    chopBoardOccupied = false;
                    Destroy(boardSalad);
                }
            }
        }

        // Spare plate: leave a veggie you're holding if empty, pick veggie up if full
        if (Vector3.Distance(pos, sparePlate.transform.position) <= 1.4)
        {
            if (leftHandOccupied && !sparePlateOccupied)
            {
                plateVeggie = Instantiate(leftHandVeggie) as GameObject;
                if (leftHandVeggie.tag == "Salad")
                {
                    leftHandVeggie.GetComponent <SaladType>().MoveSalad(plateVeggie);
                    plateVeggie.GetComponent <SaladType>().SetP1Owns(true);
                }
                Vector3 surface = sparePlate.transform.position;
                surface.z -= 0.25f;
                plateVeggie.transform.position = surface;
                sparePlateOccupied             = true;
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
            else if (sparePlateOccupied)
            {
                if (!leftHandOccupied)
                {
                    leftHandVeggie = Instantiate(plateVeggie) as GameObject;
                    if (plateVeggie.tag == "Salad")
                    {
                        plateVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied   = true;
                    sparePlateOccupied = false;
                    Destroy(plateVeggie);
                }
                else if (!rightHandOccupied)
                {
                    rightHandVeggie = Instantiate(plateVeggie) as GameObject;
                    if (plateVeggie.tag == "Salad")
                    {
                        plateVeggie.GetComponent <SaladType>().MoveSalad(rightHandVeggie);
                        rightHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    rightHandOccupied  = true;
                    sparePlateOccupied = false;
                    Destroy(plateVeggie);
                }
            }
        }

        // Trash can: discard whatever you're holding in your left hand
        if (Vector3.Distance(pos, trash.transform.position) <= 1.35)
        {
            if (leftHandOccupied)
            {
                if (leftHandVeggie.tag == "Salad")
                {
                    score -= leftHandVeggie.GetComponent <SaladType>().GetNumIngredients() * 5;
                }
                else
                {
                    score--;
                }
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
        }

        // Veggies: grab an instance of the veggie you're in front of if you can carry it
        if (Vector3.Distance(pos, veggie1.transform.position) <= 1.25)
        {
            if (!leftHandOccupied)
            {
                leftHandVeggie   = Instantiate(vLettuce) as GameObject;
                leftHandOccupied = true;
            }
            else if (!rightHandOccupied)
            {
                rightHandVeggie   = Instantiate(vLettuce) as GameObject;
                rightHandOccupied = true;
            }
        }
        if (Vector3.Distance(pos, veggie2.transform.position) <= 1.25)
        {
            if (!leftHandOccupied)
            {
                leftHandVeggie   = Instantiate(vTomato) as GameObject;
                leftHandOccupied = true;
            }
            else if (!rightHandOccupied)
            {
                rightHandVeggie   = Instantiate(vTomato) as GameObject;
                rightHandOccupied = true;
            }
        }
        if (Vector3.Distance(pos, veggie3.transform.position) <= 1.25)
        {
            if (!leftHandOccupied)
            {
                leftHandVeggie   = Instantiate(vCarrot) as GameObject;
                leftHandOccupied = true;
            }
            else if (!rightHandOccupied)
            {
                rightHandVeggie   = Instantiate(vCarrot) as GameObject;
                rightHandOccupied = true;
            }
        }
        if (Vector3.Distance(pos, veggie4.transform.position) <= 1.25)
        {
            if (!leftHandOccupied)
            {
                leftHandVeggie   = Instantiate(vCheese) as GameObject;
                leftHandOccupied = true;
            }
            else if (!rightHandOccupied)
            {
                rightHandVeggie   = Instantiate(vCheese) as GameObject;
                rightHandOccupied = true;
            }
        }
        if (Vector3.Distance(pos, veggie5.transform.position) <= 1.25)
        {
            if (!leftHandOccupied)
            {
                leftHandVeggie   = Instantiate(vTurnip) as GameObject;
                leftHandOccupied = true;
            }
            else if (!rightHandOccupied)
            {
                rightHandVeggie   = Instantiate(vTurnip) as GameObject;
                rightHandOccupied = true;
            }
        }
        if (Vector3.Distance(pos, veggie6.transform.position) <= 1.25)
        {
            if (!leftHandOccupied)
            {
                leftHandVeggie   = Instantiate(vCaper) as GameObject;
                leftHandOccupied = true;
            }
            else if (!rightHandOccupied)
            {
                rightHandVeggie   = Instantiate(vCaper) as GameObject;
                rightHandOccupied = true;
            }
        }

        // Customers: give salad to customer if both are present, compare salad and order to see if they match
        if (Vector3.Distance(pos, order1.transform.position) <= 1.4)
        {
            if (leftHandOccupied && leftHandVeggie.tag == "Salad" && service.GetComponent <CustomerSpawn>().GetOccupied1())
            {
                GameObject customer = GameObject.FindWithTag("Cust1");
                int        ltc      = customer.GetComponent <CustomerOrder>().GetNumLettuce();
                int        tmt      = customer.GetComponent <CustomerOrder>().GetNumTomato();
                int        crt      = customer.GetComponent <CustomerOrder>().GetNumCarrot();
                int        chs      = customer.GetComponent <CustomerOrder>().GetNumCheese();
                int        tnp      = customer.GetComponent <CustomerOrder>().GetNumTurnip();
                int        cpr      = customer.GetComponent <CustomerOrder>().GetNumCaper();
                if (leftHandVeggie.GetComponent <SaladType>().CheckSalad(ltc, tmt, crt, chs, tnp, cpr))
                {
                    CustomerSpawn.SetOccupied(1, false);
                    score += leftHandVeggie.GetComponent <SaladType>().GetNumIngredients() * 10;
                    Destroy(customer);
                }
                else
                {
                    customer.GetComponent <CustomerOrder>().MakeAngry(true);
                }
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
        }
        if (Vector3.Distance(pos, order2.transform.position) <= 1.4)
        {
            if (leftHandOccupied && leftHandVeggie.tag == "Salad" && service.GetComponent <CustomerSpawn>().GetOccupied2())
            {
                GameObject customer = GameObject.FindWithTag("Cust2");
                int        ltc      = customer.GetComponent <CustomerOrder>().GetNumLettuce();
                int        tmt      = customer.GetComponent <CustomerOrder>().GetNumTomato();
                int        crt      = customer.GetComponent <CustomerOrder>().GetNumCarrot();
                int        chs      = customer.GetComponent <CustomerOrder>().GetNumCheese();
                int        tnp      = customer.GetComponent <CustomerOrder>().GetNumTurnip();
                int        cpr      = customer.GetComponent <CustomerOrder>().GetNumCaper();
                if (leftHandVeggie.GetComponent <SaladType>().CheckSalad(ltc, tmt, crt, chs, tnp, cpr))
                {
                    CustomerSpawn.SetOccupied(2, false);
                    score += leftHandVeggie.GetComponent <SaladType>().GetNumIngredients() * 10;
                    Destroy(customer);
                }
                else
                {
                    customer.GetComponent <CustomerOrder>().MakeAngry(true);
                }
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
        }
        if (Vector3.Distance(pos, order3.transform.position) <= 1.4)
        {
            if (leftHandOccupied && leftHandVeggie.tag == "Salad" && service.GetComponent <CustomerSpawn>().GetOccupied3())
            {
                GameObject customer = GameObject.FindWithTag("Cust3");
                int        ltc      = customer.GetComponent <CustomerOrder>().GetNumLettuce();
                int        tmt      = customer.GetComponent <CustomerOrder>().GetNumTomato();
                int        crt      = customer.GetComponent <CustomerOrder>().GetNumCarrot();
                int        chs      = customer.GetComponent <CustomerOrder>().GetNumCheese();
                int        tnp      = customer.GetComponent <CustomerOrder>().GetNumTurnip();
                int        cpr      = customer.GetComponent <CustomerOrder>().GetNumCaper();
                if (leftHandVeggie.GetComponent <SaladType>().CheckSalad(ltc, tmt, crt, chs, tnp, cpr))
                {
                    CustomerSpawn.SetOccupied(3, false);
                    score += leftHandVeggie.GetComponent <SaladType>().GetNumIngredients() * 10;
                    Destroy(customer);
                }
                else
                {
                    customer.GetComponent <CustomerOrder>().MakeAngry(true);
                }
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
        }
        if (Vector3.Distance(pos, order4.transform.position) <= 1.4)
        {
            if (leftHandOccupied && leftHandVeggie.tag == "Salad" && service.GetComponent <CustomerSpawn>().GetOccupied4())
            {
                GameObject customer = GameObject.FindWithTag("Cust4");
                int        ltc      = customer.GetComponent <CustomerOrder>().GetNumLettuce();
                int        tmt      = customer.GetComponent <CustomerOrder>().GetNumTomato();
                int        crt      = customer.GetComponent <CustomerOrder>().GetNumCarrot();
                int        chs      = customer.GetComponent <CustomerOrder>().GetNumCheese();
                int        tnp      = customer.GetComponent <CustomerOrder>().GetNumTurnip();
                int        cpr      = customer.GetComponent <CustomerOrder>().GetNumCaper();
                if (leftHandVeggie.GetComponent <SaladType>().CheckSalad(ltc, tmt, crt, chs, tnp, cpr))
                {
                    CustomerSpawn.SetOccupied(4, false);
                    score += leftHandVeggie.GetComponent <SaladType>().GetNumIngredients() * 10;
                    Destroy(customer);
                }
                else
                {
                    customer.GetComponent <CustomerOrder>().MakeAngry(true);
                }
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
        }
        if (Vector3.Distance(pos, order5.transform.position) <= 1.4)
        {
            if (leftHandOccupied && leftHandVeggie.tag == "Salad" && service.GetComponent <CustomerSpawn>().GetOccupied5())
            {
                GameObject customer = GameObject.FindWithTag("Cust5");
                int        ltc      = customer.GetComponent <CustomerOrder>().GetNumLettuce();
                int        tmt      = customer.GetComponent <CustomerOrder>().GetNumTomato();
                int        crt      = customer.GetComponent <CustomerOrder>().GetNumCarrot();
                int        chs      = customer.GetComponent <CustomerOrder>().GetNumCheese();
                int        tnp      = customer.GetComponent <CustomerOrder>().GetNumTurnip();
                int        cpr      = customer.GetComponent <CustomerOrder>().GetNumCaper();
                if (leftHandVeggie.GetComponent <SaladType>().CheckSalad(ltc, tmt, crt, chs, tnp, cpr))
                {
                    CustomerSpawn.SetOccupied(5, false);
                    score += leftHandVeggie.GetComponent <SaladType>().GetNumIngredients() * 10;
                    Destroy(customer);
                }
                else
                {
                    customer.GetComponent <CustomerOrder>().MakeAngry(true);
                }
                leftHandOccupied = false;
                Destroy(leftHandVeggie);

                // Move right hand veggie to occupy left hand for next interaction
                if (rightHandOccupied)
                {
                    leftHandVeggie = Instantiate(rightHandVeggie) as GameObject;
                    if (rightHandVeggie.tag == "Salad")
                    {
                        rightHandVeggie.GetComponent <SaladType>().MoveSalad(leftHandVeggie);
                        leftHandVeggie.GetComponent <SaladType>().SetP1Owns(true);
                    }
                    leftHandOccupied  = true;
                    rightHandOccupied = false;
                    Destroy(rightHandVeggie);
                }
            }
        }
    }
コード例 #9
0
    public void CheckFood()
    {
        inventory = FindObjectOfType <Inventory>();
        inventory.GetItemInList();
        Item[] PlayerSelectedFood = inventory.GetItemInList();
        CS           = FindObjectOfType <CustomerSpawn> ();
        scoreManager = FindObjectOfType <ScoreManager>();
        Recipe CorrectRecipeFoods   = Resources.Load <Recipe>("recipes/" + CS.chosenDish);
        int    counter              = CorrectRecipeFoods.foods.Length;
        int    PlayerSelectedLength = PlayerSelectedFood.Length;

        for (var i = 0; i < CorrectRecipeFoods.foods.Length; i++)
        {
            bool correct = false;
            for (var k = 0; k < PlayerSelectedLength; k++)
            {
                if (CorrectRecipeFoods.foods[i] == PlayerSelectedFood[k])
                {
                    PlayerSelectedFood[k] = null;
                    counter--;
                    Debug.Log("counter:" + counter);
                    correct = true;
                    break;
                }
            }

            if (correct == false)
            {
                Debug.Log("Selected Food incorrect" + scoreManager.levelTotalScore);
                dishScore -= wrongScore;
                ++wrongCounter;
                if (distractionManager.isDistractioHappened)
                {
                    ++wrongCounterAfterDistraction;
                }
                isCustomerWrong = true;
                setWrong();
                return;
            }
            if (counter == 0)
            {
                for (var k = 0; k < PlayerSelectedLength; k++)
                {
                    if (PlayerSelectedFood[k] != null)
                    {
                        Debug.Log("Selected Food incorrect" + scoreManager.levelTotalScore);
                        dishScore -= wrongScore;
                        ++wrongCounter;
                        if (distractionManager.isDistractioHappened)
                        {
                            ++wrongCounterAfterDistraction;
                        }
                        isCustomerWrong = true;
                        setWrong();
                        return;
                    }
                }
                Debug.Log("Selected Food correct!!!!!");
                Debug.Log(stopwatch);
                scoreManager.levelTotalScore += dishScore;
                setCorrect();
                thisCustomerIsEnded = true;
                CS = FindObjectOfType <CustomerSpawn>();
                CS.isCurrentFinished = true;
                Debug.Log("cc" + CS.isCurrentFinished);
                CS.isAnswering = true;
                CS.Invoke("destroyCustomer", destroyWait);
            }
        }
    }
コード例 #10
0
    public void parse(TextAsset sources)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(sources.text);

        XmlNode rootNode = doc.FirstChild;
        XmlNode levels = doc.SelectSingleNode("Levels");

        XmlNodeList levelsList = levels.ChildNodes;
        foreach (XmlNode node in levelsList)
        {
            LevelDesc desc = new LevelDesc();
            string name = node.Name;

            XmlNodeList linesList = node.SelectNodes("Lines/SpawnLine");
            foreach(XmlNode line in linesList)
            {
                foreach(XmlNode customer in line.ChildNodes)
                {
                    CustomerSpawn cs = new CustomerSpawn();
                    cs.delay = float.Parse(customer.Attributes["Delay"].Value);
                    cs.type = customer.Name;

                    int ordersCount = customer.SelectNodes("Order").Count;
                    cs.orders = new string[ordersCount];

                    int i = 0;
                    foreach(XmlNode order in customer.SelectNodes("Order"))
                    {
                        cs.orders[i++] = order.Attributes["Name"].Value;
                    }

                    desc.customersQueue.Add(cs);
                }
            }

            _levelsDict.Add(name, desc);
        }
    }