// Update is called once per frame void Update() { var worker = DrawInstance.getWorker(DrawInstance.KEY_bike); worker.draw(mesh, materials); count = worker.getCount(); }
private void LateUpdate() { if (doWorldReScale) { worldReSacle(scaleValue); doWorldReScale = false; } var worker = DrawInstance.getWorker(DrawInstance.KEY_bike); worker.draw(mesh, materials); count = worker.getCount(); }
void Awake() { DrawInstance.getWorker(DrawInstance.KEY_bike).initMatrix(10000, false); for (int x = 0; x < W; x++) { for (int z = 0; z < H; z++) { var bike = GameObject.Instantiate <Bike>(bitePrefab, this.transform); Vector3 newPos = new Vector3(x, 50, z); bike.transform.localPosition = newPos; bike.name = "bike[" + x + "," + z + "]"; } } }
// Update is called once per frame void Update() { // todo: 之後可以改到shader做 for (int x = 0; x < showW; x++) { for (int z = 0; z < showH; z++) { float h = diffuse(x, z); waterHeightSetter[x, z].updateWater(h); } } swapBuffer(); nowWater[flow_index_x, flow_index_z] += waterFollowPerSecond * Time.deltaTime; DrawInstance.getWorker(DrawInstance.KEY_water_park_block).draw(mesh, materials); }
void Awake() { DrawInstance.getWorker(DrawInstance.KEY_water_park_block).initMatrix(showW * showH, true); waterHeightSetter = new WaterHeightSetter[showW, showH]; terrainHeightField = new int[showW, showH]; waterHeightField = new float[showW, showH]; waterHeightField2 = new float[showW, showH]; nowWater = waterHeightField; newWater = waterHeightField2; L = Mathf.Sqrt(W * W + H * H); for (int x = 0; x < showW; x++) { for (int z = 0; z < showH; z++) { WaterHeightSetter newGround = GameObject.Instantiate <WaterHeightSetter>(groundPrefab, this.transform); waterHeightSetter[x, z] = newGround; float h = 0; h += getWave1(x, z); h += getWave2(x, z); h += -getHill(x, z, 25, 25, 5); h += -getHill(x, z, 20, 25, 5); h += -getHill(x, z, 15, 22, 7); h += -getHill(x, z, 10, 17, 10); h += getHill(x, z, 35, 20, 10); h += getHill(x, z, 35, 25, 10); h += getHill(x, z, 35, 35, 10); terrainHeightField[x, z] = (int)h; Vector3 newPos = new Vector3(x, (int)h, z); newGround.transform.localPosition = newPos; newGround.name = "obj[" + x + "," + z + "]"; DrawInstance.getWorker(DrawInstance.KEY_water_park_block).pushTrasform(newGround.transform); } } }
// Start is called before the first frame update void Start() { meshRenderer.enabled = false; DrawInstance.getWorker(DrawInstance.KEY_bike).pushTrasform(transform); }
void OnDestroy() { DrawInstance.getWorker(DrawInstance.KEY_bike).removeTrasform(transform); }
void Awake() { DrawInstance.getWorker(DrawInstance.KEY_bike).initMatrix(10000, false); }