Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     if (!isLaunch && PhotonManager.playerID == 0 && Input.GetKeyDown(KeyCode.Space))
     {
         photonManager.Launch();
     }
     if (isLaunch)
     {
         if (PhotonManager.playerID == 0)
         {
             if (Mathf.Abs(rigidbody2D.velocity.y) < 0.05f)
             {
                 cnt++;
                 if (cnt > 300)
                 {
                     rigidbody2D.velocity = new Vector2(1, 1) * speed;
                     cnt = 0;
                 }
             }
             else
             {
                 cnt = 0;
             }
             photonManager.BallPosition(transform.position.x, transform.position.y, transform.position.z);
         }
         else
         {
             transform.position = Vector3.Lerp(transform.position, targetPosition, 0.5f);
         }
     }
 }