예제 #1
0
    private void Update()
    {
        switch (state)
        {
        case PullBackState.Default:
            break;

        case PullBackState.Retract:
            transform.position += Vector3.up * speed * Time.deltaTime;
            if (transform.position.y > startPosition.y)
            {
                state = PullBackState.Default;
            }
            break;

        case PullBackState.Extend:
            transform.position += Vector3.down * speed * Time.deltaTime;
            if (transform.position.y < startPosition.y - maxYShift * Screen.height)
            {
                state = PullBackState.Default;
            }
            break;

        default:
            break;
        }
    }
예제 #2
0
 public void Extend()
 {
     state = PullBackState.Extend;
 }
예제 #3
0
 public void Retract()
 {
     state = PullBackState.Retract;
 }