Exemple #1
0
    protected override Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
    {
        switch (itemTypeString)
        {
        case "weapon":
            item = new Weapon(itemNameString, itemLocation);
            break;

        case "wood":
            item = new WoodItem(itemNameString, itemLocation);
            break;

        case "iron":
            item = new IronItem(itemNameString, itemLocation);
            break;

        default:
            break;
        }

        if (item == null)
        {
            item = base.CreateItem(itemTypeString, itemNameString, itemLocation, item);
        }
        return(item);
    }
Exemple #2
0
    private void HandleGatherInteraction(string[] commandWords, Person actor)
    {
        bool hasWeapon = false;
        bool hasArmor  = false;

        foreach (var item in actor.ListInventory())
        {
            if (item is Weapon)
            {
                hasWeapon = true;
            }

            if (item is Armor)
            {
                hasArmor = true;
            }
        }

        Location currentLocation = DetermineActorLocation(actor);

        if (hasWeapon && actor.Location.LocationType == LocationType.Forest)
        {
            Item gatheredItem = new WoodItem(commandWords[2], currentLocation);
            actor.AddToInventory(gatheredItem);
            this.AddToPerson(actor, gatheredItem);
        }

        if (hasArmor && actor.Location.LocationType == LocationType.Mine)
        {
            Item gatheredItem = new IronItem(commandWords[2], currentLocation);
            actor.AddToInventory(gatheredItem);
            this.AddToPerson(actor, gatheredItem);
        }
    }
Exemple #3
0
        public IWoodProduct CreateProduct(WoodItem woodItem)
        {
            IWoodProduct woodProduct = null;

            switch (woodItem)
            {
            case WoodItem.CricketBat:
                woodProduct = new CricketBat();
                break;

            case WoodItem.HockeyStick:
                woodProduct = new HockeyStick();
                break;
            }

            return(woodProduct);
        }
Exemple #4
0
    // Use this for initialization
    new void Start()
    {
        base.Start();
        displayName = "Tree";

        lootTables = new Item[1][];
        lootTables[0] = new Item[3];

        lootTables[0][0] = new WoodItem(2);
        lootTables[0][1] = new WoodItem(3);
        lootTables[0][2] = new WoodItem(4);

        lootFrequencyTables = new int[1][];
        lootFrequencyTables[0] = new int[3];

        lootFrequencyTables[0][0] = 20;
        lootFrequencyTables[0][1] = 60;
        lootFrequencyTables[0][2] = 20;

        numberOfItemsDropped = new int[1];
        numberOfItemsDropped[0] = 1;
    }
Exemple #5
0
        private void OnWoodCreated(TableViewModel sender, Wood e)
        {
            var model = new WoodItem(this, e);

            Items.Add(model.ConvertToModel());
        }
Exemple #6
0
 public WoodItem(WoodItem other)
     : base(other)
 {
 }
Exemple #7
0
    private void HandleGatherInteraction(string[] commandWords, Person actor)
    {
        bool hasWeapon = false;
        bool hasArmor = false;

        foreach (var item in actor.ListInventory())
        {
            if (item is Weapon)
            {
                hasWeapon = true;
            }

            if (item is Armor)
            {
                hasArmor = true;
            }
        }

        Location currentLocation = DetermineActorLocation(actor);

        if (hasWeapon && actor.Location.LocationType == LocationType.Forest)
        {
            Item gatheredItem = new WoodItem(commandWords[2], currentLocation);
            actor.AddToInventory(gatheredItem);
            this.AddToPerson(actor, gatheredItem);
        }

        if (hasArmor && actor.Location.LocationType == LocationType.Mine)
        {
            Item gatheredItem = new IronItem(commandWords[2], currentLocation);
            actor.AddToInventory(gatheredItem);
            this.AddToPerson(actor, gatheredItem);
        }
    }
Exemple #8
0
    protected override Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
    {
        switch (itemTypeString)
        {
            case "weapon":
                item = new Weapon(itemNameString, itemLocation);
                break;
            case "wood":
                item = new WoodItem(itemNameString, itemLocation);
                break;
            case "iron":
                item = new IronItem(itemNameString, itemLocation);
                break;
            default:
                break;
        }

        if (item == null)
        {
            item = base.CreateItem(itemTypeString, itemNameString, itemLocation, item);
        }
        return item;
    }