public void ForgeOver() { onForging = false; heatPower--; if (heatPower <= 0) { heatPower = 0; isHeat = false; fire.GetComponent <SpriteRenderer>().enabled = false; animator.SetBool("IsHeat", false); } fire.localScale = new Vector3(heatScale[heatPower], heatScale[heatPower], 1.0f); for (int i = 0; i < current_num; i++) { CPickItem temp; if (i < rockNum) { temp = pickItemSystem.SpawnInUsed(transform.position, 4); } else { temp = pickItemSystem.SpawnInUsed(transform.position, CItemDataBase.items.Length - 1); } temp.SetFall(1.5f, new Vector3(1, 2.0f - 0.6f * i, 0), 6.0f); } //if (canForge) //能組合出的 //{ // Transform temp = pickItemSystem.SpawnInUsed(transform.position, forgeID); // temp.GetComponent<CPickItem>().SetFall(1.5f,new Vector3(1,2.0f,0), 6.0f); //} //else //{ //不能的變成灰燼 //} ResetForge(); }
public void RecycleFree(Poison poison) { Vector3 posOffset = new Vector3(poison.transform.position.x, poison.transform.position.y - 0.8f, poison.transform.position.z); freePoisons.Add(poison); usedPoisons.Remove(poison); CPickItem tempPick = pickItemSystem.SpawnInUsed(posOffset, 3); tempPick.SetZBase(-110.0f); //if (IsOnHeight3(posOffset) && posOffset.z < -50.0f) { // CPickItem tempPick= pickItemSystem.SpawnInUsed(posOffset, 3); // tempPick.SetZBase(-100.0f); //} poison.gameObject.SetActive(false); freeNum++; }
public void ThrowItemOut() { int random = Random.Range(2, 4); if (IsHealthCollect()) { random = 1; } CPickItem tempItem; for (int i = 0; i < random; i++) { tempItem = pickitem_system.SpawnInUsed(transform.position + new Vector3(0, throwHeight, 0), itemTypes); if (tempItem == null) { break; } //tempItem = pickitem_system.usedList.GetChild(pickitem_system.usedList.childCount - 1); Vector3 throwWay = new Vector3(0, -1.0f, 0); float angle = 0.0f; if (i <= 0) { angle = (Random.Range(0, 10) > 6 ? 1.0f : -1.0f) * Random.Range(5.0f, 90.0f); } else { float offset = (Random.Range(0, 10) > 6 ? 1.0f : -1.0f) * Random.Range(15.0f, 30.0f); angle = (Mathf.Abs(angle + offset) < 90.0f) ? angle : (Mathf.Sign(offset) * 90.0f - offset); } throwWay = Quaternion.AngleAxis(angle, new Vector3(0, 0, 1)) * throwWay; if (StageManager.currentStage != 7) { tempItem.SetFall(0.5f, throwWay, throwSpeed); } else { tempItem.SetFall(0.5f, throwWay, throwSpeed, levelHieght.GetHeight()); } Debug.Log("throw out " + throwWay); } pickitem_system.RecyclePickCollect(this.gameObject); ResetTree(); }
void ProgressMission() { if (progress == 1) { pickItemSystem.SpawnInUsed(new Vector3(-14.0f, 3.0f, 0.0f), 1); pickItemSystem.SpawnInUsed(new Vector3(4.3f, 2.5f, 0.0f), 5); } else if (progress == 2) { pickItemSystem.SpawnInUsed(new Vector3(-14.0f, 3.0f, 0.0f), 1); //pickItemSystem.SpawnInUsed(new Vector3(-15.6f, -1.0f, 0.0f), 1); pickItemSystem.SpawnInUsed(new Vector3(-12.0f, -8.0f, 0.0f), 2); craftRequestNumber.enabled = true; attackerRequestNumber.enabled = true; needNumber = 2; } else if (progress == 3) { pickItemSystem.SpawnInUsed(new Vector3(-14.0f, 3.0f, 0.0f), 1); pickItemSystem.SpawnInUsed(new Vector3(15.0f, 2.0f, 0.0f), 1); pickItemSystem.SpawnInUsed(new Vector3(16.0f, -7.5f, 0.0f), 1); pickItemSystem.SpawnInUsed(new Vector3(-11.0f, 5.5f, 0.0f), 1); pickItemSystem.SpawnInUsed(new Vector3(-12.0f, -8.0f, 0.0f), 2); needNumber = 2; } else if (progress == 4) { pickItemSystem.SpawnPickCollect(new Vector3(-13.0f, -9.0f, 0.0f), 0); pickItemSystem.SpawnPickCollect(new Vector3(14.5f, -3.0f, 0.0f), 0); pickItemSystem.SpawnPickCollect(new Vector3(-12.7f, 2.3f, 0.0f), 2); needNumber = 3; enemySystem.AddUsedList(new Vector3(0.0f, 10.3f, 0.0f)); } else if (progress == 5) { needNumber = 2; } }