private void Act_and_assert()
 {
     hotPlate = new HotPlate(size);
     hotPlate.NextState();
     var actual = hotPlate.Current;
     Assert.AreEqual(expected, actual);
 }
        private void Act_and_assert()
        {
            hotPlate = new HotPlate(size);
            hotPlate.NextState();
            var actual = hotPlate.Current;

            Assert.AreEqual(expected, actual);
        }
 public void Verify_that_centermost_cells_in_6_by_6_grid_cannot_change()
 {
     size = 6;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(2, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(2, 3));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 3));
 }
 public void Verify_in_3_by_3()
 {
     size     = 3;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(0, 1));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 0));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(2, 1));
 }
 public void Verify_in_3_by_3()
 {
     size = 3;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(0, 1));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 0));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(2, 1));
 }
 public void Verify_that_centermost_cells_in_6_by_6_grid_cannot_change()
 {
     size     = 6;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(2, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(2, 3));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 3));
 }
 public void Verify_in_4_by_4()
 {
     size     = 4;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(0, 1));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(0, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 0));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 3));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 1));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 2));
 }
 public void Verify_in_4_by_4()
 {
     size = 4;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(0, 1));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(0, 2));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 0));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 3));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 1));
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(3, 2));
 }
示例#9
0
    bool OnOven(Transform parent)
    {
        bool isPlate = false;

        while (parent != null)
        {
            if (parent.GetComponent <HotPlate>())
            {
                HotPlate hotPlate = parent.GetComponent <HotPlate>();
                if (hotPlate.plates.name == firstCollidedObject.name && hotPlate.activePlateIndices)
                {
                    isPlate = true;
                    return(isPlate);
                }
            }
            parent = parent.transform.parent;
        }
        return(isPlate);
    }
 public void Verify_only_center_cell_in_3_by_3()
 {
     size     = 3;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate[1, 1]);
 }
 public void Verify_that_centermost_cell_in_3_by_3_grid_cannot_change()
 {
     size     = 3;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 1));
 }
 public void Verify_only_center_cell_in_5_by_5()
 {
     size     = 5;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate[2, 2]);
 }
 public void Verify_fourth_center_cell_in_4_by_4()
 {
     hotPlate = Create_4_by_4_hot_plate();
     Assert.AreEqual(expected, hotPlate[2, 2]);
 }
 public void Setup()
 {
     hotPlate = new HotPlate(size);
 }
 public void Setup()
 {
     hotPlate = new HotPlate(size);
 }
示例#16
0
    void Update()
    {
        int index = currentIngredient.index;

        if (Input.GetKeyDown("left"))
        {
            index++;
        }
        if (Input.GetKeyDown("right"))
        {
            index--;
        }
        if (index >= ingredients.Length)
        {
            index = ingredients.Length - 1;
        }
        if (index < 0)
        {
            index = 0;
        }
        if (currentIngredient.index != index)
        {
            currentIngredient = ingredients[index];
        }

        if (Input.GetKeyDown("space"))
        {
            // Tortilla stack
            if (currentIngredient.index == 0)
            {
                if (currentFoodItem != null)
                {
                    Destroy(currentFoodItem.gameObject);
                }
                currentFoodItem = Instantiate(foodItemPrefab);
                Tortilla tortilla = Instantiate(tortillaPrefab);
                tortilla.transform.parent        = currentFoodItem.transform;
                tortilla.transform.localPosition = new Vector3(0, 0, 0);

                Customer customer = Instantiate(customerPrefab);
                customer.foodItem        = currentFoodItem;
                currentFoodItem.customer = customer;
            }
            // Hot plate
            else if (currentIngredient.index == 1)
            {
                HotPlate hotPlate = currentIngredient.GetComponent <HotPlate>();
                if (currentFoodItem == null)
                {
                    currentFoodItem          = hotPlate.currentFoodItem;
                    hotPlate.currentFoodItem = null;
                }
                else if (currentFoodItem != null && currentFoodItem.isBurrito)
                {
                    FoodItem temp = hotPlate.currentFoodItem;
                    hotPlate.currentFoodItem = currentFoodItem;
                    currentFoodItem          = temp;
                }
            }
            // Cash register
            else if (currentIngredient.index == ingredients.Length - 1)
            {
                if (currentFoodItem != null)
                {
                    UpdateScore(currentFoodItem);
                    Destroy(currentFoodItem.customer.gameObject);
                    Destroy(currentFoodItem.gameObject);
                }
            }
            // Ingredients that are scooped into burrito (i.e. actual ingredients)
            else
            {
                IngredientServing serving = Instantiate(ingredientServingPrefab);
                serving.transform.position  = transform.position + servingOffset;
                serving.transform.position += new Vector3(UnityEngine.Random.value * 0.04f - 0.02f,
                                                          0.0f, UnityEngine.Random.value * 0.05f - 0.02f);

                // Inherit properties from ingredient bin
                // This will change when graphics are improved
                serving.type  = currentIngredient.type;
                serving.color = currentIngredient.color;
            }
        }

        if (Input.GetKey("q"))
        {
            Application.Quit();
        }
    }
 public void Verify_that_centermost_cell_in_3_by_3_grid_cannot_change()
 {
     size = 3;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate.CanCellValueChange(1, 1));
 }
 public void Verify_only_center_cell_in_3_by_3()
 {
     size = 3;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate[1, 1]);
 }
 public void Verify_only_center_cell_in_5_by_5()
 {
     size = 5;
     hotPlate = new HotPlate(size);
     Assert.AreEqual(expected, hotPlate[2, 2]);
 }
 public void Verify_third_center_cell_in_4_by_4()
 {
     hotPlate = Create_4_by_4_hot_plate();
     Assert.AreEqual(expected, hotPlate[2, 1]);
 }