コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        anim.SetBool(animId_bHoldItem, holdItem != null);
        if (KassenEvent.isRunning())
        {
            return;
        }


        //M�gliche aktive Effekte berechnen: verschnellert oder verlangsamt Simulation
        float deltaTime = calculateEffectValue(Time.deltaTime);


        if (quicktimeEvent.running)
        {
            if (eatingProgress == 1.0f)
            {
                quicktimeEvent.finishEvent();
                finishedEating();
            }
            else
            {
                quicktimeEvent.influenceEvent(quickTimeRate * deltaTime);
                eatingProgress = Mathf.Clamp01(eatingProgress + eatingRate * Time.deltaTime);
            }
        }

        //Abklingzeit und es darf nichts halten
        if (DoSomethingCooldown[0] <= 0.0f && holdItem == null)
        {
            makeDecision();
        }

        if (DoSomethingCooldown[0] > 0)
        {
            DoSomethingCooldown[0] -= deltaTime;
        }

        if (soothedEffect[0] > 0)
        {
            soothedEffect[0] -= Time.deltaTime;
        }

        if (enrageEffect[0] > 0)
        {
            enrageEffect[0] -= Time.deltaTime;
        }
    }
コード例 #2
0
ファイル: InputSystem.cs プロジェクト: HatiEth/RBCGJ2016
    // Update is called once per frame
    void Update()
    {
        if (KassenEvent.isRunning())
        {
            KassenInput();
            return;
        }

        if (Input.GetButtonDown("ActionLeft"))
        {
            if (motherBehaviour.handsFree() && motherBehaviour.quicktimeEvent.running)
            {
                motherBehaviour.takeFromChild();
            }
            else if (!motherBehaviour.handsFree())
            {
                motherBehaviour.throwAway();
            }
        }
        else if (Input.GetButtonDown("ActionUp") && !motherBehaviour.handsFree())
        {
            motherBehaviour.giveToChild();
        }
        else if (Input.GetButtonDown("ActionDown"))
        {
            if (motherBehaviour.handsFree())
            {
                motherBehaviour.checkChildItem();
            }
            else if (motherBehaviour.inspecting)
            {
                motherBehaviour.putIntoCart();
            }
            else
            {
                motherBehaviour.inspect();
            }
        }

        IItem item = null;

        if (motherBehaviour.handsFree())
        {
            if (Input.GetButtonDown("takeOben"))
            {
                item = takeControl.take(Enums.TakeType.Oben);
            }
            else if (Input.GetButtonDown("takeMitte"))
            {
                item = takeControl.take(Enums.TakeType.Mitte);
            }
            else if (Input.GetButtonDown("takeUnten"))
            {
                item = takeControl.take(Enums.TakeType.Unten);
            }
        }
        if (item != null)
        {
            motherBehaviour.takeFromShelf(item);
        }
    }