コード例 #1
0
    IEnumerator Move(Vector3 targetPosition, float duration)
    {
        var colliders = gameObject.GetComponentsInChildren <Collider2D>();

        foreach (var col in colliders)
        {
            col.enabled = false;
        }

        Vector3    startPosition = transform.position;
        Quaternion startRotation = transform.rotation;

        var t = 0f;

        while (t < 1)
        {
            t += Time.deltaTime / duration;
            transform.position = Vector3.Lerp(startPosition, targetPosition, Utility.BounceEaseOut(t));
            transform.rotation = Quaternion.Lerp(startRotation, Quaternion.identity, t);
            yield return(null);
        }

        foreach (var col in colliders)
        {
            col.enabled = true;
        }
        currentState = draggableState;
    }
コード例 #2
0
 private void Start()
 {
     if (ringNumber == 1)
     {
         currentState = draggableState;
     }
     else
     {
         currentState = idleState;
         currentState.ToIdleState();
     }
 }