// 创建UI界面的水果; public static GameObject CreateUIFruit(GameObject parent, fruitType type, Vector3 vec) { GameObject obj = Instantiate(Resources.Load(UIPrafabs.oneFruit)) as GameObject; obj.transform.parent = parent.transform; obj.transform.localScale = Vector3.one; obj.transform.localPosition = vec; FruitItem fruit = AddOneComponent <FruitItem>(obj); fruit.init(type); return(fruit.getOne()); }
public static GameObject loadFruit(GameObject parent, fruitType type, Vector3 vec) { GameObject go = Instantiate(Resources.Load(UIPrafabs.oneFruit)) as GameObject; go.transform.parent = parent.transform; go.transform.localScale = Vector3.one; go.transform.localPosition = Vector3.zero; FruitItem fruit = AddOneComponent <FruitItem>(go); fruit.init(type); fruit.setPos(vec); return(fruit.getOne()); }
void setNewGame() { // 游戏的外环顺时针旋转; mGo_Game_parent.transform.localPosition = GameData.Vecs_mGo_GameParent; GameObject mGo_Game_ring = mGo_Game_parent.transform.FindChild("ring").gameObject; Framework.SetRotate(mGo_Game_ring, 10f, false); Framework.SetScale(mGo_Game_ring); AddRing(mGo_Game_ring); // 游戏的水果逆时针旋转; Vector3 vec = mGo_Game_parent.transform.FindChild("fruitparent").localPosition; if (mGo_Game == null) { mGo_Game = Framework.CreateUIFruit(mGo_Game_parent, fruitType.sandia, vec); Framework.AddOnClick(mGo_Game, "", OnGame); } FruitItem fuit = mGo_Game.GetComponentInParent <FruitItem>(); fuit.getOne().SetActive(true); Framework.SetRotate(mGo_Game.transform.parent.gameObject, 5f, true); Framework.SetScale(mGo_Game.transform.parent.gameObject); }