예제 #1
0
 void Update()
 {
     if (isDragging == false && Input.GetMouseButtonDown(1))
     {
         CheckUnderClick();
         isDragging          = true;
         draggingStartedTime = Time.time;
         draggingStartedY    = Input.mousePosition.y;
     }
     else if (isDragging == true && Input.GetMouseButtonUp(1))
     {
         isDragging = false;
         float timeDif = Time.time - draggingStartedTime;
         float distDif = Input.mousePosition.y - draggingStartedY;
         dragForce = distDif / timeDif;
         if (targetThumper != null)
         {
             targetThumper.AddMomentum(dragForce);
         }
         else
         {
             GameManager.CreateThumper(clickPos, dragForce);
         }
     }
 }
예제 #2
0
 void IncreaseThump()
 {
     if (cooldownTimer < Settings.ThumpCooldown)
     {
         return;
     }
     cooldownTimer = 0;
     if (selectedThumper == null)
     {
         Vector2 back = new Vector2(transform.forward.x, transform.forward.z) * -5;
         GameManager.CreateThumper(back + new Vector2(transform.position.x, transform.position.z), Settings.ThumpStartForce);
     }
     else
     {
         selectedThumper.AddMomentum(Settings.ThumpModForce);
     }
 }