private void InitRing() { // set ring´s current status to movable. Status = RING_STATUS.MOVABLE; // set the required components RingRigidbody = GetComponent <Rigidbody2D>(); BoxCollider = GetComponent <BoxCollider2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); plate = GameObject.Find("Plate").GetComponent <BoxCollider2D>(); // find out what my size is. SetupPinSize(); // get the other rings to keep track for collision otherRings = RingManager.instance.GetOtherRings(this); }
/// <summary> /// Handle the selected input and control the ring /// </summary> private void UpdateMovementOnInput() { // Check ring status, and switch rules for movement. Status = CheckRingStatus(); // Check what input we are using and based on the Status, what condition this ring is in. switch (UserInputManager.instance.INPUT_SELECTED) { case UserInputManager.INPUT_CHOICE.TOUCH: switch (Status) { case RING_STATUS.MOVABLE: UpdateTouchMovementMovable(); break; case RING_STATUS.CAN_MOVE_UP: UpdateTouchMovementCanMoveUp(); break; case RING_STATUS.STUCK: break; default: break; } break; case UserInputManager.INPUT_CHOICE.MOUSE: switch (Status) { case RING_STATUS.MOVABLE: UpdateMouseMovementMovable(); break; case RING_STATUS.CAN_MOVE_UP: UpdateMouseMovementCanMoveUp(); break; case RING_STATUS.STUCK: break; default: break; } break; default: break; } }