Created
June 10, 2016 17:38
-
-
Save ShirakawaYoshimaru/1fe6d52bfa6e8c450ffa5497cd82799d to your computer and use it in GitHub Desktop.
Cubeを10個生成するCubeGeneraterクラスがある。Adapterパターンを使ってCubeを30個生成する機能を作成せよ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CubeGenerater | |
{ | |
public void Make10 () | |
{ | |
for (int i = 0; i < 10; i++) { | |
var position = Vector3.right; | |
position.x *= i; | |
Generate (position); | |
} | |
} | |
public void Generate (Vector3 position) | |
{ | |
var newCube = GameObject.CreatePrimitive (PrimitiveType.Cube); | |
newCube.transform.position = position; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment