public void OnClickButton() { //プレイヤが動いていないときだけボタンを押せる if (!BoardMaster.is_moving) { BoardMaster.getInstance().UpdateGame(id); } }
public void Awake() { sprite = GetComponent <SpriteRenderer>(); missileObjectPool = ObjectPoolManager.GetInstance().Get(objectPoolKey); // Debug.Log(missileObjectPool == null); view = GetComponent <FieldOfView>(); master = BoardMaster.GetInstance(); standard = master.destination.transform.position; }
public static BoardMaster getInstance() { if (instance == null) { instance = FindObjectOfType(typeof(BoardMaster)) as BoardMaster; if (instance == null) { Debug.Log("BoardMasterのインスタンスがない"); } } return(instance); }
private IEnumerator move(int count, GameObject player) { //is_movingがtrueの間はボタンを押しても意味がなくなる BoardMaster.is_moving = true; int dir = 1; for (int i = 0; i < count; i++) { //ゴール超えて進むようなら逆戻り if (player.transform.position.x > BoardMaster.getInstance().getfinishPoint() - 0.5f) { dir = -1; } Vector3 pos = player.transform.position; pos.x += dir * 1.5f; player.transform.position = pos; //プレイヤ0のときだけカメラを動かす if (player.gameObject.tag == "0") { GameObject.Find("Main Camera").transform.position = new Vector3(player.transform.position.x + 15, 25.5f, -6); } yield return(new WaitForSeconds(0.5f)); } //振り出しに戻るマスの効果 if (player.transform.position.x == BoardMaster.BackStage * 1.5f) { Vector3 pos = player.transform.position; pos.x = 0; player.transform.position = pos; //プレイヤ0のときだけカメラを動かす if (player.gameObject.tag == "0") { GameObject.Find("Main Camera").transform.position = new Vector3(player.transform.position.x + 15, 25.5f, -6); } } //ゴールマスにピッタリ止まる if (player.transform.position.x > BoardMaster.getInstance().getfinishPoint() - 0.5f) { BoardMaster.getInstance().finish(); } //動き終わったことを示す textcontroller.addText("finish move\n"); BoardMaster.is_moving = false; }
// Use this for initialization void Start() { //表示するテキスト text = GetComponent <Text>(); string win; if (BoardMaster.getwinID() == 0) { win = "勝ち"; } else { win = "負け"; } text.text = "あなたの" + win + "です。\nエンターを押して再スタート\n"; //画像の表示 Texture2D texture0 = Resources.Load("Materials/guriko") as Texture2D; Image img = GameObject.Find("Canvas/Image").GetComponent <Image> (); img.sprite = Sprite.Create(texture0, new Rect(0, 0, texture0.width, texture0.height), Vector2.zero); }
void GenerateNewMap(int xSize, int ySize) { if (xSize < 1 || ySize < 1) { Debug.Log("Map is too small."); return; } if (null == TileVisualizer.instance) { Debug.LogError("No TileVisualizer Found!"); return; } ++currentMapNumber; currentMap = new GameObject().AddComponent <BoardMaster>(); currentMap.name = "New Map " + currentMapNumber; currentMap.basicTilePrefab = (Tile)Resources.LoadAssetAtPath("Assets/Prefabs/Tiles/Basic Tile.prefab", typeof(Tile)); currentMap.tileSize = 1; currentMap.tileSeparation = tileSeparation; currentMap.Setup(xSize, ySize); }
void OnGUI() { EditorGUILayout.BeginHorizontal(); xSize = EditorGUILayout.IntField("X", xSize); ySize = EditorGUILayout.IntField("Y", ySize); EditorGUILayout.EndHorizontal(); tileSeparation = EditorGUILayout.FloatField("Tile Separation", tileSeparation); if (GUILayout.Button("Generate Blank Map")) { GenerateNewMap(xSize, ySize); } currentMap = (BoardMaster)EditorGUILayout.ObjectField("Current Map", currentMap, typeof(BoardMaster), true); if (GUILayout.Button("Save Map as Prefab")) { SaveCurrentMapAsPrefab(); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Rotate Left")) { RotateSelectionLeft(); } if (GUILayout.Button("Rotate Right")) { RotateSelectionRight(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField("Replace Tile"); EditorGUILayout.BeginVertical(); for (int i=0; i < (int)TileType.MAX; i++) { if (GUILayout.Button(((TileType)i).ToString())) { ReplaceSelectedTiles((TileType)i); } } EditorGUILayout.EndVertical(); EditorGUILayout.LabelField("Walls"); EditorGUILayout.BeginVertical(); for (int i=0; i < 4; i++) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Wall " + ((Facing)i).ToString())) { AddWallInDirection((Facing)i); } if (GUILayout.Button("Rotate Wall " + ((Facing)i).ToString())) { RotateWallAtDirection((Facing)i); } if (GUILayout.Button("Remove Wall " + ((Facing)i).ToString())) { RemoveWallInDirection((Facing)i); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.LabelField("Replace Walls"); EditorGUILayout.BeginVertical(); for (int i=0; i < 4; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(((Facing)i).ToString()); for (int j=0; j < (int)WallType.MAX; j++) { if (GUILayout.Button(((WallType)j).ToString())) { ChangeWallInDirection((Facing)i, (WallType)j); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
void GenerateNewMap(int xSize, int ySize) { if (xSize < 1 || ySize < 1) { Debug.Log("Map is too small."); return; } if (null == TileVisualizer.instance) { Debug.LogError("No TileVisualizer Found!"); return; } ++currentMapNumber; currentMap = new GameObject().AddComponent<BoardMaster>(); currentMap.name = "New Map " + currentMapNumber; currentMap.basicTilePrefab = (Tile)Resources.LoadAssetAtPath("Assets/Prefabs/Tiles/Basic Tile.prefab", typeof(Tile)); currentMap.tileSize = 1; currentMap.tileSeparation = tileSeparation; currentMap.Setup(xSize, ySize); }
void OnGUI() { EditorGUILayout.BeginHorizontal(); xSize = EditorGUILayout.IntField("X", xSize); ySize = EditorGUILayout.IntField("Y", ySize); EditorGUILayout.EndHorizontal(); tileSeparation = EditorGUILayout.FloatField("Tile Separation", tileSeparation); if (GUILayout.Button("Generate Blank Map")) { GenerateNewMap(xSize, ySize); } currentMap = (BoardMaster)EditorGUILayout.ObjectField("Current Map", currentMap, typeof(BoardMaster), true); if (GUILayout.Button("Save Map as Prefab")) { SaveCurrentMapAsPrefab(); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Rotate Left")) { RotateSelectionLeft(); } if (GUILayout.Button("Rotate Right")) { RotateSelectionRight(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField("Replace Tile"); EditorGUILayout.BeginVertical(); for (int i = 0; i < (int)TileType.MAX; i++) { if (GUILayout.Button(((TileType)i).ToString())) { ReplaceSelectedTiles((TileType)i); } } EditorGUILayout.EndVertical(); EditorGUILayout.LabelField("Walls"); EditorGUILayout.BeginVertical(); for (int i = 0; i < 4; i++) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Wall " + ((Facing)i).ToString())) { AddWallInDirection((Facing)i); } if (GUILayout.Button("Rotate Wall " + ((Facing)i).ToString())) { RotateWallAtDirection((Facing)i); } if (GUILayout.Button("Remove Wall " + ((Facing)i).ToString())) { RemoveWallInDirection((Facing)i); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.LabelField("Replace Walls"); EditorGUILayout.BeginVertical(); for (int i = 0; i < 4; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(((Facing)i).ToString()); for (int j = 0; j < (int)WallType.MAX; j++) { if (GUILayout.Button(((WallType)j).ToString())) { ChangeWallInDirection((Facing)i, (WallType)j); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
void Awake() { SharedInstance = this; myTransform = transform; }