public Entity FromBlocInstance(ScenarioTag.BlocInstance bloc) { var entity = BlocFactory.FromTag(this.Map, this.Map.Scenario, bloc); bloc.GameObject = entity; return(entity); }
public World(int width, int height, ContentManager Content) { this.width = width / scale; this.height = height / scale; IEnumerable <int> myRandomList = GenerateRandom(); myMap = new Bloc[this.width, this.height]; for (int i = 0; i < this.width; i++) { for (int j = 0; j < this.height; j++) { if (j < myRandomList.ElementAt <int>(i)) { myMap[i, j] = BlocFactory.Create(enumIDBloc.DIRT, Content, this); } else if (j == myRandomList.ElementAt <int>(i)) { myMap[i, j] = BlocFactory.Create(enumIDBloc.GRASS, Content, this); } else { myMap[i, j] = BlocFactory.Create(enumIDBloc.NONE, Content, this); } myMap[i, j].PositionRect = new Rectangle(i * scale, (this.height - 1 - j) * scale, scale, scale); } } myHero = new Hero(this, Content.Load <Texture2D>("hero"), 0, 0); }
//MonoBehaviour public void Awake() { _instance = this; }