private async Task MakeMonster(MonsterInfo data, IPlayerGrain player) { //var monsterGrain = MonsterGrainFactory.GetGrain(data.Id); //var monsterGrain = MonsterGrainFactory.GetGrain(Guid.NewGuid()); var monsterGrain = GrainFactory.GetGrain<IMonsterGrain>(player.GetPrimaryKey().ToString() + "Monster" + data.Id); //var room = await player.GetRandomRoom(); await monsterGrain.SetInfo(data, player); IRoomGrain room = GrainFactory.GetGrain<IRoomGrain>(player.GetPrimaryKey().ToString() + "Room" + data.StartIn); await monsterGrain.SetRoomGrain(room); await monsterGrain.SetPlayerGuid(await player.GetPlayerGuid()); await player.AddMonster(monsterGrain); }
public override void SetAll(System.Collections.Generic.IDictionary<string,object> values) { object value; if (values == null) { InitStateFields(); return; } if (values.TryGetValue("roomGrain", out value)) roomGrain = (IRoomGrain) value; if (values.TryGetValue("playerGuid", out value)) playerGuid = (Guid) value; if (values.TryGetValue("playerGrain", out value)) playerGrain = (IPlayerGrain) value; if (values.TryGetValue("monsterInfo", out value)) monsterInfo = (MonsterInfo) value; }
private void InitStateFields() { this.roomGrain = default(IRoomGrain); this.playerGuid = default(Guid); this.playerGrain = default(IPlayerGrain); this.monsterInfo = new MonsterInfo(); }
public static object Deserializer(System.Type expected, global::Orleans.Serialization.BinaryTokenStreamReader stream) { AdventureTerreInterfaces.Models.MonsterInfo result = new AdventureTerreInterfaces.Models.MonsterInfo(); result.Descriptors = ((List<Descriptor>)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(List<Descriptor>), stream))); result.Id = ((Int64)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(Int64), stream))); result.Key = ((Guid)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(Guid), stream))); result.KilledBy = ((List<Int64>)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(List<Int64>), stream))); result.MovesRandomly = ((Boolean)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(Boolean), stream))); result.Name = ((String)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(String), stream))); result.Responses = ((List<Descriptor>)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(List<Descriptor>), stream))); result.StartIn = ((Int64)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(Int64), stream))); return result; }