public void PickUpLoot( Loot loot ) { if ( loot.type == Loot.Type.coin ) { coins += loot.count; } else if ( loot.type == Loot.Type.crystal ) { crystals += loot.count; } if ( OnChangeResources != null ) { OnChangeResources(); } }
public void LootTest() { Character chr = kernel.Get<Character>(); chr.Initialize( "Name", 10, Vector3.zero, null ); Loot crystalsLoot = new Loot( Loot.Type.crystal, 3 ); Loot coinsLoot = new Loot( Loot.Type.coin, 7 ); chr.model.PickUpLoot( crystalsLoot ); chr.model.PickUpLoot( coinsLoot ); Assert.AreEqual( 3, chr.model.crystals ); Assert.AreEqual( 7, chr.model.coins ); }