private void SetBigUi() { try { ConsoleRect.TransferValuesFrom(C_RestTransform2); //C_RestTransform2.ApplyTo(ConsoleRect); BorderText.TransferValuesFrom(B_Text2); MessageRect.TransferValuesFrom(M_RectTransfrom2); PointATrans.position = PointA_Pos2.GetComponent <Transform>().position; PointBTrans.position = PointB_Pos2.GetComponent <Transform>().position; //PointATrans.TransferValuesFrom(PointA_Pos2); //PointBTrans.TransferValuesFrom(PointB_Pos2); FloorRect.TransferValuesFrom(Floor_Rect2); TileRect.TransferValuesFrom(Tile_Rect2); EffectRect.TransferValuesFrom(Effect_Rect2); ItemName.TransferValuesFrom(item_Name2); ItemType.TransferValuesFrom(item_Type2); ItemRareness.TransferValuesFrom(item_Rareness2); ItemEffects.TransferValuesFrom(item_Effects2); } catch { } }
public ItemHolder() { name = ""; count = 0; cost = 0; description = ""; effects = new ItemEffects(); }
// 施放物品时候可能会发生的效果 public void PutOnGround() { int resultSize = 0; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo, (clickInScene.distanceToClick + clickInScene.cameraDistance), clickInScene.layerMask) && clickInScene.canAct) { GameObject dragOnObject = hitInfo.collider.gameObject; print(dragOnObject); ObItem targetOb; string targetName; InSceneItem inSceneProperty = dragOnObject.GetComponent <InSceneItem>(); targetOb = dragOnObject.GetComponent <ObItem>(); targetName = dragOnObject.name; print(draggedItem.name + ", on to ground item: " + dragOnObject.name); if (inSceneProperty != null && inSceneProperty.itemType != InSceneItem.ItemTypes.UncollNUnin) { go.ob.GetComponent <ObManagement>().GetItemType(dragOnObject); } canPlaceItem = ItemEffects.canPlace(draggedItem.name, targetName); if (canPlaceItem) { if (targetName == "WCPlaceholder") { ItemEffects.puzzleEffect(draggedItem.name, targetName, pointerData.position, draggedItem, dragOnObject, false); } else { GameObject targetObj = targetOb.correspondingOB; this.placedOnGround = true; go.ob.GetComponent <ObManagement>().DelayedEffect(draggedItem.name, targetName, pointerData.position, draggedItem, targetObj); // ItemEffects.puzzleEffect(draggedItem.name, targetName, pointerData.position, draggedItem, targetObj); go.backpack.GetComponent <Backpack>().RemoveItem(draggedItem); } } else if (inSceneProperty != null) { if (inSceneProperty.itemType != InSceneItem.ItemTypes.CollNIn) { // Dialog nothing happens } else if (inSceneProperty.itemType != InSceneItem.ItemTypes.UncollNIn) { // Dialog nothing happens } else if (inSceneProperty.itemType != InSceneItem.ItemTypes.CollNUnin) { // Dialog this is not interactable but you can collect } } } }
public void StopEffect(ItemEffects itemEffect) { Destroy(itemEffect.itemSlider); itemEffects.Remove(itemEffect); itemEffect.timer = itemEffect.itemDuration; playerMovement.speed -= itemEffect.speedBonus; playerAttack.damagePerShot -= itemEffect.attackBonus; playerAttack.timeBetweenBullets += itemEffect.attackSpeedBonus; }
public virtual void Use() //RMB { //user = ScriptToolbox.GetInstance().GetPlayerManager().player.transform; ItemEffects.Use(myUseEffect, this); if (destroyOnUse) { quantity--; if (quantity == 0) { RemoveFromInventory(); } } }
private EffectInteger GetEffectToDown(EffectInteger runeEffect) { var effectToImprove = GetEffectToImprove(runeEffect); // recherche de jet exotique var exoticEffect = ItemEffects.Where(x => IsExotic(x) && x != effectToImprove).RandomElementOrDefault(); if (exoticEffect != null) { return(exoticEffect); } // recherche de jet overmax var overmaxEffect = ItemEffects.Where(x => IsOverMax(x, runeEffect) && x != effectToImprove).RandomElementOrDefault(); if (overmaxEffect != null) { return(overmaxEffect); } var rand = new CryptoRandom(); foreach (var effect in ItemEffects.ShuffleLinq().Where(x => x != effectToImprove)) { if (EffectManager.Instance.GetEffectPower(effect) - EffectManager.Instance.GetEffectPower(runeEffect) < MAX_STAT_POWER) { continue; } if (rand.NextDouble() <= EffectManager.Instance.GetEffectPower(runeEffect) / Math.Abs(EffectManager.Instance.GetEffectBasePower(effect))) { return(effect); } } return(ItemEffects.FirstOrDefault(x => x != effectToImprove)); }
public void StartEffect(ItemEffects itemEffect) { if (itemEffect.healthRegeneration > 0 && playerHealth.currentHealth >= playerHealth.startingHealth) { return; } foreach (ItemEffects item in itemEffects) { if (itemEffect.flashColor == item.flashColor) { item.timer = itemEffect.itemDuration; damageImage.color = itemEffect.flashColor; Destroy(itemEffect.gameObject); return; } } itemEffect.itemSlider = Instantiate(sliderPrefab, hud.transform); itemEffect.slider = itemEffect.itemSlider.gameObject.GetComponent <Slider>(); (itemEffect.slider as UnityEngine.UI.Slider).GetComponentsInChildren <UnityEngine.UI.Image>().FirstOrDefault(t => t.name == "Fill").color = itemEffect.flashColor; damageImage.color = itemEffect.flashColor; Destroy(itemEffect.gameObject); itemEffects.Add(itemEffect); itemEffect.timer = itemEffect.itemDuration; playerMovement.speed += itemEffect.speedBonus; playerHealth.currentHealth = System.Math.Min(1000, playerHealth.currentHealth + itemEffect.healthRegeneration); playerAttack.damagePerShot += itemEffect.attackBonus; playerAttack.timeBetweenBullets -= itemEffect.attackSpeedBonus; }
public HealthPotionSmall() { ItemEffects.Add(GiveHealth); }
IEnumerator Effect(float secs) { yield return(new WaitForSeconds(secs)); ItemEffects.puzzleEffect(tool, target, hitPoint, toolObj, targetObj, false); }
private EffectInteger GetEffectToImprove(EffectInteger runeEffect) { return(ItemEffects.FirstOrDefault(x => x.EffectId == runeEffect.EffectId || (x.Template.OppositeId != 0 && x.Template.OppositeId == runeEffect.Id))); }
ItemEffects theItemEffect; //아이템 사용시 호출 private void Start() { theItemEffect = FindObjectOfType <ItemEffects>(); }
//已作废:施放物品时候可能会发生的效果 public void Put() { if (holdItem && raycaster != null && !dialogShown) { //Set up the new Pointer Event pointerData = new PointerEventData(go.clickManagement.eventSystem); pointerData.position = Input.mousePosition; List <RaycastResult> results = new List <RaycastResult>(); //Raycast using the Graphics Raycaster and mouse click position raycaster.Raycast(pointerData, results); bool placed = false; bool isInEquipmentState = false; int resultSize = 0; //For every result returned, output the name of the GameObject on the Canvas hit by the Ray foreach (RaycastResult result in results) { resultSize += 1; GameObject dragOnObject = result.gameObject; print(dragOnObject); if (canEquip && dragOnObject.name.CompareTo("EquipmentState") == 0 && equipmentState.isEquiped == false && !ClickOnTransparent(go.equipmentState, Input.mousePosition)) { //装备新物品于装备栏 placed = true; equipmentState.Equip(draggedItem); print("make sure it exist" + draggedItem.GetComponent <ObItem>()); break; } else { ObItem targetOb; string targetName; if (dragOnObject.name.CompareTo("EquipmentState") == 0 && equipmentState.isEquiped == true) { //与装备栏里的物品交互 targetOb = equipmentState.equipedItemOb; targetName = equipmentState.currentEquipmentName; isInEquipmentState = true; dragOnObject = equipmentState.equipedItemOb.gameObject; // print(draggedItem.name + ", on to equipment: " + equipmentState.currentEquipmentName); // print("equipment interact debug: " + targetOb.gameObject.transform.parent); } else { //directly interact with another object either on OB or in backpack targetOb = dragOnObject.GetComponent <ObItem>(); targetName = dragOnObject.name; // print(draggedItem.name + ", on to: " + dragOnObject.transform.parent); } if (targetName == draggedItem.name) { continue; } else if (targetName == "BigStovehole") { } else if (targetOb != null) { // 与 装备状态处的装备物品 / 背包物品 交互 go.ob.GetComponent <ObManagement>().GetItemType(dragOnObject); print("GetItemType"); dragOnObject = targetOb.correspondingOB; } canPlaceItem = ItemEffects.canPlace(draggedItem.name, targetName); if (canPlaceItem) { if (draggedItem.name.CompareTo("The Atlas") == 0) { transform.localScale = itemOriginalScale / itemScale; } if (targetName.CompareTo("BigStovehole") == 0) //放入炉灶中 { dragOnObject.GetComponent <HearthOb>().PutIntoStove(0); go.backpack.GetComponent <Backpack>().RemoveItem(draggedItem); placed = true; break; } if (targetName.CompareTo("SmallStovehole") == 0) //放入炉灶中 { dragOnObject.GetComponent <HearthOb>().PutIntoStove(1); go.backpack.GetComponent <Backpack>().RemoveItem(draggedItem); placed = true; break; } if (targetName.CompareTo("BurntCharcoal") == 0) //直接对炉灶中的柴火进行重塑 { dragOnObject.GetComponent <HearthOb>().RepairCoalInOB(); go.backpack.GetComponent <Backpack>().RemoveItem(draggedItem); placed = true; break; } if (targetName.CompareTo("NewWood") == 0) //点燃炉子里的新木材 { dragOnObject.GetComponent <HearthOb>().Ignitewood(); go.backpack.GetComponent <Backpack>().RemoveItem(draggedItem); placed = true; break; } // else // go.backpack.GetComponent<Backpack>().RemoveItem(draggedItem); ItemEffects.puzzleEffect(draggedItem.name, targetName, pointerData.position, draggedItem, dragOnObject, isInEquipmentState); // if (draggedItem.name.CompareTo("Tao-Book") != 0 && draggedItem.name.CompareTo("Talisman") != 0 && draggedItem.name.CompareTo("The Atlas") != 0 && SceneManager.GetActiveScene().name != "SampleScene") // GameObject.Find("pickupEffect").GetComponent<pickupEffect>().castAni(pointerData.position); go.backpack.GetComponent <Backpack>().RemoveItem(draggedItem); // Debug.Log("remove: " + draggedItem); placed = true; break; } else if (!canInteract) { // Dialog this is not interactable } else { // canInteract==true // Dialog nothing happens } } // if (SceneManager.GetActiveScene().name != "SampleScene") // GameObject.Find("playerParticleEffect").GetComponent<castEffect>().stopCasting(); } if (!placed) { // UISoundScript.PlayWrongSpell(); // AIDataManager.wrongItemPlacementCount += 1; PutOnGround(); if (!placedOnGround) { draggedItem.GetComponent <RectTransform>().sizeDelta = originalSize; } } } }