void Block_BeginExplodes(AddOneGame.Lib.Block block, Color color) { ExplodeAnimation.Begin(); }
void Update() { if (Instance == null) { Instance = this; } for (int j = 0; j < ExplodedViewdataClasses.Length; j++) { ExplodedViewdataClasses[j].obj = GameObject.Find("Cube" + j); } if (isExplode) { for (int i = 0; i < ExplodedViewdataClasses.Length; i++) { switch (ExplodedViewdataClasses[i].direction) { case ExplodedViewdataClass.DirectionTest.Left: ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position , new Vector3(-ExplodedViewdataClasses[i].Offset, ExplodedViewdataClasses[i].obj.transform.position.y, ExplodedViewdataClasses[i].obj.transform.position.z), Time.deltaTime * Speed); break; case ExplodedViewdataClass.DirectionTest.Right: ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position, new Vector3(ExplodedViewdataClasses[i].Offset, ExplodedViewdataClasses[i].obj.transform.position.y, ExplodedViewdataClasses[i].obj.transform.position.z), Time.deltaTime * Speed); break; case ExplodedViewdataClass.DirectionTest.Up: ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position, new Vector3(ExplodedViewdataClasses[i].obj.transform.position.x, ExplodedViewdataClasses[i].Offset, ExplodedViewdataClasses[i].obj.transform.position.z), Time.deltaTime * Speed); break; case ExplodedViewdataClass.DirectionTest.Down: ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position, new Vector3(ExplodedViewdataClasses[i].obj.transform.position.x, -ExplodedViewdataClasses[i].Offset, ExplodedViewdataClasses[i].obj.transform.position.z), Time.deltaTime * Speed); break; case ExplodedViewdataClass.DirectionTest.Backward: ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position, new Vector3(ExplodedViewdataClasses[i].obj.transform.position.x, ExplodedViewdataClasses[i].obj.transform.position.y, -ExplodedViewdataClasses[i].Offset), Time.deltaTime * Speed); break; case ExplodedViewdataClass.DirectionTest.Forward: ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position, new Vector3(ExplodedViewdataClasses[i].obj.transform.position.x, ExplodedViewdataClasses[i].obj.transform.position.y, ExplodedViewdataClasses[i].Offset), Time.deltaTime * Speed); break; } } } if (!isExplode) { for (int i = 0; i < ExplodedViewdataClasses.Length; i++) { ExplodedViewdataClasses[i].obj.transform.position = Vector3.Lerp(ExplodedViewdataClasses[i].obj.transform.position, StartPos[i], Time.deltaTime * Speed); } } }