private void Update() { //下移动 if (Fish1.transform.position.y > 1.5) { //平滑移动 Fish1.transform.position = Vector2.Lerp(Fish1.transform.position, new Vector2(Fish1.transform.position.x, -0.6f), Time.deltaTime * 0.5f); } //右移动 else { Invoke("RightMove", 0.2f); m_Fish1Move.Right(); if (flg == 0) { StartCoroutine("Fire"); flg = 1; } } }
void RightMove() { m_Fish1Move.Right(); Fish1.transform.Translate(new Vector2(2.18f, -1) * Time.deltaTime * 0.75f); }