예제 #1
0
 public void Dead()
 {
     if (!isDead)
     {
         isDead = true;
         if (direction == -1)
         {
             GCM.AddPlayer1();
         }
         if (direction == 1)
         {
             GCM.AddPlayer2();
         }
     }
 }
예제 #2
0
 public void AddPoint()
 {
     points++;
     if (points >= 3)
     {
         if (Player1)
         {
             GCM.AddPlayer1();
         }
         else
         {
             GCM.AddPlayer2();
         }
     }
 }
예제 #3
0
 // Update is called once per frame
 void Update()
 {
     if (isJumping)
     {
         // transform.position = new Vector3(Mathf.Lerp(transform.position.x, jumpOffset, jumpSpeed * Time.deltaTime), transform.position.y, 0);
         transform.Translate(0.2f, 0, 0);
     }
     if (transform.position.x >= 55)
     {
         reverseDirection = true;
         if (Player1)
         {
             graphic.flipX = true;
         }
         if (!Player1)
         {
             graphic2.flipX = true;
         }
     }
     if (!reverseDirection)
     {
         transform.position = new Vector3(Mathf.Lerp(transform.position.x, emergeLocation + multipliedSpeed, Time.deltaTime), transform.position.y, 0);
     }
     if (reverseDirection)
     {
         transform.position = new Vector3(Mathf.Lerp(transform.position.x, 55 - multipliedSpeed + 105, Time.deltaTime), transform.position.y, 0);
     }
     if (reverseDirection)
     {
         if (transform.position.x <= -55)
         {
             if (Player1)
             {
                 GCM.AddPlayer1();
             }
             else
             {
                 GCM.AddPlayer2();
             }
         }
     }
 }
예제 #4
0
 void Damage()
 {
    
     if(Player1)
     {
         hp--;
         RecalculateHp();
         if (hp == 0)
         {
             Dead();
             GCM.AddPlayer2();
         }
     }
     if(!Player1)
     {
         RecalculateHp();
         hp--;
         if (hp == 0)
         {
             Dead();
             GCM.AddPlayer1();
         }
     }
 }