public void CraftWeapon() { var rolls = System.Enum.GetValues(typeof(Roll)); weapon.Roll = (Roll)rolls.GetValue(Random.Range(0, rolls.Length)); Globals.GetPlayerController().WeaponData = weapon; var playerResources = Globals.GetPlayerController().resources; ResourceType[] resourcesNeeded = recipe.resources.Keys.ToArray(); for (int i = 0; i < resourcesNeeded.Length; i++) { playerResources[resourcesNeeded[i]] -= recipe.resources[resourcesNeeded[i]]; } GameObject text = Instantiate(Globals.GetPlayerController().Text, Globals.GetPlayer().transform.position, Quaternion.identity) as GameObject; text.transform.SetParent(GameObject.Find("OverlayCanvas").transform); text.GetComponent <Text>().color = Color.white; string rollName = ("" + Globals.GetPlayerController().WeaponData.Roll).Equals("None") ? "" : ("" + Globals.GetPlayerController().WeaponData.Roll); text.GetComponent <Text>().text = rollName + " " + Globals.GetPlayerController().WeaponData.Type + " T" + Globals.GetPlayerController().WeaponData.Tier; text.GetComponent <DestroyAfter>().after = 3.0f; text.GetComponent <MoveUp>().speed = 0.005f; RecipeBook.GetInstance().gameObject.SetActive(false); }
void Update() { if (FadeScreen.IsAnimating() == false && (RecipeBook.GetInstance() == null || RecipeBook.GetInstance().gameObject.activeSelf == false) && Time.timeScale > 0) { UpdateMovement(); PowerUpManager.Update(); UpdateAttack(); UpdateInvincibility(); } else { UpdateAnimator(Vector2.zero); } }