Skip to content
Permalink
Browse files

Item - add Output method

  • Loading branch information...
bobbymcr committed Dec 15, 2018
1 parent 908cfef commit 1727d6bb30f9c3cc910c1c4d4835ef0c47d28d06
Showing with 10 additions and 5 deletions.
  1. +5 −0 core/src/Item.cs
  2. +2 −2 sample/src/Coin.cs
  3. +3 −3 sample/src/Table.cs
@@ -43,5 +43,10 @@ protected virtual bool DropCore(MessageBus bus)
{
return true;
}

protected void Output(MessageBus bus, string text)
{
bus.Send(new OutputMessage(text));
}
}
}
@@ -39,11 +39,11 @@ private void Read(MessageBus bus)
{
if (this.taken)
{
bus.Send(new OutputMessage("The inscription reads: \"MCMXCIX\""));
this.Output(bus, "The inscription reads: \"MCMXCIX\"");
}
else
{
bus.Send(new OutputMessage("The writing is too small. You'd have to pick it up to see it better."));
this.Output(bus, "The writing is too small. You'd have to pick it up to see it better.");
}
}
}
@@ -21,7 +21,7 @@ public Table(Room parent)

protected override bool TakeCore(MessageBus bus)
{
bus.Send(new OutputMessage("It is too heavy."));
this.Output(bus, "It is too heavy.");
return false;
}

@@ -41,12 +41,12 @@ private void Move(MessageBus bus)
if (!this.tableMoved)
{
this.tableMoved = true;
bus.Send(new OutputMessage("You move the table slightly. Underneath you see a coin."));
this.Output(bus, "You move the table slightly. Underneath you see a coin.");
this.parent.Add(Noun.Coin, new Coin());
}
else
{
bus.Send(new OutputMessage("Someone has already moved it."));
this.Output(bus, "Someone has already moved it.");
}
}
}

0 comments on commit 1727d6b

Please sign in to comment.
You can’t perform that action at this time.