private void OnMouseUp() { if (!inAnimation) { if (!canMoveUp && !canMoveDown) { float rotation = Mathf.RoundToInt(allLine.transform.rotation.eulerAngles.y / deltaAngle) * deltaAngle; StartCoroutine(RotateAnim(rotation - allLine.transform.eulerAngles.y)); } if (canMoveUp) { canMoveUp = canMoveDown = false; ChastController chast = allLine.GetUpperParent().GetComponent <ChastController>(); if (!inAnimation && !chast.inAnim) { StartCoroutine(Move(0.6f)); transform.parent = chast.transform; allLine = chast; } } else if (canMoveDown) { canMoveUp = canMoveDown = false; ChastController chast = allLine.GetLowerParent().GetComponent <ChastController>(); if (!inAnimation && !chast.inAnim) { StartCoroutine(Move(-0.6f)); transform.parent = chast.transform; allLine = chast; } } } }
// Start is called before the first frame update void Start() { allLine = transform.parent.GetComponent <ChastController>(); }