//壁の高さを変更 private void ChangeHeight(GameObject[] allPanels) { EditorGUI.BeginChangeCheck(); m_WallHeight = EditorGUILayout.IntField("壁の高さ", m_WallHeight); if (EditorGUI.EndChangeCheck()) { StagePanel panel = (StagePanel)target; var walls = panel.GetComponentsInChildren <Wall>(); foreach (var wall in walls) { Vector3 baseScale = wall.transform.localScale; //wall.transform.localScale = new Vector3(baseScale.x, m_WallHeight, baseScale.z); Undo.RecordObject(wall.transform, "対象の壁の高さ変更"); wall.transform.localScale = new Vector3(baseScale.x, m_WallHeight, baseScale.z); } } if (GUILayout.Button("全てのパネルに適用")) { foreach (var panel in allPanels) { var walls = panel.GetComponentsInChildren <Wall>(); foreach (var wall in walls) { Undo.RecordObject(wall.transform, "壁の高さ変更"); Vector3 baseScale = wall.transform.localScale; wall.transform.localScale = new Vector3(baseScale.x, m_WallHeight, baseScale.z); } //StagePanel panelComp = panel.GetComponent<StagePanel>(); //if (panelComp.m_UseStageLevel == thisPanelComp.m_UseStageLevel) } } }
//ステージパネル作成 private void CreateStagePanele(object dire) { //複数選択対応 foreach (var thisObj in targets) { StagePanel thisPanel = (StagePanel)thisObj; //新規パネル生成 int direInt = (int)dire; Transform baseTrans = thisPanel.transform; GameObject newObj = Instantiate( (GameObject)Resources.Load("Prefub/Prefub_StagePanel") , baseTrans.position , baseTrans.rotation); newObj.transform.parent = thisPanel.transform.parent; newObj.transform.localScale = baseTrans.localScale; StagePanel newPanel = newObj.GetComponent <StagePanel>(); //位置を設定 float worldScale = thisPanel.transform.lossyScale.x; Vector3 modify = thisPanel.transform.rotation * m_Dires[direInt] * StagePanel.m_InscribedR * 2 * worldScale; newPanel.transform.position += modify; newPanel.transform.rotation = thisPanel.transform.rotation; Undo.RegisterCreatedObjectUndo(newObj, "Create StagePanel"); } }
private void OnEnable() { StagePanel thisPanel = (StagePanel)target; Wall OneWall = thisPanel.GetComponentInChildren <Wall>(); if (OneWall != null) { m_WallHeight = (int)(OneWall.gameObject.transform.localScale.y); } //m_OnlyActiveStageLevel = thisPanel.m_UseStageLevel; }
private void ReSpawn(EnemyBase enemy) { StageManager stageManager = GameManager.Instance.m_StageManger; //アクティブなパネルのうちランダムなものを取得 List <StagePanel> panels = stageManager.m_ActivePanels; StagePanel panel = panels[Random.Range(0, panels.Count)]; Transform panelTrans = panel.gameObject.transform; //パネルの中心から内接円の半径以下の距離の場所に移動 float distance = Random.Range(0, panelTrans.lossyScale.x * StagePanel.m_InscribedR / 2f); Vector3 randVec = new Vector3(Random.Range(0f, 1f), 0, Random.Range(0f, 1f)); Vector3 resPos = panelTrans.position + (randVec.normalized * distance); enemy.transform.position = resPos; enemy.GetComponent <EnemyBase>().NextTarget(); enemy.GetComponent <EnemyBase>().m_IsDead = false; //enemy.transform.localScale = Vector3.one * 0.4f;// * scale; enemy.gameObject.SetActive(true); }