GetNumberAfterRotation









How do I use Get Number After Rotation
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: BlockScript.cs Copy
88  public void rotateBlock (Vector3 direction) {
89   this.rotateDirection = direction;
90   this.rotationTotal = 0;
91   this.rotateNewBlockNumber = this.GetNumberAfterRotation(direction);
92  }
File name: BlockScript.cs Copy
155  private int GetNumberAfterRotation(Vector3 direction) {
156   //rotating to the left
157   if(direction == Vector3.up) {
158    return gameScript.getBlockNumber (2-z,y,x);
159   }
160   //rotating to the right
161   if(direction == Vector3.down) {
162    return gameScript.getBlockNumber (z,y,2-x);
163   }
164   //rotating up
165   if(direction == Vector3.left) {
166    return gameScript.getBlockNumber (x,2-z,y);
167   }
168   //rotating down
169   if(direction == Vector3.right) {
170    return gameScript.getBlockNumber (x,z,2-y);
171   }
172   return 1;
173  }

GetNumberAfterRotation 131 lượt xem

Gõ tìm kiếm nhanh...