void Start() { ItemDistributor = new ItemDropper(this, this.transform); ItemDistributor.AddItemsToDrop((1, 1), (2, 1)); this.DistanceTracker = new RangeChangeTracker(this.transform, interactionRadius); }
public void DropCurrentItem() { Item item = GetItem(); ItemDropper.Drop(item, true); inventory.RemoveItem(item); Object = null; }
static void ItemDropper_GenerateItem_Post(ItemDropper __instance, ref Item __state) { #region quit if (__state == default) { return; } #endregion __state.Stats.StartingDurability = -1; }
public override void Init() { _inventory = new Inventory(15); _quickslotInventory = new QuickSlotInventory(5); _itemDropper = GetComponent <ItemDropper>(); var index = _quickslotInventory.ConvertQuickSlotIDToIndex(QuickSlotInventory.ID.Center); _quickslotInventory.SetInventoryItem(index, _holdItem.GetInstance(1)); base.Init(); }
static bool ItemDropper_GenerateItem_Pre(ItemDropper __instance, ref Item __state, ItemContainer _container, BasicItemDrop _itemDrop, int _spawnAmount) { #region quit if (_minStartingDurability >= 100 || !_itemDrop.DroppedItem.TryAssign(out var item) || !Prefabs.ItemsByID[item.ItemIDString].TryAssign(out var prefab) || !prefab.Stats.TryAssign(out var prefabStats) || prefabStats.MaxDurability <= 0) { return(true); } #endregion prefabStats.StartingDurability = (prefab.MaxDurability * Random.Range(_minStartingDurability / 100f, 1f)).Round(); __state = prefab; return(true); }
public void handleBottleAdditions() { if (!hasAddedPotionsToHarvestDictionary) { ItemDropper dropTreasuresRarely = new ItemDropper(); dropTreasuresRarely.registerNewDrop(new Item_Rope(0), null, 1, .01f); dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_0(0), null, 1, .01f); dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_1(0), null, 1, .01f); dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_2(0), null, 1, .01f); dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_3(0), null, 1, .01f); dropTreasuresRarely.registerNewDrop(new Item_Meat(0), null, 1, .01f); HarvestDictionary.registerNewHarvest(TileTypeReferencer.POT, new ItemDropper[] { dropTreasuresRarely }); hasAddedPotionsToHarvestDictionary = true; } }
void HideKey(int keyId) { GameObject key = Instantiate(keyObject); key.SetActive(false); key.transform.parent = transform.parent; key.name = "Key " + keyId.ToString(); CollectableController cc = key.GetComponent <CollectableController>(); cc.keyId = keyId; //get random element int index = Mathf.RoundToInt(Random.Range(0, droppingObjects.Count)); ItemDropper id = droppingObjects[index].GetComponent <ItemDropper>(); id.droppingItems.Add(new RandomDrop(key, 1, 1f)); }
void Start() { isHit = false; myCollider = GetComponent<Collider2D>(); if (this.gameObject.tag == "Player") { isPlayer = true; animator = GetComponentInChildren<Animator>(); life = GameObject.Find("LifeManager").GetComponent<LifeManager>(); }else { isPlayer = false; drops = GetComponent<ItemDropper>(); animator = GetComponent<Animator>(); meter = GameObject.Find("Pillage Meter").GetComponent<PillageMeter>(); } }
protected bool linkHpGauge = false; // 체력바를 링킹 할 것인지 // 초기화 protected void Init() { if (sprite == null) { sprite = GetComponentInChildren <SpriteRenderer>(); } if (itemDropper == null) { itemDropper = GetComponent <ItemDropper>(); } AttackCore attackCore = GetComponentInChildren <AttackCore>(); if (attackCore != null) { attackCore.SetAttack(Stats.attack_damage, "Player"); } }
public void ReceiveDropItem(string itemTypeName, Vector3 targetPosition, float targetYaw, int playerID, int itemID, int unitAmount, PhotonMessageInfo info) { if (!info.sender.isMasterClient) { return; } if (playerID != ID) { return; } if (ItemDropper == null) { return; } ItemDropper.MPClientDropItem(itemTypeName, targetPosition, targetYaw, itemID, unitAmount); }
public override void onUse(WorldBase world, Item harvestTool, Vector2 location, TileType tileType, Entity user) { base.onUse(world, harvestTool, location, tileType, user); Random rand = new Random(); world.placeTile(TileTypeReferencer.AIR, location); Item dropped = treasures[rand.Next(treasures.Count)]; ItemDropper drop = new ItemDropper(); drop.registerNewDrop(dropped.clone(dropped.uses), null, dropped.uses, 1); drop.drop(world, harvestTool, location); for (int i = 0; i < 7; i++) { world.addEntity(new ParticleTileBreak(location, world, new Vector2(), tileType, 150)); } }
public void Kill() { if (OnDeath != null) { OnDeath(); } States.CurrentMana.Value = 0; gameObject.SetActive(false); foreach (ItemSurrogate loot in Loot.Select()) { if (loot != null) { ItemDropper.DropItem(transform.position, loot); } } }
public void Kill() { Chat.Instance.Log(name + " died."); if (OnDeath != null) { OnDeath(); } States.CurrentMana.Value = 0; gameObject.SetActive(false); foreach (var loot in Loot.Select()) { if (loot != null) { ItemDropper.DropItem(transform.position, loot); } } }
public ShrubManager(ChunkDecorator decorator) { if (decorator.worldGenSubtype != World.WorldGenSubtype.CENOTE) { //build grass and bushes grass = generateGrass(decorator); bush = generateBush(decorator); bush.harvestTicks += getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1) * 8); grass2 = generateGrass(decorator); bush2 = generateBush(decorator); bush2.harvestTicks += getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1) * 8); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_GRASS.TILEID, grass); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_BUSH_0.TILEID, bush); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_BUSH_1.TILEID, bush2); ItemDropper bushDrops = new ItemDropper(); bushDrops.registerNewDrop(new Item_Grass(0), null, 1, 1f); ItemDropper bushDrops2 = new ItemDropper(); bushDrops2.registerNewDrop(new Item_Grass(0), null, 1, 1f); if (decorator.world is World) { if (decorator.rand.NextDouble() < .15)//chance to give the bush an interesting drop. { Item_Berry bushBerry = UniverseProperties.availableBerries[decorator.rand.Next(3)]; bushDrops.registerNewDrop(bushBerry, null, 1 + decorator.rand.Next(4), (float)(.05 + decorator.rand.NextDouble() * .3)); } if (decorator.rand.NextDouble() < .15)//chance to give the bush an interesting drop. { Item_Berry bushBerry = UniverseProperties.availableBerries[decorator.rand.Next(3)]; bushDrops2.registerNewDrop(bushBerry, null, 1 + decorator.rand.Next(4), (float)(.05 + decorator.rand.NextDouble() * .3)); } } HarvestDictionary.registerNewHarvest(bush, new ItemDropper[] { bushDrops }); HarvestDictionary.registerNewHarvest(bush2, new ItemDropper[] { bushDrops2 }); for (int i = 0; i < 7 + decorator.rand.Next(7); i++) { decorator.foliage.Add(new Decoration(new Point(0, 0), new TileType[, ] { { bush }, })); decorator.foliageBiome2.Add(new Decoration(new Point(0, 0), new TileType[, ] { { bush2 }, })); } } else { for (int i = 0; i < 7 + decorator.rand.Next(7); i++) { decorator.foliage.Add(new Decoration(new Point(0, 0), new TileType[, ] { { TileTypeReferencer.STALAGMITE_TINY }, })); decorator.foliageBiome2.Add(new Decoration(new Point(0, 0), new TileType[, ] { { TileTypeReferencer.STALAGMITE_TINY }, })); } } // }
// Use this for initialization void Start() { Player = GameObject.FindGameObjectWithTag("Player"); itemDropper = GetComponentInChildren <ItemDropper>(); }
public BarrageBuff(BuffContainer container) : base(container) { dropper = container.Obj.GetComponent <ItemDropper>(); settings = (ScriptableBarrageBuff)container.Buff; barrelReleaseAnim = dropper.barrelReleaseAnim; }
private void Start() { playerInventory = Inventory.GetPlayerInventory(); playerItemDropper = GameObject.FindGameObjectWithTag("Player").GetComponent <ItemDropper>(); playerEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <Equipment>(); }
private void Awake() { playerInventory = GetComponent <GameDevTV.Inventories.Inventory>(); itemDropper = GetComponent <ItemDropper>(); }
protected override void OnStart() { _sound = gameObject.GetComponentInChildren <OlympusAudioPlayer>(); _itemDropper = (ItemDropper)gameObject.GetComponentInChildren <ItemDropper>(); }
private void Awake() { _inventory = GetComponent <Inventory>(); _itemDropper = GetComponent <ItemDropper>(); }
public TreeManager(ChunkDecorator decorator) { if (decorator.worldGenSubtype != World.WorldGenSubtype.CENOTE) { //build leaves Texture2D leafTexOne = decorator.content.Load <Texture2D>("Blocks/Variety/" + decorator.rand.Next(50)); Texture2D leafTexTwo = decorator.content.Load <Texture2D>("Blocks/Variety/" + decorator.rand.Next(50)); leaves = new TileType(new TileTag[] { TagReferencer.AIR, TagReferencer.Harvest, }, leafTexOne, false); leaves.harvestTicks = 5 + getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1)); leaves2 = new TileType(new TileTag[] { TagReferencer.AIR, TagReferencer.Harvest, }, leafTexTwo, false); leaves2.harvestTicks = 5 + getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1)); //build trunks generateTreeTrunk(decorator, out trunk, out treeTop); generateTreeTrunk(decorator, out trunk2, out treeTop2); decorator.foliage.AddRange(generateTrees(decorator, trunk, treeTop, leaves)); decorator.foliageBiome2.AddRange(generateTrees(decorator, trunk2, treeTop2, leaves2)); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_LEAVES_0.TILEID, leaves); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_LEAVES_1.TILEID, leaves2); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_TRUNK_0.TILEID, trunk); TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_TRUNK_1.TILEID, trunk2); ItemDropper dropSticks = new ItemDropper(); dropSticks.registerNewDrop(new Item_Stick(0), null, 1, .1f); dropSticks.registerNewDrop(new Item_Stick(0), new Item_Axe(1), 1, .2f); if (decorator.metaDifficulty == 0) { dropSticks.registerNewDrop(new Item_Stick(0), null, 1, .4f); dropSticks.registerNewDrop(new Item_Stick(0), new Item_Axe(1), 1, .4f); } HarvestDictionary.registerNewHarvestWithGhost(trunk, new ItemDropper[] { dropSticks }); HarvestDictionary.registerNewHarvestWithGhost(trunk2, new ItemDropper[] { dropSticks }); } else { decorator.foliage.Add(new Decoration(new Point(0, -6), new TileType[, ] { { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER } })); decorator.foliage.Add(new Decoration(new Point(0, -9), new TileType[, ] { { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER } })); decorator.foliage.Add(new Decoration(new Point(0, 6), new TileType[, ] { { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER } })); decorator.foliage.Add(new Decoration(new Point(0, 9), new TileType[, ] { { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER } })); for (int i = 0; i < 3; i++) { decorator.foliage.Add(new Decoration(new Point(0, 2), new TileType[, ] { { TileTypeReferencer.STALAGMITE_TOP, TileTypeReferencer.STALAGMITE_MIDDLE, TileTypeReferencer.STALAGMITE_BOTTOM } })); decorator.foliageBiome2.Add(new Decoration(new Point(0, 2), new TileType[, ] { { TileTypeReferencer.STALAGMITE_TOP, TileTypeReferencer.STALAGMITE_MIDDLE, TileTypeReferencer.STALAGMITE_BOTTOM } })); } } }
private void Awake() { inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>(); itemDropper = GameObject.FindGameObjectWithTag("Player").GetComponent <ItemDropper>(); }