private void _ToGame(GamePlayerRecord record, Realm.Map map) { var player = EntityProvider.Create(record.Entity); var itemProvider = new ItemProvider(); var itemAxe = itemProvider.MakeItem("Axe1", 0.5f); var itemSword1 = itemProvider.MakeItem("Sword1", 0.5f); var itemSword2 = itemProvider.MakeItem("Sword2", 0.5f); var itemShield1 = itemProvider.MakeItem("Shield1", 0.5f); player.Bag.Add(itemAxe); player.Bag.Add(itemSword1); player.Bag.Add(itemSword2); player.Bag.Add(itemShield1); foreach (var item in record.Items) { player.Bag.Add(item); } var stage = new GameStage(this._Binder, map.Finder, map.Gate, player); stage.ExitEvent += () => { }; stage.TransmitEvent += _ToRealm; _Machine.Push(stage); }
private Aboriginal _Create(Map map, ENTITY type, ItemProvider item_provider) { var entiry = EntityProvider.Create(type); var items = item_provider.FromStolen(); foreach (var item in items) { entiry.Bag.Add(item); } var wisdom = new StandardBehavior(entiry); var aboriginal = new Aboriginal(map, this, entiry, wisdom); return(aboriginal); }
private IEnumerable <IUpdatable> _CreateFromGroup(string id, float degree, Vector2 center) { var layout = Resource.Instance.FindEntityGroupLayout(id); var buildInfos = (from e in layout.Entitys let radians = degree * (float)System.Math.PI / 180f let position = Polygon.RotatePoint(e.Position, new Vector2(), radians) select new EntityCreateParameter { Id = e.Id, Entity = EntityProvider.Create(e.Type, position + center, e.Direction + degree) }).ToArray(); foreach (var updatable in _CreateChests(layout.Chests, buildInfos)) { yield return(updatable); } foreach (var updatable in _CreateEnterances(layout.Enterances, buildInfos)) { yield return(updatable); } foreach (var updatable in _CreateStrongholds(layout.Strongholds, buildInfos)) { yield return(updatable); } foreach (var updatable in _CreateFields(layout.Fields, buildInfos)) { yield return(updatable); } foreach (var updatable in _CreateProtals(layout.Protals, buildInfos)) { yield return(updatable); } var inorganics = new List <Entity>(); inorganics.AddRange(_CreateResources(layout.Resources, buildInfos)); inorganics.AddRange(_CreateStatic(layout.Statics, buildInfos)); inorganics.AddRange(_CreateWall(layout.Walls, buildInfos)); yield return(new InorganicsWisdom(inorganics, _Gate)); }