protected Monster(int awareness, int minAttack, int maxAttack, int minDefence, int maxDefence, int gold, int health, int maxHealth, int speed, RLColor color, char symbol, int x, int y) : base(null, awareness, minAttack, maxAttack, minDefence, maxDefence, gold, health, maxHealth, speed, color, symbol, x, y) { }
protected CharacterDto(string name, int awareness, int minAttack, int maxAttack, int minDefence, int maxDefence, int gold, int health, int maxHealth, int speed, RLColor color, char symbol, int x, int y) { this.Name = name; this.Awareness = awareness; this.MinAttack = minAttack; this.MaxAttack = maxAttack; this.MinDefence = minDefence; this.MaxDefence = maxDefence; this.Gold = gold; this.Health = health; this.MaxHealth = maxHealth; this.Speed = speed; this.Color = color; this.Symbol = symbol; this.X = x; this.Y = y; this.Steps = 0; }
public Theme(RLColor _primary_color, RLColor _secondary_color, RLColor _text_color, RLColor _hover_color) { color_primary = _primary_color; color_secondary = _secondary_color; color_text = _text_color; color_hover = _hover_color; }
public Object(char symbol, int x, int y, RLColor color) { Symbols = new int[] { symbol }; X = x; Y = y; Color = color; }
public Star(string name, string type, RLColor color) { this.Name = name; this.Type = type; this.Color = color; distanceFromParent = 1f; }
public GameObject(int x, int y, RLColor col, char shape) { this.x = x; this.y = y; this.col = col; this.shape = shape; }
private static void UpdateColoredText(object state) { if (i < 16 && goingForward == true) { i++; } else if (i == 16) { goingForward = false; } if (i > 0 && goingForward == false) { i--; } else if (i == 0) { goingForward = true; } float G = ((float)i * 8) / 255; float B = ((float)i * 8) / 255; IntroColor = new RLColor(1, G, B); }
public Planet(string name, PlanetType type, RLColor color, IBody parent, float distanceFromParent = 0f) { this.Name = name; this.PlanetType = type; this.Color = color; this.Parent = parent; this.distanceFromParent = distanceFromParent; }
public VisibleCell(int x, int y, Character character, RLColor color, int layer) { Character = character; Color = color; X = x; Y = y; Layer = layer; }
public AbstractEntity CreateDoorMapSquare(int x, int y, RLColor colour) { AbstractEntity e = new AbstractEntity("Door"); e.AddComponent(new PositionComponent(e, this.map_data, x, y, false, true)); e.AddComponent(new GraphicComponent('D', RLColor.Black, colour, 'D', 0)); e.AddComponent(new MapsquareData(true, false)); this.ecs.entities.Add(e); return(e); }
//-------------------------------------------------------------- //-------------------------------------------------------------- public static Colour ToColor(this RLColor color) { //Colour col = new Colour(); //col.SetRed(color.r); //col.SetGreen(color.g); //col.SetBlue(color.b); //col.SetAlpha(color.a); return(new Colour(color.r, color.g, color.b, color.a)); }
public Creature(char s, Vector pos, RLColor c) { this.symbol = s; this.position = pos; this.color = c; this.Init(); CreaturesContainer.Add(this); }
public Button(string[] values, Point topLeftCorner, Point bottomRightCorner, RLColor color, RLColor hoverColor) { Values = values; _topLeftCorner = topLeftCorner; _bottomRightCorner = bottomRightCorner; _color = color; _hoverColor = hoverColor; eventArgs = EventArgs.Empty; IsDisabled = false; }
public void Draw(RLConsole console, IMap map) { if (!map.IsExplored(X, Y)) { console.Set(X, Y, Color, Colors.FloorBackgroundFov, Symbol); } else { console.Set(X, Y, RLColor.Blend(Color, RLColor.Gray, 0.5f), Colors.FloorBackground, Symbol); } }
//-------------------------------------------------------------- //-------------------------------------------------------------- public static Colour ToColor(this RLColor color) { Colour col = new Colour(); col.SetRed(color.r); col.SetGreen(color.g); col.SetBlue(color.b); col.SetAlpha(color.a); return(col); }
public void Add(string message, RLColor color) { _lines.Enqueue(message); _color.Enqueue(color); // When exceeding the maximum number of lines remove the oldest one. if (_lines.Count > _maxLines && _color.Count > _maxLines) { _lines.Dequeue(); _color.Dequeue(); } }
protected BaseConsole(int width, int height, int left, int top, RLColor backColor, BackConsole backConsole) { _height = height; _width = width; _left = left; _top = top; _backConsole = backConsole; _backColor = backColor; _console = new RLConsole(_width, _height); _console.SetBackColor(0, 0, _width, _height, backColor); }
const int _ARRAYLENGTH = 100; // TODO: Put this into a config file somewhere. public TextConsole(int width, int height, int left, int top, RLColor backColor, BackConsole backConsole) : base(width, height, left, top, backColor, backConsole) { _textWidth = _console.Width - 2; // 1 on each side _textHeight = _console.Height - 4; // 3 at the top, 1 at the bottom. _currentIndex = 0; _outputText = new string[_ARRAYLENGTH]; for (var i = 0; i < _outputText.Length; i++) { _outputText[i] = ""; } }
//-------------------------------------------------------------- //-------------------------------------------------------------- public static void DrawTexture(Texture2D texture, Matrix3 transform, Colour color) { Vector2 xAxis = new Vector2(); xAxis.x = transform.m1; xAxis.y = transform.m2; Vector2 yAxis = new Vector2(); yAxis.x = transform.m4; yAxis.y = transform.m5; //Note - the angle of a unit circle count up when they go anticlockwise, //but because in Raylib land positive Y is down, a positive angle will //be clockwise. float angle = (float)Math.Atan2(xAxis.y, xAxis.x); float scaleX = xAxis.Magnitude(); float scaleY = yAxis.Magnitude(); //The portion of the image to render Rectangle source = new Rectangle(); source.width = texture.width; source.height = texture.height; //Origin to rotate around RLVector2 origin = new RLVector2(); origin.x = texture.width * 0.5f; origin.y = texture.height * 0.5f; //The target position and size to render at Rectangle destination = new Rectangle(); destination.x = transform.m7; destination.y = transform.m8; destination.width = source.width * scaleX; destination.height = source.height * scaleY; //We multiply the angle by 180/pi because the matrix library for the project //works in radians (that's what the unit tests require) but RayLib expects degrees. float degrees = angle * 180.0f / (float)Math.PI; //Convert our color class to a raylib colour RLColor rlColor = new RLColor(color.GetRed(), color.GetGreen(), color.GetBlue(), color.GetAlpha()); //Draw texture DrawTexturePro(texture, source, destination, origin, degrees, rlColor); }
private void DrawAbility(IAbility ability, RLConsole inventoryConsole, int position) { char letter = 'Q'; if (position == 0) { letter = 'Q'; } else if (position == 1) { letter = 'W'; } else if (position == 2) { letter = 'E'; } else if (position == 3) { letter = 'R'; } RLColor highlightTextColor = Swatch.DbOldStone; if (!(ability is DoNothing)) { if (ability.TurnsUntilRefreshed == 0) { highlightTextColor = Swatch.DbLight; } else { highlightTextColor = Swatch.DbSkin; } } int xPosition = 28; int xHighlightPosition = 28 + 4; int yPosition = 3 + (position * 2); inventoryConsole.Print(xPosition, yPosition, $"{letter} - {ability.Name}", highlightTextColor); if (ability.TurnsToRefresh > 0) { int width = Convert.ToInt32(((double)ability.TurnsUntilRefreshed / (double)ability.TurnsToRefresh) * 16.0); int remainingWidth = 20 - width; inventoryConsole.SetBackColor(xHighlightPosition, yPosition, width, 1, Swatch.DbOldBlood); inventoryConsole.SetBackColor(xHighlightPosition + width, yPosition, remainingWidth, 1, RLColor.Black); } }
/// <summary> /// Get the rarity color of an item. /// THIS WILL SOMETIMES OVERRIDE THE CURRENT ITEMS COLOR IN SOME TEXT OUTPUT /// </summary> /// <returns></returns> public RLColor GetRarityColor() { switch (rarity) { case Rarity.Junk: rarityColor = RLColor.Gray; break; case Rarity.Common: rarityColor = RLColor.White; break; case Rarity.Rare: rarityColor = RLColor.Yellow; break; case Rarity.Legendary: rarityColor = RLColor.LightCyan; break; case Rarity.Epic: rarityColor = RLColor.Magenta; break; } return(this.rarityColor); }
public void Draw(RLConsole console, IMap map) { if ((!map.IsExplored(X, Y))) { return; } if (map.IsInFov(X, Y)) { console.Set(X, Y, Color, Colors.FloorBackgroundFov, Symbol); } //if the door has not been found else { console.Set(X, Y, RLColor.Blend(Color, RLColor.Gray, 0.5f), Colors.FloorBackground, Symbol); } }
private static RLColor ApplyTargetingColor(TargetingStatus cellTargeting, RLColor backColor, bool isInFov) { if (isInFov) { if (cellTargeting.HasFlag(TargetingStatus.Targeted)) { return(RLColor.Red); } if (cellTargeting.HasFlag(TargetingStatus.Targetable)) { return(RLColor.LightRed); } } return(backColor); }
/// <summary> /// Constructs a new instance of a player. /// </summary> /// <param name="damage">Base Damage</param> /// <param name="ac">Base AC</param> /// <param name="xp">Experience Points</param> /// <param name="speed">Base Speed</param> /// <param name="health">Health</param> /// <param name="mana">Mana</param> /// <param name="firedmg">Fire Damage</param> /// <param name="icedmg">Ice Damage</param> /// <param name="ltngdmg">Lightning Damage</param> /// <param name="holydmg">Holy Damage</param> /// <param name="deathdmg">Death Damage</param> /// <param name="fireres">Fire Resistance</param> /// <param name="iceres">Ice Resistance</param> /// <param name="litres">Lightning Resistance</param> /// <param name="holyres">Holy Resistance</param> /// <param name="deathres">Death Resistance</param> /// <param name="swrdsmanship">Swordsmanship</param> /// <param name="magicskill">Magic Skill</param> /// <param name="small">Small Weapons Skill</param> /// <param name="sneak">Sneak Skill</param> /// <param name="steal">Steal Skill</param> /// <param name="block">Block Skill</param> /// <param name="lck">Luck</param> /// <param name="classtype">Class Type</param> /// <param name="color">Console Color</param> /// <param name="baseWeapon">Starting Weapon</param> /// <param name="baseArmour">Starting Armour</param> /// <param name="name">Player Name</param> public Player(int damage, int ac, int xp, int speed, int health, int mana, int firedmg, int icedmg, int ltngdmg, int holydmg, int deathdmg, int fireres, int iceres, int litres, int holyres, int deathres, int swrdsmanship, int magicskill, int small, int sneak, int steal, int block, int lck, ClassTypes classtype, RLColor color, Weapons baseWeapon, Armours baseArmour, string name) { this.damage = damage; this.armourClass = ac; this.xp = xp; this.speed = speed; this.health = health; this.mana = mana; this.fireDamage = firedmg; this.iceDamage = icedmg; this.lightningDamage = ltngdmg; this.holyDamage = holydmg; this.deathDamage = deathdmg; this.fireResistance = fireres; this.iceResistance = iceres; this.lightningResistace = litres; this.holyResistance = holyres; this.deathResistance = deathres; this.swordsmanship = swrdsmanship; this.smallWeaponsSkills = small; this.magicSkill = magicskill; this.sneakingSkill = sneak; this.stealingSkill = steal; this.blockingSkill = block; this.luck = lck; this.classType = classtype; this.color = color; this.player = true; this.weapons = baseWeapon; this.armours = baseArmour; inventory = new Inventory(); inventory.AddItem(weapons); inventory.AddItem(armours); this.name = name; this.symbol = '@'; Symbol = '@'; Awareness = 15; }
public Tile(Tile oldTile, GraphicsItem symbol, RLColor fg, RLColor bg, bool?walkable = null, bool?transparent = null, int?food = null, int?production = null, int?movementRequired = null, Resource?resource = null) { X = oldTile.X; Y = oldTile.Y; Walkable = walkable ?? oldTile.Walkable; Transparent = transparent ?? oldTile.Transparent; Food = food ?? oldTile.Food; Production = production ?? oldTile.Production; MovementRequired = movementRequired ?? oldTile.MovementRequired; Resource = resource ?? oldTile.Resource; Symbol = symbol; ForegroundColor = fg; BackgroundColor = bg; WasUpdated = true; }
public Tile(int x, int y, bool walkable, bool transparent, int food, int production, int movementRequired, Resource?resource, GraphicsItem symbol, RLColor fg, RLColor bg, ICell cell) { X = x; Y = y; Walkable = walkable; Transparent = transparent; Food = food; Production = production; MovementRequired = movementRequired; Resource = resource; ForegroundColor = fg; BackgroundColor = bg; Symbol = symbol; Cell = cell; }
public override void Draw(RLConsole console, IMap map) { if (!map.GetCell(X, Y).IsExplored) { return; } double distance = Game.DistanceBetween(Game.Player.X, Game.Player.Y, X, Y); float blendRatio = .5f / Game.Player.Awareness; float blendAmount = (float)(blendRatio * distance); if (map.IsInFov(X, Y)) { console.Set(X, Y, RLColor.Blend(Colors.LowLevelFloorFov, Colors.LowLevelFloor, .5f - blendAmount), null, Symbol); } else { console.Set(X, Y, Colors.LowLevelFloor, null, Symbol); } }
public void Generate() { StreamReader sr = new StreamReader(new FileStream("Genesis.txt", FileMode.Open, FileAccess.Read)); //read everyline while (!sr.EndOfStream) { Logs.Add(sr.ReadLine()); } scrollX = width - 3; scrollY = height - (subjectY - 1); int cutoffLength = width - (width - scrollX) - (2 * marginX); for (int i = 0; i < Logs.Count; i++) { string remaining = Logs[i]; RLColor currentColor = LoreColors.Colors[RandomNumberGenerator.Range(0, LoreColors.Colors.Length - 1)]; while (remaining.Length > cutoffLength) { //Console.WriteLine($"{remaining} {remaining.Length}"); DisplayLogs.Add(remaining.Substring(0, cutoffLength)); remaining = remaining.Substring(cutoffLength); ColorDisplay.Add(currentColor); } DisplayLogs.Add(remaining); ColorDisplay.Add(currentColor); DisplayLogs.Add(" "); ColorDisplay.Add(currentColor); } pageView = (height - 1) - subjectY - (2 * marginY); currentPageView = 0; maxPageView = DisplayLogs.Count - pageView; }
private static void rootConsole_Render(object sender, UpdateEventArgs e) { rootConsole.Clear(); map.ComputeFov(_playerX, _playerY, 50, true); foreach (var cell in map.GetAllCells()) { if (!cell.IsInFov) { map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true); switch (_map[cell.X, cell.Y]) { case Tile.Floor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.Gray); break; case Tile.RoomFloor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.White); break; case Tile.Wall: rootConsole.Print(cell.X, cell.Y, "#", RLColor.LightGray); break; case Tile.Door: rootConsole.Print(cell.X, cell.Y, "+", RLColor.Brown); break; } } else if (cell.IsExplored) { switch (_map[cell.X, cell.Y]) { case Tile.Floor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.Blend(RLColor.Gray, RLColor.Black)); break; case Tile.RoomFloor: rootConsole.Print(cell.X, cell.Y, ".", RLColor.Blend(RLColor.White, RLColor.Black)); break; case Tile.Wall: rootConsole.Print(cell.X, cell.Y, "#", RLColor.Blend(RLColor.LightGray, RLColor.Black)); break; case Tile.Door: rootConsole.Print(cell.X, cell.Y, "+", RLColor.Blend(RLColor.Brown, RLColor.Black)); break; } } } rootConsole.Print(_playerX, _playerY, "@", RLColor.LightGreen); rootConsole.Draw(); }
/// <summary> /// Sets rarity color of an item. /// </summary> /// <param name="rarityColor"></param> public void SetRarityColor(RLColor rarityColor) { this.rarityColor = rarityColor; }
public GlyphComponent (GameObject parent, char glyph, RLColor color, RLColor backGroundColor) : base (parent) { GlyphChar = glyph; Color = color; BackGroundColor = backGroundColor; }