미니 게임 화면 양끝
This commit is contained in:
parent
7cef99de09
commit
936564a2a3
|
|
@ -44,7 +44,12 @@ public class Game_Mini : MonoBehaviour
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
PcPosLimit = (Screen.width >> 1) - 70f;
|
// 부모 RectTransform 크기 가져오기
|
||||||
|
RectTransform parentRt = tf_pc.parent as RectTransform;
|
||||||
|
|
||||||
|
// 부모의 절반 너비에서 캐릭터 크기/여백 빼서 제한
|
||||||
|
float halfWidth = parentRt.rect.width * 0.5f;
|
||||||
|
PcPosLimit = halfWidth - (tf_pc.rect.width * 0.5f) - 0f; // 70px 여백
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
|
@ -205,7 +210,7 @@ public class Game_Mini : MonoBehaviour
|
||||||
obtacle = DSUtil.Get_Clone<MiniGameObtacle>(go_Obtacle, tf_obtacleParent);
|
obtacle = DSUtil.Get_Clone<MiniGameObtacle>(go_Obtacle, tf_obtacleParent);
|
||||||
list_MiniGameObtacle.Add(obtacle);
|
list_MiniGameObtacle.Add(obtacle);
|
||||||
}
|
}
|
||||||
obtacle.Set(dic_weight, tf_objend);
|
obtacle.Set(dic_weight, tf_objend, PcPosLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public class MiniGameObtacle : MonoBehaviour
|
||||||
eMiniGameObtacleType m_Type;
|
eMiniGameObtacleType m_Type;
|
||||||
ProtectedInt32 m_Dmg;
|
ProtectedInt32 m_Dmg;
|
||||||
|
|
||||||
public void Set(Dictionary<eMiniGameObtacleType, int> dic_weight, RectTransform rtend)
|
public void Set(Dictionary<eMiniGameObtacleType, int> dic_weight, RectTransform rtend, float pcposlimit)
|
||||||
{
|
{
|
||||||
gameObject.SetActive(true);
|
gameObject.SetActive(true);
|
||||||
SetRandomTypeByWeight(dic_weight);
|
SetRandomTypeByWeight(dic_weight);
|
||||||
|
|
@ -24,8 +24,7 @@ public class MiniGameObtacle : MonoBehaviour
|
||||||
m_Rigidbody2D.gravityScale = Random.Range(table_GlobalValue.Ins.Get_Float("MiniGameSpeedMin"),
|
m_Rigidbody2D.gravityScale = Random.Range(table_GlobalValue.Ins.Get_Float("MiniGameSpeedMin"),
|
||||||
table_GlobalValue.Ins.Get_Float("MiniGameSpeedMax"));
|
table_GlobalValue.Ins.Get_Float("MiniGameSpeedMax"));
|
||||||
|
|
||||||
var x = (Screen.width >> 1) - 50;
|
m_RectTransform.anchoredPosition = new Vector2(Random.Range(-pcposlimit, pcposlimit), 0f);
|
||||||
m_RectTransform.anchoredPosition = new Vector2(Random.Range(-x, x), 0f);
|
|
||||||
|
|
||||||
Set_Item();
|
Set_Item();
|
||||||
i_img.transform.eulerAngles = Vector3.zero;
|
i_img.transform.eulerAngles = Vector3.zero;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue