public void action() { int wait = 3; int time = 10; float delta = distance / time; for (int i = 0; i < NUM; ++i) { if (objs [i].frame++ > time) { continue; } else { objs[i].obj.transform.Translate(dir * delta); if (objs [i].frame < wait) { break; } } } if (objs [NUM - 1].frame > time) { scene.nextState(); } }
public void action() { // const int wait = 1; const int time = 130; for (int i = 0; i < NUM; ++i) { float scale = (Mathf.Cos(-pos / 20.0f + i / 20.0f) + 1.0f) / 10.0f + 0.8f; if (scale > 0.95f && frame[i] >= 0) { if (frame[i]++ > time) { frame[i] = -1; objs[i].obj.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); // objs[i].obj.renderer.material.color = Color.white; } else { // objs[i].obj.renderer.material.color = ColorHSV.FromHsv((i+pos/10)%360, 255, 255); } } if (frame[i] > 0) { objs[i].obj.transform.localScale = new Vector3(scale, scale, 1.0f); } else if (frame[i] == 0) { break; } } ++pos; if (frame [NUM - 1] > time) { scene.nextState(); } }