Task <string> IRoomGrain.GetPrintableInfo() { StringBuilder sb = new StringBuilder(); sb.Append("Key:"); sb.Append(GrainHelper.GetPrimaryKeyStringFromGrain(this)); sb.Append(":ID:"); sb.Append(this.State.roomId); sb.Append(":Name:"); sb.Append(this.State.name); return(Task.FromResult(sb.ToString())); }
Task <string> ICharacterGrain.GetPrintableInfo() { StringBuilder sb = new StringBuilder(); sb.Append("Key:"); sb.Append(GrainHelper.GetPrimaryKeyStringFromGrain(this)); //sb.Append(this.GetPrimaryKey().ToString()); sb.Append(":ID:"); sb.Append(this.State.monsterInfo.Id); sb.Append(":Name:"); sb.Append(this.State.monsterInfo.Name); sb.Append(":Moves:"); sb.Append(this.State.monsterInfo.MovesRandomly); return(Task.FromResult(sb.ToString())); }
Task <string> IMonsterGrain.Kill(IRoomGrain room) { if (this.State.roomGrain != null) { string roomGrainPrimaryKey = GrainHelper.GetPrimaryKeyStringFromGrain(State.roomGrain); string roomPrimaryKey = GrainHelper.GetPrimaryKeyStringFromGrain(room); if (roomGrainPrimaryKey != roomPrimaryKey) { return(Task.FromResult(this.State.monsterInfo.Name + " snuck away. You were too slow!")); } if (mMoveTimer != null) { mMoveTimer.Dispose(); } return(this.State.roomGrain.Exit(this).ContinueWith(t => this.State.monsterInfo.Name + " is dead.")); } return(Task.FromResult(this.State.monsterInfo.Name + " is already dead. You were too slow and someone else got to him!")); }