void findUI() { mGo_One = transform.FindChild(mGo_One_Path).gameObject; mGo_Two = transform.FindChild(mGo_Two_Path).gameObject; itemTwo = Framework.AddOneComponent<FruitItemTwo>(mGo_Two); itemOne = Framework.AddOneComponent<FruitItemOne>(mGo_One); }
void findUI() { mGo_One = transform.FindChild(mGo_One_Path).gameObject; mGo_Two = transform.FindChild(mGo_Two_Path).gameObject; itemTwo = Framework.AddOneComponent <FruitItemTwo>(mGo_Two); itemOne = Framework.AddOneComponent <FruitItemOne>(mGo_One); }
public void setUp(FruitItemOne fruit) { fruit.transform.localPosition = new Vector3(0f, GameData.mMaxBottomY); Rigidbody body = fruit.GetComponent <Rigidbody>(); body.velocity = Vector3.zero; int randForceX = Random.Range(GameData.mMinUpForceX, GameData.mMaxUpForceX); int randForceY = Random.Range(GameData.mMinUpForceY, GameData.mMaxUpForceY); body.AddForce(new Vector3(randForceX, randForceY, 0f)); int rand = Random.Range((int)fruitType.apple, (int)fruitType.sandia); fruitType type = Framework.getTypeByID(rand); FruitItem item = fruit.GetComponentInParent <FruitItem>(); item.init(type); body.isKinematic = false; }
// 添加水果到场景中; void addJumpFruits(int number) { for (int i = 0; i < number; ++i) { // 设置水果从下面弹上来; int rand = Random.Range((int)fruitType.apple, (int)fruitType.sandia); fruitType type = Framework.getTypeByID(rand); GameObject go = Framework.loadFruit(gameObject, type, new Vector3(0f, GameData.mMaxBottomY)); FruitItemOne itemOne = go.GetComponent <FruitItemOne>(); MainModel.Instance.AddFruitsOne(itemOne); Rigidbody body = Framework.AddOneComponent <Rigidbody>(go); int randForceX = Random.Range(GameData.mMinUpForceX, GameData.mMaxUpForceX); int randForceY = Random.Range(GameData.mMinUpForceY, GameData.mMaxUpForceY); body.AddForce(new Vector3(randForceX, randForceY, 0f)); body.isKinematic = false; } }
public void AddFruitsOne(FruitItemOne item) { mFruitsOneList.Add(item); }
public void setUp(FruitItemOne fruit) { fruit.transform.localPosition = new Vector3(0f,GameData.mMaxBottomY); Rigidbody body = fruit.GetComponent<Rigidbody>(); body.velocity = Vector3.zero; int randForceX = Random.Range(GameData.mMinUpForceX, GameData.mMaxUpForceX); int randForceY = Random.Range(GameData.mMinUpForceY, GameData.mMaxUpForceY); body.AddForce(new Vector3(randForceX, randForceY, 0f)); int rand = Random.Range((int)fruitType.apple, (int)fruitType.sandia); fruitType type = Framework.getTypeByID(rand); FruitItem item = fruit.GetComponentInParent<FruitItem>(); item.init(type); body.isKinematic = false; }