public Item(CubeWorld.World.CubeWorld world, ItemDefinition itemDefinition, int objectId) : base(objectId) { this.world = world; this.definition = itemDefinition; this.itemDefinition = itemDefinition; }
public override void TileHit(TilePosition tilePosition, ItemDefinition itemDefinition) { //base.TileHit(tilePosition, item); client.AddAction( new MultiplayerAction(MultiplayerAction.Action.TILE_HIT, new String[] { itemDefinition.id, tilePosition.x.ToString(), tilePosition.y.ToString(), tilePosition.z.ToString() })); }
public Item CreateItem(ItemDefinition itemDefinition, int objectId, Vector3 position, bool dispatchWorldListener) { Item item; if (itemDefinition.type == CubeWorld.World.Objects.CWDefinition.DefinitionType.ItemTile) item = new ItemTile(world, (ItemTileDefinition) itemDefinition, objectId); else item = new Item(world, itemDefinition, objectId); item.position = position; item.AddComponent(new ItemComponentGravity()); item.AddComponent(new ItemComponentGoToPlayer()); item.AddComponent(new ItemComponentAutoDestroy()); items.Add(item); if (dispatchWorldListener) world.cwListener.CreateObject(item); return item; }
public TileRuleCreateItem(TilePosition delta, ItemDefinition itemDefinition, TileRuleCondition condition) : base(condition) { this.delta = delta; this.itemDefinition = itemDefinition; }
public virtual Item CreateItem(ItemDefinition itemDefinition, Vector3 position) { return world.itemManager.CreateItem(itemDefinition, NextObjectId(), position, true); }
public virtual void TileHit(TilePosition tilePosition, ItemDefinition itemDefinition) { if (itemDefinition.damage > 0) world.gameplay.DamageTile(tilePosition, itemDefinition.damage); if (itemDefinition.setOnFire) if (world.tileManager.GetTileBurns(tilePosition)) world.tileManager.SetTileOnFire(tilePosition, true); }
public override Item CreateItem(ItemDefinition itemDefinition, Vector3 position) { //TODO: Serialize item creation! return baseGameplay.CreateItem(itemDefinition, position); }
public override void TileHit(TilePosition tilePosition, ItemDefinition itemDefinition) { baseGameplay.TileHit(tilePosition, itemDefinition); }
private ItemDefinition ParseItemDefinition(XmlElement itemDefinitionXML) { ItemDefinition item = new ItemDefinition(); item.id = GetAttributeStringValue(itemDefinitionXML, "id"); item.description = GetAttributeStringValue(itemDefinitionXML, "description"); item.visualDefinition = ParseVisualDefinition(itemDefinitionXML); item.energy = GetAttributeIntValue(itemDefinitionXML, "energy", 0); item.durability = GetAttributeIntValue(itemDefinitionXML, "durability", 0); item.damage = GetAttributeIntValue(itemDefinitionXML, "damage", 0); item.setOnFire = GetAttributeBoolValue(itemDefinitionXML, "setOnFire", false); return item; }
public void Create(ItemDefinition[] itemDefinitions) { this.itemDefinitions = itemDefinitions; }