コード例 #1
0
ファイル: Command.cs プロジェクト: MauricioAguiar/Gulliver
    // Update is called once per frame
    void Update()
    {
        GetInterval(PressTime);

        if (timeToPressShake)
        {
            AButtonCanvas.SetActive(true);
            DButtonCanvas.SetActive(true);
        }
        else
        {
            AButtonCanvas.SetActive(false);
            DButtonCanvas.SetActive(false);
        }
    }
コード例 #2
0
ファイル: Command.cs プロジェクト: MauricioAguiar/Gulliver
    void GetInterval(int PressTime)
    {
        player.GetComponent <Animator>().SetFloat("Direction", 0.5f);
        if (timeToPressShake)
        {
            getLeft  = Input.GetButtonDown("ShakeLeft");
            getRight = Input.GetButtonDown("ShakeRight");

            timeRemaining -= Time.deltaTime;

            if (timeRemaining <= 0)
            {
                timeToPressShake = false;
                timeRemaining    = PressTime;
                Debug.Log("A corda está um pouco mais folgada, desse tanto: " + amountLoose);
            }

            if (getLeft & lastPressedIsLeft == false)
            {
                GulliverStatus.instance.ShakingEnergy(2);
                LooseTie(1);
                player.GetComponent <Animator>().SetFloat("Direction", 0);
                lastPressedIsLeft = true;
                AButtonCanvas.GetComponent <RawImage>().texture = AButtonPressed;
            }
            else
            {
                AButtonCanvas.GetComponent <RawImage>().texture = AButton;
            }

            if (getRight & lastPressedIsLeft == true)
            {
                player.GetComponent <Animator>().SetFloat("Direction", 1);
                lastPressedIsLeft = false;
                DButtonCanvas.GetComponent <RawImage>().texture = DButtonPressed;
            }
            else
            {
                DButtonCanvas.GetComponent <RawImage>().texture = DButton;
            }
        }
    }