Exemplo n.º 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));
    }
Exemplo n.º 2
0
    public override void Init(Trash _trash)
    {
        trash = _trash as TrashB;

        nameText.text = trash.trashName;

        leftBtn.onClick.AddListener(() =>
        {
            Choice(TrashB.Choice.LEFT);
        });
        leftBtn.GetComponentInChildren <Text>().text = trash.typeLeft.typeName;
        RegisterButton(leftBtn);

        rightBtn.onClick.AddListener(() =>
        {
            Choice(TrashB.Choice.RIGHT);
        });
        rightBtn.GetComponentInChildren <Text>().text = trash.typeRight.typeName;
        RegisterButton(rightBtn);

        trashImage = CreateTrashImage(trash.image);

        leftBin.Set(trash.typeLeft);
        rightBin.Set(trash.typeRight);
    }
Exemplo n.º 3
0
    protected TrashImage CreateTrashImage(Sprite sprite)
    {
        TrashImage trashImage = Instantiate(trashImagePrefab).GetComponent <TrashImage>();

        trashImage.Set(sprite);
        trashImage.transform.SetParent(transform, false);
        trashImage.transform.SetAsFirstSibling();
        return(trashImage);
    }
Exemplo n.º 4
0
    IEnumerator ChangeAnimation()
    {
        lockChange = true;

        trashImage.Action();
        yield return(new WaitForSeconds(0.5f));

        Destroy(trashImage.gameObject);

        trashImage = CreateTrashImage(trash.GetSprite(currentStep));

        yield return(new WaitForSeconds(0.5f));

        lockChange = false;
    }