Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     lockAxis = CrossPlatformInputManager.GetAxis("GunVertical") % 1;
     if (CrossPlatformInputManager.GetButtonDown("Horizontal") && SelectedAnim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1)
     {
         ChangeSelectedPin(CrossPlatformInputManager.GetAxis("Horizontal"));
     }
     if (CrossPlatformInputManager.GetButton("Fire2") && lockAxis >= 0 && SelectedAnim.GetCurrentAnimatorStateInfo(0).normalizedTime > 0)
     {
         SelectedAnim.SetFloat("Speed", -lockAxis);
         foreach (var anim in PrecedingAnims)
         {
             if ((anim.GetCurrentAnimatorStateInfo(0).normalizedTime - SelectedAnim.GetCurrentAnimatorStateInfo(0).normalizedTime) > 0.42f)
             {
                 anim.SetFloat("Speed", -lockAxis);
             }
             else if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime <= 1)
             {
                 anim.SetFloat("Speed", 1);
             }
             else
             {
                 anim.SetFloat("Speed", 0);
             }
         }
     }
     else if (SelectedAnim.GetCurrentAnimatorStateInfo(0).normalizedTime <= 1)
     {
         SelectedAnim.SetFloat("Speed", 1);
         foreach (var anim in PrecedingAnims)
         {
             if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime <= 1)
             {
                 anim.SetFloat("Speed", 1);
             }
             else
             {
                 anim.SetFloat("Speed", 0);
             }
         }
     }
     else
     {
         SelectedAnim.SetFloat("Speed", 0);
         PrecedingAnims.ForEach(x => x.SetFloat("Speed", 0));
     }
     if (!checkingPin && SelectedPin == UI_Lock.PinOrder[currentPosition])
     {
         StartCoroutine(CheckPin());
     }
     if (SelectedAnim.GetCurrentAnimatorStateInfo(0).normalizedTime < 0.56f) //Change dropped lower pin position if pick has reached them
     {
         HoldPinResidue.ForEach(x => x.droppedPosition = new Vector3(x.droppedPosition.x, pick.GetChild(0).position.y));
     }
     if (sweetSpotReached)
     {
         UI_Lever.SetLeverStatus(true);
         if (CrossPlatformInputManager.GetButtonDown("Fire1"))
         {
             HoldPin();
         }
     }
     else
     {
         UI_Lever.SetLeverStatus(false);
     }
     if (CrossPlatformInputManager.GetButton("Cancel")) // If Cancel Pressed disable lock UI
     {
         gameObject.SetActive(false);
     }
 }
Exemple #2
0
 private UI_Lever()
 {
     instance = this;
 }