void Update () {
      if(Input .GetKeyDown (KeyCode .W ))
        {
            StartCoroutine ("Test");
        }
    }
    IEnumerator Test()
    {
        while (Cube1 .position .x<6)
        {
            Cube1 .Translate (transform .right *3*Time .deltaTime );
            yield return null;
        }
        yield return new  WaitForSeconds(2);
        while (Cube2 .position .x<6)
        {
            Cube2 .Translate (transform .right *3*Time .deltaTime );
            yield return null;
        }
    }

 

posted on 2013-08-30 16:47  追逐.  阅读(199)  评论(0编辑  收藏  举报