protected override void draw_images(Game_Unit unit) { Window_Img.team = unit.team; // Name set_name(unit); // HP Hp_Gauge.set_val(unit.actor.hp, unit.actor.maxhp); Exp_Gauge.set_val(unit.actor.exp, unit.actor.level, !(unit.is_active_player_team && unit.actor.can_level())); //Multi }
protected override void draw_images(Game_Unit unit) { Window_Img.team = unit.team; // Face Face.set_actor(unit.actor); if (!unit.actor.generic_face) { Face.mirrored = unit.has_flipped_face_sprite; } // Name set_name(unit); // HP Hp_Gauge.set_val(unit.actor.hp, unit.actor.maxhp); }
protected override void draw_images(Game_Unit unit) { Window_Img.team = unit.team; var selected_unit = Global.game_map.get_selected_unit(); var player_unit = selected_unit; bool player_selected = true; // Swap units if the selected unit is on an enemy team if (player_unit != null && !player_unit.is_player_allied) { Game_Unit temp = unit; unit = player_unit; player_unit = temp; player_selected = false; } Item.flash = false; TargetItem.flash = false; // Name set_name(unit); Name.offset = new Vector2(Name.text_width / 2, 0); //Debug Weapon_Triangle_Arrow.ResetWeaponTriangle(WTA1, WTA2); Item.texture = null; var unitWeapon = unit.actor.weapon; if (!player_selected && unit.is_on_siege()) { unitWeapon = unit.items[Siege_Engine.SiegeInventoryIndex].to_weapon; } if (unitWeapon != null) { string filename = string.Format(@"Graphics/Icons/{0}", unitWeapon.Image_Name); if (Global.content_exists(filename)) { Item.texture = Global.Content.Load <Texture2D>(filename); } Item.index = unitWeapon.Image_Index; } var playerUnitWeapon = player_unit.actor.weapon; if (player_selected && player_unit.is_on_siege()) { playerUnitWeapon = player_unit.items[Siege_Engine.SiegeInventoryIndex].to_weapon; } var selectedUnitWeapon = player_selected ? playerUnitWeapon : unitWeapon; // HP if (player_unit == null || player_unit == unit || selectedUnitWeapon == null || selectedUnitWeapon.is_staff()) { Window_Width = 56; Window_Img.set_width(Window_Width); target_info_visible(false); Hp_Gauge.set_val(unit.actor.hp, unit.actor.maxhp); } else { Window_Width = 56 + 72; Window_Img.set_width(Window_Width); target_info_visible(true); TargetName.text = player_unit.actor.name; TargetName.offset = new Vector2(TargetName.text_width / 2, 0); //Debug //TargetName.offset = new Vector2(24, 0); TargetItem.texture = null; if (playerUnitWeapon != null) { string filename = string.Format(@"Graphics/Icons/{0}", playerUnitWeapon.Image_Name); if (Global.content_exists(filename)) { TargetItem.texture = Global.Content.Load <Texture2D>(filename); } TargetItem.index = playerUnitWeapon.Image_Index; } // Player unit has no weapon if (playerUnitWeapon == null || playerUnitWeapon.is_staff()) { (Hp_Gauge as Unit_Info_Hp_Gauge_Damage).set_val( unit.actor.hp, unit.actor.maxhp); } else { int distance = playerUnitWeapon != null ? playerUnitWeapon.Min_Range : 1; var stats = new CombatStats(player_unit.id, unit.id, itemIndex: player_selected && player_unit.is_on_siege() ? Siege_Engine.SiegeInventoryIndex : -1, distance: distance) { location_bonuses = CombatLocationBonuses.NoAttackerBonus }; (Hp_Gauge as Unit_Info_Hp_Gauge_Damage).set_val( unit.actor.hp, unit.actor.maxhp, stats.inverse_rounds_to_kill()); Weapon_Triangle_Arrow.SetWeaponTriangle( WTA2, player_unit, unit, playerUnitWeapon, unitWeapon, distance); if (playerUnitWeapon.effective_multiplier(player_unit, unit) > 1) { TargetItem.flash = true; } } // Target has no weapon if (unitWeapon == null || unitWeapon.is_staff()) { TargetHpGauge.set_val(unit.actor.hp, unit.actor.maxhp); } else { int distance = unitWeapon != null ? unitWeapon.Min_Range : 1; var target_stats = new CombatStats(unit.id, player_unit.id, itemIndex: !player_selected && unit.is_on_siege() ? Siege_Engine.SiegeInventoryIndex : -1, distance: distance) { location_bonuses = CombatLocationBonuses.NoDefenderBonus }; TargetHpGauge.set_val( player_unit.actor.hp, player_unit.actor.maxhp, target_stats.inverse_rounds_to_kill()); Weapon_Triangle_Arrow.SetWeaponTriangle( WTA1, unit, player_unit, unitWeapon, playerUnitWeapon, distance); if (unitWeapon.effective_multiplier(unit, player_unit) > 1) { Item.flash = true; } } } }