public Level() { ResetData(); //Cell startingCell = GetRandomEmptyCell(); Texture2D tex = null; TileHelper.GetTileTexture(3863, ref tex); Global.Player = new Player() { X = 10, Y = 10, Sprite = tex, Damage = Dice.Parse("2d4"), }; Global.Player.Info.ArmorClass = 15; Global.Player.Info.AttackBonus = 1; Global.Player.Info.Health = 50; Global.Player.Info.Name = "Player"; //Global.Player = _player; //_level.Init(_player); //Global.CombatManager = new CombatManager(Global.Player, GetNpcs()); }
public MagicAttack(Figure caster, int textureID, int damage, int tx, int ty, int range = 6, float speed = 0.25f) { _caster = caster; //_xi = 1; //_yi = 0;// 0; _targetX = caster.X; _targetY = caster.Y; TileHelper.GetTileTexture(textureID, ref _fire); _damage = damage; _speed = speed; _range = range; }
public void AddObjectAt(int x, int y, int objType) { Cell cell = (Cell)_map.GetCell(x, y); _map.SetCellProperties(x, y, false, false, true, cell.CellType); TileInfo tileInfo = null; TileHelper.GetTile(objType, ref tileInfo); LevelObject obj = new LevelObject(); obj.Parameter = tileInfo._parameter; obj.Script = tileInfo._script; obj.X = x; obj.Y = y; _objects[x, y] = obj; obj.SpriteType = objType; }
public void AddItemAt(int x, int y, int type) { Cell cell = (Cell)_map.GetCell(x, y); _map.SetCellProperties(x, y, true, true, true, cell.CellType); PickupItem item = new PickupItem(); TileInfo tileInfo = null; TileHelper.GetTile(type, ref tileInfo); item.Name = tileInfo._name; item.Description = tileInfo._description; item.UseOnPickup = tileInfo._useOnInteract; item.Parameter = tileInfo._parameter; item.Script = tileInfo._script; item.X = x; item.Y = y; _items[x, y] = item; item.SpriteType = type; }
public void Load() { //Global.CombatManager = new CombatManager(Global.Player, GetNpcs()); //return; Stream s = File.Open("level.dat", FileMode.Open); BinaryFormatter b = new BinaryFormatter(); var cellInfos = (List <CellInfo>)b.Deserialize(s); _doors = (Door[, ])b.Deserialize(s); _items = (PickupItem[, ])b.Deserialize(s); _objects = (LevelObject[, ])b.Deserialize(s); DialogueHelper.DialogueItems = (Dictionary <int, DialogueNode>)b.Deserialize(s); //DialogueHelper.DialogueItems.Clear(); DialogueHelper.Dialogues = (List <string>)b.Deserialize(s); DialogueHelper.DialogueLookup = (Dictionary <string, int>)(b.Deserialize(s)); _map = new Map(Global.MapWidth, Global.MapHeight); foreach (var cellInfo in cellInfos) { Cell cell = cellInfo.GetCell(); AddTile(cell); } var npcs = (List <FigureInfo>)b.Deserialize(s); foreach (var info in npcs) { var npc = NpcCreator.CreateNpc(info, this, info.X, info.Y); Texture2D tex = null; TileHelper.GetTileTexture(npc.Info.TextureID, ref tex); npc.DialogueRoot = info.DialogueRoot; npc.Sprite = tex; AddNpc(npc); } s.Close(); Global.CombatManager = new CombatManager(Global.Player, GetNpcs()); }
public static Npc CreateNpc(FigureInfo info, Level level, int x, int y) { Npc npc = null; //Level level = LevelManager.GetCurrentLevel(); //if (info.IsEnemy) { Texture2D tex = null; TileHelper.GetTileTexture(0, ref tex); var pathFromAggressiveEnemy = new PathToPlayer(Global.Player, level.Map, tex); pathFromAggressiveEnemy.CreateFrom(x, y); npc = new Npc(level.Map, level, pathFromAggressiveEnemy) { X = x, Y = y, Sprite = UIState._selectedTexture, Damage = Dice.Parse("d3"), }; npc.Info = info; if (npc.Info.IsMerchant) { npc.Info.Inventory = new List <int>(); npc.Info.Inventory.Add(2569); npc.Info.Inventory.Add(2569); npc.Info.Inventory.Add(2569); } //level.AddNpc(npc); } //else //{ //} return(npc); }