Exemplo n.º 1
0
        async Task <string> Go(string direction)
        {
            IRoomGrain destination = await this.State.roomGrain.ExitTo(direction, this.State.gameState);

            StringBuilder description = new StringBuilder();

            if (destination != null)
            {
                await this.State.roomGrain.Exit(this);

                await destination.Enter(this);

                this.State.roomGrain = destination;
                var desc = await destination.Description(State.myInfo, this.State.gameState);

                if (desc != null)
                {
                    description.Append(desc);
                }
            }
            else
            {
                description.Append("You cannot go in that direction.");
            }
            await State.WriteStateAsync();

            return(description.ToString());
        }
Exemplo n.º 2
0
        async Task <string> Go(string direction)
        {
            IRoomGrain destination = await this.roomGrain.ExitTo(direction);

            StringBuilder description = new StringBuilder();

            if (destination != null)
            {
                await this.roomGrain.Exit(myInfo);

                await destination.Enter(myInfo);

                this.roomGrain = destination;
                var desc = await destination.Description(myInfo);

                if (desc != null)
                {
                    description.Append(desc);
                }
            }
            else
            {
                description.Append("You cannot go in that direction.");
            }

            if (things.Count > 0)
            {
                description.AppendLine("You are holding the following items:");
                foreach (var thing in things)
                {
                    description.AppendLine(thing.Name);
                }
            }

            return(description.ToString());
        }