コード例 #1
0
ファイル: SpeedDropPlace.cs プロジェクト: tyobi529/CalBattle
    public void OnDrop(PointerEventData eventData)
    {
        SpeedCardController ingredientCardController = eventData.pointerDrag.GetComponent <SpeedCardController>();

        SpeedCardController dishCardController = GetComponent <SpeedCardController>();



        if (ingredientCardController.model.cardID == dishCardController.model.ingredientCardID[0])
        {
            GetComponent <SpeedDishView>().ChangeDishColor(0);


            speedGameManager.CorrectEffect(ingredientCardController.transform.position);


            dishCardController.model.ingredientCardID[0] = -1;
        }
        else if (ingredientCardController.model.cardID == dishCardController.model.ingredientCardID[1])
        {
            GetComponent <SpeedDishView>().ChangeDishColor(0);

            speedGameManager.CorrectEffect(ingredientCardController.transform.position);


            dishCardController.model.ingredientCardID[1] = -1;
        }
        else
        {
            GetComponent <SpeedDishView>().ChangeDishColor(2);

            speedGameManager.isWrong = true;
            return;
        }


        for (int i = 0; i < 2; i++)
        {
            if (!isFilled[i])
            {
                dishCardController.GetComponent <SpeedDishView>().ChangeIngredientImage(i, ingredientCardController.model.icon);

                speedCardGenerator.GiveCardToHand(ingredientCardController.fieldIndex, true);
                Destroy(ingredientCardController.gameObject);

                isFilled[i] = true;

                break;
            }
        }

        if (isFilled[0] && isFilled[1])
        {
            speedCardGenerator.GiveCardToField(dishCardController.fieldIndex);

            speedGameManager.madeNum++;
            Destroy(this.gameObject);
        }
    }
コード例 #2
0
    void StartGame()
    {
        StopAllCoroutines();

        StartCoroutine(CountDown());

        SoundManager.instance.source.Play();


        for (int i = 0; i < 4; i++)
        {
            speedCardGenerator.GiveCardToHand(i, false);
        }

        for (int i = 0; i < 3; i++)
        {
            speedCardGenerator.GiveCardToField(i);
        }
    }