Exemplo n.º 1
0
 void Mirror()
 {
     if (!mirrorNowX &&
         EndChecker.EndRight(transform.position.x))
     {
         transform.rotation = Quaternion.Euler(0.0f, 0.0f, 180.0f - transform.localEulerAngles.z);
         if (mirrorSpeedChange != 0)
         {
             moveSpeed *= mirrorSpeedChange;
         }
         mirrorNowX = true;
     }
     else if (mirrorNowX &&
              !EndChecker.EndRight(transform.position.x))
     {
         mirrorNowX = false;
     }
     if (!mirrorNowY &&
         (EndChecker.EndTop(transform.position.y) ||
          EndChecker.EndBottom(transform.position.y)))
     {
         transform.rotation = Quaternion.Euler(0.0f, 0.0f, -transform.localEulerAngles.z);
         if (mirrorSpeedChange != 0)
         {
             moveSpeed *= mirrorSpeedChange;
         }
         mirrorNowY = true;
     }
     else if (mirrorNowY &&
              !EndChecker.EndTop(transform.position.y) &&
              !EndChecker.EndBottom(transform.position.y))
     {
         mirrorNowY = false;
     }
 }
Exemplo n.º 2
0
 void Destroy()
 {
     if (EndChecker.EndLeft(transform.position.x + destroyWait))
     {
         Destroy(gameObject);
     }
     if (!mirror &&
         (EndChecker.EndRight(transform.position.x - destroyWait) ||
          EndChecker.EndTop(transform.position.y - destroyWait) ||
          EndChecker.EndBottom(transform.position.y + destroyWait)))
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 3
0
    void Move()
    {
        Vector2 afterPos = playerTouchState.beforePos + (playerTouchState.afterTouchPos - playerTouchState.beforeTouchPos);

        transform.position = afterPos;
        if (EndChecker.EndRight(transform.position.x + moveRestRight))
        {
            transform.position = new Vector2(EndChecker.endRight - moveRestRight, transform.position.y);
        }
        else if (EndChecker.EndLeft(transform.position.x - moveRestOther))
        {
            transform.position = new Vector2(EndChecker.endLeft + moveRestOther, transform.position.y);
        }
        if (EndChecker.EndTop(transform.position.y + moveRestOther))
        {
            transform.position = new Vector2(transform.position.x, EndChecker.endTop - moveRestOther);
        }
        else if (EndChecker.EndBottom(transform.position.y - moveRestOther))
        {
            transform.position = new Vector2(transform.position.x, EndChecker.endBottom + moveRestOther);
        }
    }