Example #1
0
    public override void Init(Trash _trash)
    {
        trash = _trash as TrashA;

        currentStep = 1;

        nameText.text = trash.trashName;

        doneBtn.onClick.AddListener(() =>
        {
            if (lockChange)
            {
                return;
            }

            trashImage.Throw(0);
            bin.Shake(0.75f);
            Finish(currentStep == trash.targetStep);
        });
        RegisterButton(doneBtn);

        actionBtn.onClick.AddListener(() =>
        {
            ChangeState();
        });
        RegisterButton(actionBtn);

        trashImage = CreateTrashImage(trash.GetSprite(1));
    }
Example #2
0
    IEnumerator Throw()
    {
        float start = Time.time;

        while (Time.time - start < delayTime)
        {
            timer.rectTransform.localScale = new Vector3(1f - (Time.time - start) / delayTime, 1f);
            yield return(null);
        }
        timer.rectTransform.localScale = new Vector3(0, 1, 1);

        Finish(trash.throwingIsAnswer);
        bin.Shake(0.75f);
    }
Example #3
0
 void Choice(TrashB.Choice choice)
 {
     if (choice == TrashB.Choice.LEFT)
     {
         trashImage.Throw(-1);
         leftBin.Shake(0.75f);
     }
     else
     {
         trashImage.Throw(1);
         rightBin.Shake(0.75f);
     }
     Finish(choice == trash.answer);
 }