AI combat, misc AI improvements, characters can't get stuck inside doors
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -60,6 +60,7 @@
|
|||||||
<Compile Include="Source\Characters\AICharacter.cs" />
|
<Compile Include="Source\Characters\AICharacter.cs" />
|
||||||
<Compile Include="Source\Characters\AI\AIController.cs" />
|
<Compile Include="Source\Characters\AI\AIController.cs" />
|
||||||
<Compile Include="Source\Characters\AI\AITarget.cs" />
|
<Compile Include="Source\Characters\AI\AITarget.cs" />
|
||||||
|
<Compile Include="Source\Characters\AI\Objectives\AIObjectiveCombat.cs" />
|
||||||
<Compile Include="Source\Characters\AI\Objectives\AIObjectiveContainItem.cs" />
|
<Compile Include="Source\Characters\AI\Objectives\AIObjectiveContainItem.cs" />
|
||||||
<Compile Include="Source\Characters\AI\Order.cs" />
|
<Compile Include="Source\Characters\AI\Order.cs" />
|
||||||
<Compile Include="Source\Characters\AI\CrewCommander.cs" />
|
<Compile Include="Source\Characters\AI\CrewCommander.cs" />
|
||||||
@@ -1124,9 +1125,9 @@
|
|||||||
<Project>{49ba1c69-6104-41ac-a5d8-b54fa9f696e8}</Project>
|
<Project>{49ba1c69-6104-41ac-a5d8-b54fa9f696e8}</Project>
|
||||||
<Name>Lidgren.Network</Name>
|
<Name>Lidgren.Network</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Subsurface_content\Subsurface_content\Subsurface_content.csproj">
|
<ProjectReference Include="..\Subsurface_content\Subsurface_content\Barotrauma_content.csproj">
|
||||||
<Project>{1e6bf44d-6e31-40cc-8321-3d5958c983e7}</Project>
|
<Project>{1e6bf44d-6e31-40cc-8321-3d5958c983e7}</Project>
|
||||||
<Name>Subsurface_content</Name>
|
<Name>Barotrauma_content</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
<Item
|
<Item
|
||||||
name="Harpoon Gun"
|
name="Harpoon Gun"
|
||||||
pickdistance="200"
|
pickdistance="200"
|
||||||
price="500">
|
price="500"
|
||||||
|
tags="weapon">
|
||||||
|
|
||||||
<Sprite texture="weapons.png" sourcerect="0,25,98,25" depth="0.5"/>
|
<Sprite texture="weapons.png" sourcerect="0,25,98,25" depth="0.5"/>
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
name="Stun Grenade"
|
name="Stun Grenade"
|
||||||
pickdistance="200"
|
pickdistance="200"
|
||||||
price="200"
|
price="200"
|
||||||
tags="smallitem">
|
tags="smallitem,weapon">
|
||||||
|
|
||||||
<Sprite texture="weapons.png" sourcerect="98,0,11,24"/>
|
<Sprite texture="weapons.png" sourcerect="98,0,11,24"/>
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@
|
|||||||
|
|
||||||
<Item
|
<Item
|
||||||
name="Stun Baton"
|
name="Stun Baton"
|
||||||
Tags="smallitem"
|
Tags="smallitem,weapon"
|
||||||
pickdistance="150"
|
pickdistance="150"
|
||||||
price="100">
|
price="100">
|
||||||
|
|
||||||
|
|||||||
@@ -48,36 +48,54 @@ namespace Barotrauma
|
|||||||
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.3f);
|
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.3f);
|
||||||
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
|
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
|
||||||
|
|
||||||
UpdateCharacters();
|
//UpdateCharacters();
|
||||||
|
|
||||||
int x = 0, y = 150;
|
int buttonWidth = 130;
|
||||||
foreach (Order order in Order.PrefabList)
|
int spacing = 10;
|
||||||
|
|
||||||
|
int y = 250;
|
||||||
|
|
||||||
|
for (int n = 0; n<2; n++)
|
||||||
{
|
{
|
||||||
if (order.ItemComponentType!=null)
|
|
||||||
|
List<Order> orders = (n==0) ?
|
||||||
|
Order.PrefabList.FindAll(o => o.ItemComponentType == null) :
|
||||||
|
Order.PrefabList.FindAll(o=> o.ItemComponentType!=null);
|
||||||
|
|
||||||
|
int startX = (int)-(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2;
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
foreach (Order order in orders)
|
||||||
{
|
{
|
||||||
var matchingItems = Item.ItemList.FindAll(i => i.components.Find(ic => ic.GetType() == order.ItemComponentType) != null);
|
int x = startX + (buttonWidth + spacing) * (i % orders.Count);
|
||||||
int y2 = y;
|
|
||||||
foreach (Item it in matchingItems)
|
if (order.ItemComponentType!=null)
|
||||||
{
|
{
|
||||||
var newOrder = new Order(order, it.components.Find(ic => ic.GetType() == order.ItemComponentType));
|
var matchingItems = Item.ItemList.FindAll(it => it.components.Find(ic => ic.GetType() == order.ItemComponentType) != null);
|
||||||
|
int y2 = y;
|
||||||
|
foreach (Item it in matchingItems)
|
||||||
|
{
|
||||||
|
var newOrder = new Order(order, it.components.Find(ic => ic.GetType() == order.ItemComponentType));
|
||||||
|
|
||||||
var button = new GUIButton(new Rectangle(x, y2, 150, 20), order.Name, GUI.Style, frame);
|
var button = new GUIButton(new Rectangle(x+buttonWidth/2, y2, buttonWidth, 20), order.Name, Alignment.TopCenter, GUI.Style, frame);
|
||||||
button.UserData = newOrder;
|
button.UserData = newOrder;
|
||||||
button.OnClicked = SetOrder;
|
button.OnClicked = SetOrder;
|
||||||
y2 += 25;
|
y2 += 25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
var button = new GUIButton(new Rectangle(x + buttonWidth / 2, y, buttonWidth, 20), order.Name, Alignment.TopCenter, GUI.Style, frame);
|
||||||
var button = new GUIButton(new Rectangle(x, y, 150, 20), order.Name, GUI.Style, frame);
|
button.UserData = order;
|
||||||
button.UserData = order;
|
button.OnClicked = SetOrder;
|
||||||
button.OnClicked = SetOrder;
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
y += 80;
|
||||||
|
|
||||||
x += 160;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateCharacters()
|
public void UpdateCharacters()
|
||||||
@@ -97,12 +115,30 @@ namespace Barotrauma
|
|||||||
frame.RemoveChild(child);
|
frame.RemoveChild(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = 0, y = 0;
|
List<Character> aliveCharacters = crewManager.characters.FindAll(c => !c.IsDead);
|
||||||
foreach (Character character in crewManager.characters)
|
|
||||||
{
|
int charactersPerRow = 4;
|
||||||
if (character.IsDead) continue;
|
|
||||||
|
int spacing = 5;
|
||||||
|
|
||||||
|
|
||||||
|
int rows = (int)Math.Ceiling((double)aliveCharacters.Count / charactersPerRow);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach (Character character in aliveCharacters)
|
||||||
|
{
|
||||||
|
int rowCharacterCount = Math.Min(charactersPerRow, aliveCharacters.Count);
|
||||||
|
if (aliveCharacters.Count - i < charactersPerRow-1) rowCharacterCount = aliveCharacters.Count % charactersPerRow;
|
||||||
|
|
||||||
|
// rowCharacterCount = Math.Min(rowCharacterCount, aliveCharacters.Count - i);
|
||||||
|
int startX = (int)-(150 * rowCharacterCount + spacing * (rowCharacterCount - 1)) / 2;
|
||||||
|
|
||||||
|
|
||||||
|
int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count));
|
||||||
|
int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow));
|
||||||
|
|
||||||
|
GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", Color.Black, Alignment.TopCenter, null, frame);
|
||||||
|
|
||||||
GUIButton characterButton = new GUIButton(new Rectangle(x, y, 150, 40), "", Color.Transparent, null, frame);
|
|
||||||
characterButton.UserData = character;
|
characterButton.UserData = character;
|
||||||
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
|
|
||||||
@@ -113,8 +149,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
characterButton.Color = Color.Black * 0.5f;
|
||||||
characterButton.HoverColor = Color.LightGray * 0.5f;
|
characterButton.HoverColor = Color.LightGray * 0.5f;
|
||||||
characterButton.SelectedColor = Color.Gold * 0.5f;
|
characterButton.SelectedColor = Color.Gold * 0.5f;
|
||||||
|
characterButton.OutlineColor = Color.LightGray * 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
string name = character.Info.Name.Replace(' ', '\n');
|
string name = character.Info.Name.Replace(' ', '\n');
|
||||||
@@ -130,7 +168,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, characterButton);
|
new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, characterButton);
|
||||||
|
|
||||||
x += 160;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ namespace Barotrauma
|
|||||||
//how far the NPC can hear targets from (0.0 = deaf, 1.0 = hears every target within soundRange)
|
//how far the NPC can hear targets from (0.0 = deaf, 1.0 = hears every target within soundRange)
|
||||||
private float hearing;
|
private float hearing;
|
||||||
|
|
||||||
|
public AITarget SelectedAiTarget
|
||||||
|
{
|
||||||
|
get { return selectedAiTarget; }
|
||||||
|
}
|
||||||
|
|
||||||
public EnemyAIController(Character c, string file) : base(c)
|
public EnemyAIController(Character c, string file) : base(c)
|
||||||
{
|
{
|
||||||
targetMemories = new Dictionary<AITarget, AITargetMemory>();
|
targetMemories = new Dictionary<AITarget, AITargetMemory>();
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
Character.ClearInputs();
|
||||||
|
|
||||||
steeringManager = Character.AnimController.CurrentHull == null ? outdoorsSteeringManager : indoorsSteeringManager;
|
steeringManager = Character.AnimController.CurrentHull == null ? outdoorsSteeringManager : indoorsSteeringManager;
|
||||||
|
|
||||||
if (updateObjectiveTimer>0.0f)
|
if (updateObjectiveTimer>0.0f)
|
||||||
@@ -46,14 +48,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
objectiveManager.DoCurrentObjective(deltaTime);
|
objectiveManager.DoCurrentObjective(deltaTime);
|
||||||
|
|
||||||
//if (Character.Controlled != null)
|
|
||||||
//{
|
|
||||||
// steeringManager.SteeringSeek(Character.Controlled.Position);
|
|
||||||
//}
|
|
||||||
|
|
||||||
Character.AnimController.IgnorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X));
|
Character.AnimController.IgnorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X));
|
||||||
|
|
||||||
if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater)
|
if (Character.IsKeyDown(InputType.Aim))
|
||||||
|
{
|
||||||
|
Character.AnimController.TargetDir = Character.CursorPosition.X > Character.Position.X ? Direction.Right : Direction.Left;
|
||||||
|
}
|
||||||
|
else if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater)
|
||||||
{
|
{
|
||||||
Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left;
|
Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left;
|
||||||
}
|
}
|
||||||
@@ -64,6 +65,14 @@ namespace Barotrauma
|
|||||||
steeringManager.Update(moveSpeed);
|
steeringManager.Update(moveSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnAttacked(IDamageable attacker, float amount)
|
||||||
|
{
|
||||||
|
var enemy = attacker as Character;
|
||||||
|
if (enemy == null) return;
|
||||||
|
|
||||||
|
objectiveManager.AddObjective(new AIObjectiveCombat(Character, enemy));
|
||||||
|
}
|
||||||
|
|
||||||
public void SetOrder(Order order, string option)
|
public void SetOrder(Order order, string option)
|
||||||
{
|
{
|
||||||
objectiveManager.SetOrder(order, option);
|
objectiveManager.SetOrder(order, option);
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Barotrauma
|
||||||
|
{
|
||||||
|
class AIObjectiveCombat : AIObjective
|
||||||
|
{
|
||||||
|
const float CoolDown = 10.0f;
|
||||||
|
|
||||||
|
private Character enemy;
|
||||||
|
|
||||||
|
private AIObjectiveFindSafety escapeObjective;
|
||||||
|
|
||||||
|
float coolDownTimer;
|
||||||
|
|
||||||
|
private readonly float enemyStrength;
|
||||||
|
|
||||||
|
public AIObjectiveCombat (Character character, Character enemy)
|
||||||
|
: base(character, "")
|
||||||
|
{
|
||||||
|
this.enemy = enemy;
|
||||||
|
|
||||||
|
foreach (Limb limb in enemy.AnimController.Limbs)
|
||||||
|
{
|
||||||
|
if (limb.attack == null) continue;
|
||||||
|
enemyStrength += limb.attack.GetDamage(1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
coolDownTimer = CoolDown;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Act(float deltaTime)
|
||||||
|
{
|
||||||
|
coolDownTimer -= deltaTime;
|
||||||
|
|
||||||
|
var weapon = character.Inventory.FindItem("weapon");
|
||||||
|
|
||||||
|
if (weapon==null)
|
||||||
|
{
|
||||||
|
Escape(deltaTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!character.SelectedItems.Contains(weapon))
|
||||||
|
{
|
||||||
|
character.Inventory.TryPutItem(weapon, 3, false);
|
||||||
|
weapon.Equip(character);
|
||||||
|
}
|
||||||
|
character.CursorPosition = enemy.Position;
|
||||||
|
character.SetInput(InputType.Aim, false, true);
|
||||||
|
|
||||||
|
Vector2 enemyDiff = Vector2.Normalize(enemy.Position - character.Position);
|
||||||
|
float weaponAngle = ((weapon.body.Dir == 1.0f) ? weapon.body.Rotation : weapon.body.Rotation - MathHelper.Pi);
|
||||||
|
Vector2 weaponDir = new Vector2((float)Math.Cos(weaponAngle), (float)Math.Sin(weaponAngle));
|
||||||
|
|
||||||
|
if (Vector2.Dot(enemyDiff, weaponDir)<0.9f) return;
|
||||||
|
|
||||||
|
List<FarseerPhysics.Dynamics.Body> ignoredBodies = new List<FarseerPhysics.Dynamics.Body>();
|
||||||
|
foreach (Limb limb in character.AnimController.Limbs)
|
||||||
|
{
|
||||||
|
ignoredBodies.Add(limb.body.FarseerBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pickedBody = Submarine.PickBody(character.SimPosition, enemy.SimPosition, ignoredBodies);
|
||||||
|
if (pickedBody != null && pickedBody.UserData as Limb == null) return;
|
||||||
|
|
||||||
|
weapon.Use(deltaTime, character);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Escape(float deltaTime)
|
||||||
|
{
|
||||||
|
if (escapeObjective == null)
|
||||||
|
{
|
||||||
|
escapeObjective = new AIObjectiveFindSafety(character);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemy.AnimController.CurrentHull == character.AnimController.CurrentHull)
|
||||||
|
{
|
||||||
|
escapeObjective.OverrideCurrentHullSafety = 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
escapeObjective.OverrideCurrentHullSafety = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
escapeObjective.TryComplete(deltaTime);
|
||||||
|
|
||||||
|
if (Vector2.Distance(character.SimPosition, enemy.SimPosition) < 3.0f)
|
||||||
|
{
|
||||||
|
character.AIController.SteeringManager.SteeringManual(deltaTime, character.SimPosition - enemy.SimPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coolDownTimer = CoolDown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsCompleted()
|
||||||
|
{
|
||||||
|
return enemy.IsDead || coolDownTimer <= 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float GetPriority(Character character)
|
||||||
|
{
|
||||||
|
//clamp the strength to the health of this character
|
||||||
|
//(it doesn't make a difference whether the enemy does 200 or 600 damage, it's one hit kill anyway)
|
||||||
|
|
||||||
|
float enemyDanger = Math.Min(enemyStrength, character.Health) + enemy.Health / 10.0f;
|
||||||
|
|
||||||
|
EnemyAIController enemyAI = enemy.AIController as EnemyAIController;
|
||||||
|
if (enemyAI != null)
|
||||||
|
{
|
||||||
|
if (enemyAI.SelectedAiTarget == character.AiTarget) enemyDanger *= 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.Max(enemyDanger, 30.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsDuplicate(AIObjective otherObjective)
|
||||||
|
{
|
||||||
|
AIObjectiveCombat objective = otherObjective as AIObjectiveCombat;
|
||||||
|
if (objective == null) return false;
|
||||||
|
|
||||||
|
return objective.enemy == enemy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
bool isCompleted;
|
bool isCompleted;
|
||||||
|
|
||||||
|
public bool IgnoreAlreadyContainedItems;
|
||||||
|
|
||||||
public AIObjectiveContainItem(Character character, string itemName, ItemContainer container)
|
public AIObjectiveContainItem(Character character, string itemName, ItemContainer container)
|
||||||
: base (character, "")
|
: base (character, "")
|
||||||
@@ -47,14 +48,16 @@ namespace Barotrauma
|
|||||||
var itemToContain = character.Inventory.FindItem(itemName);
|
var itemToContain = character.Inventory.FindItem(itemName);
|
||||||
if (itemToContain == null)
|
if (itemToContain == null)
|
||||||
{
|
{
|
||||||
AddSubObjective(new AIObjectiveGetItem(character, itemName));
|
var getItem = new AIObjectiveGetItem(character, itemName);
|
||||||
|
getItem.IgnoreContainedItems = IgnoreAlreadyContainedItems;
|
||||||
|
AddSubObjective(getItem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Vector2.Distance(character.SimPosition, container.Item.SimPosition) > container.Item.PickDistance
|
if (Vector2.Distance(character.SimPosition, container.Item.SimPosition) > container.Item.PickDistance
|
||||||
|| !container.Item.IsInsideTrigger(character.Position))
|
&& !container.Item.IsInsideTrigger(character.Position))
|
||||||
{
|
{
|
||||||
AddSubObjective(new AIObjectiveGoTo(container.Item.SimPosition, character));
|
AddSubObjective(new AIObjectiveGoTo(container.Item, character));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +68,9 @@ namespace Barotrauma
|
|||||||
public override bool IsDuplicate(AIObjective otherObjective)
|
public override bool IsDuplicate(AIObjective otherObjective)
|
||||||
{
|
{
|
||||||
AIObjectiveContainItem objective = otherObjective as AIObjectiveContainItem;
|
AIObjectiveContainItem objective = otherObjective as AIObjectiveContainItem;
|
||||||
return (objective != null);
|
if (objective == null) return false;
|
||||||
|
|
||||||
|
return objective.itemName == itemName && objective.container == container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,15 @@ namespace Barotrauma
|
|||||||
const float SearchHullInterval = 3.0f;
|
const float SearchHullInterval = 3.0f;
|
||||||
const float MinSafety = 50.0f;
|
const float MinSafety = 50.0f;
|
||||||
|
|
||||||
AIObjectiveGoTo gotoObjective;
|
private AIObjectiveGoTo goToObjective;
|
||||||
|
|
||||||
private List<Hull> unreachable;
|
private List<Hull> unreachable;
|
||||||
|
|
||||||
float currenthullSafety;
|
private float currenthullSafety;
|
||||||
|
|
||||||
float searchHullTimer;
|
private float searchHullTimer;
|
||||||
|
|
||||||
|
public float? OverrideCurrentHullSafety;
|
||||||
|
|
||||||
public AIObjectiveFindSafety(Character character)
|
public AIObjectiveFindSafety(Character character)
|
||||||
: base(character, "")
|
: base(character, "")
|
||||||
@@ -27,20 +29,24 @@ namespace Barotrauma
|
|||||||
|
|
||||||
protected override void Act(float deltaTime)
|
protected override void Act(float deltaTime)
|
||||||
{
|
{
|
||||||
if (character.AnimController.CurrentHull == null || GetHullSafety(character.AnimController.CurrentHull) > MinSafety)
|
|
||||||
|
currenthullSafety = OverrideCurrentHullSafety == null ?
|
||||||
|
GetHullSafety(character.AnimController.CurrentHull) : (float)OverrideCurrentHullSafety;
|
||||||
|
|
||||||
|
if (character.AnimController.CurrentHull == null || currenthullSafety > MinSafety)
|
||||||
{
|
{
|
||||||
character.AIController.SteeringManager.SteeringSeek(character.AnimController.CurrentHull.SimPosition);
|
character.AIController.SteeringManager.SteeringSeek(character.AnimController.CurrentHull.SimPosition);
|
||||||
|
|
||||||
character.AIController.SelectTarget(null);
|
character.AIController.SelectTarget(null);
|
||||||
|
|
||||||
gotoObjective = null;
|
goToObjective = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchHullTimer>0.0f)
|
if (searchHullTimer>0.0f)
|
||||||
{
|
{
|
||||||
searchHullTimer -= deltaTime;
|
searchHullTimer -= deltaTime;
|
||||||
return;
|
//return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -67,37 +73,35 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (bestHull != null)
|
if (bestHull != null)
|
||||||
{
|
{
|
||||||
var path = pathSteering.PathFinder.FindPath(character.SimPosition, bestHull.SimPosition);
|
//var path = pathSteering.PathFinder.FindPath(character.SimPosition, bestHull.SimPosition);
|
||||||
if (pathSteering.CurrentPath != null && pathSteering.CurrentPath.Cost < path.Cost && !pathSteering.CurrentPath.Unreachable && gotoObjective!=null)
|
//if (pathSteering.CurrentPath == null || (pathSteering.CurrentPath.NextNode==null && pathSteering.CurrentPath.Cost > path.Cost) ||
|
||||||
{
|
// pathSteering.CurrentPath.Unreachable || goToObjective==null)
|
||||||
return;
|
//{
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pathSteering.SetPath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
gotoObjective = new AIObjectiveGoTo(bestHull, character);
|
//pathSteering.SetPath(path);
|
||||||
//character.AIController.SelectTarget(bestHull.AiTarget);
|
goToObjective = new AIObjectiveGoTo(bestHull, character);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//haracter.AIController.SelectTarget(bestHull.AiTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
searchHullTimer = SearchHullInterval;
|
searchHullTimer = SearchHullInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gotoObjective != null)
|
if (goToObjective != null)
|
||||||
{
|
{
|
||||||
var pathSteering = character.AIController.SteeringManager as IndoorsSteeringManager;
|
var pathSteering = character.AIController.SteeringManager as IndoorsSteeringManager;
|
||||||
if (pathSteering!=null && pathSteering.CurrentPath!= null &&
|
if (pathSteering!=null && pathSteering.CurrentPath!= null &&
|
||||||
pathSteering.CurrentPath.Unreachable && !unreachable.Contains(gotoObjective.Target))
|
pathSteering.CurrentPath.Unreachable && !unreachable.Contains(goToObjective.Target))
|
||||||
{
|
{
|
||||||
unreachable.Add(gotoObjective.Target as Hull);
|
unreachable.Add(goToObjective.Target as Hull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
goToObjective.TryComplete(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gotoObjective.TryComplete(deltaTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsDuplicate(AIObjective otherObjective)
|
public override bool IsDuplicate(AIObjective otherObjective)
|
||||||
@@ -125,7 +129,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float safety = 100.0f - fireAmount;
|
float safety = 100.0f - fireAmount;
|
||||||
if (waterPercentage > 30.0f) safety -= waterPercentage;
|
if (waterPercentage > 30.0f) safety -= waterPercentage;
|
||||||
if (hull.OxygenPercentage < 30.0f) safety -= (30.0f-hull.OxygenPercentage)*3.0f;
|
if (hull.OxygenPercentage < 30.0f) safety -= (30.0f-hull.OxygenPercentage)*5.0f;
|
||||||
|
|
||||||
return safety;
|
return safety;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool canBeCompleted;
|
private bool canBeCompleted;
|
||||||
|
|
||||||
|
public bool IgnoreContainedItems;
|
||||||
|
|
||||||
public override bool CanBeCompleted
|
public override bool CanBeCompleted
|
||||||
{
|
{
|
||||||
get { return canBeCompleted; }
|
get { return canBeCompleted; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AIObjectiveGetItem(Character character, string itemName)
|
public AIObjectiveGetItem(Character character, string itemName)
|
||||||
: base (character, "")
|
: base (character, "")
|
||||||
{
|
{
|
||||||
@@ -39,7 +42,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
targetItem.Pick(character, false, true);
|
targetItem.Pick(character, false, true);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currSearchIndex >= Item.ItemList.Count)
|
if (currSearchIndex >= Item.ItemList.Count)
|
||||||
@@ -48,19 +50,22 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Item.ItemList[currSearchIndex].HasTag(itemName) || Item.ItemList[currSearchIndex].Name == itemName)
|
currSearchIndex++;
|
||||||
|
|
||||||
|
if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) return;
|
||||||
|
if (IgnoreContainedItems && Item.ItemList[currSearchIndex].container != null) return;
|
||||||
|
|
||||||
|
targetItem = Item.ItemList[currSearchIndex];
|
||||||
|
|
||||||
|
Item moveToTarget = targetItem;
|
||||||
|
while (moveToTarget.container != null)
|
||||||
{
|
{
|
||||||
targetItem = Item.ItemList[currSearchIndex];
|
moveToTarget = moveToTarget.container;
|
||||||
|
|
||||||
while (targetItem.container != null)
|
|
||||||
{
|
|
||||||
targetItem = targetItem.container;
|
|
||||||
}
|
|
||||||
|
|
||||||
subObjectives.Add(new AIObjectiveGoTo(targetItem.Position, character));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currSearchIndex++;
|
subObjectives.Add(new AIObjectiveGoTo(moveToTarget, character));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsDuplicate(AIObjective otherObjective)
|
public override bool IsDuplicate(AIObjective otherObjective)
|
||||||
|
|||||||
@@ -35,14 +35,15 @@ namespace Barotrauma
|
|||||||
: base (character, "")
|
: base (character, "")
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.repeat = false;
|
this.repeat = repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AIObjectiveGoTo(Vector2 targetPos, Character character)
|
public AIObjectiveGoTo(Vector2 simPos, Character character, bool repeat = false)
|
||||||
: base(character, "")
|
: base(character, "")
|
||||||
{
|
{
|
||||||
this.targetPos = targetPos;
|
this.targetPos = simPos;
|
||||||
|
this.repeat = repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Act(float deltaTime)
|
protected override void Act(float deltaTime)
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class AIObjectiveIdle : AIObjective
|
class AIObjectiveIdle : AIObjective
|
||||||
{
|
{
|
||||||
|
const float WallAvoidDistance = 150.0f;
|
||||||
|
|
||||||
AITarget currentTarget;
|
AITarget currentTarget;
|
||||||
private float newTargetTimer;
|
private float newTargetTimer;
|
||||||
|
|
||||||
@@ -33,40 +35,30 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
currentTarget = FindRandomTarget();
|
currentTarget = FindRandomTarget();
|
||||||
|
|
||||||
if (currentTarget!=null)
|
if (currentTarget != null)
|
||||||
{
|
{
|
||||||
var path = pathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition);
|
var path = pathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition);
|
||||||
if (path.Cost > 200.0f)
|
if (path.Cost > 200.0f) return;
|
||||||
{
|
|
||||||
return;
|
pathSteering.SetPath(path);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pathSteering.SetPath(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
newTargetTimer = currentTarget == null ? 5.0f : 10.0f;
|
newTargetTimer = currentTarget == null ? 5.0f : 10.0f;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
newTargetTimer -= deltaTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (currentTarget == null) return;
|
|
||||||
|
|
||||||
|
newTargetTimer -= deltaTime;
|
||||||
|
|
||||||
//wander randomly if reached the end of the path or the target is unreachable
|
//wander randomly if reached the end of the path or the target is unreachable
|
||||||
if (pathSteering!=null && pathSteering.CurrentPath != null &&
|
if (pathSteering==null || (pathSteering.CurrentPath != null &&
|
||||||
(pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable))
|
(pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable)))
|
||||||
{
|
{
|
||||||
if (character.Position.X < character.AnimController.CurrentHull.Rect.X + 200.0f)
|
//steer away from edges of the hull
|
||||||
|
if (character.Position.X < character.AnimController.CurrentHull.Rect.X + WallAvoidDistance)
|
||||||
{
|
{
|
||||||
pathSteering.SteeringManual(deltaTime, Vector2.UnitX);
|
pathSteering.SteeringManual(deltaTime, Vector2.UnitX);
|
||||||
}
|
}
|
||||||
else if (character.Position.X > character.AnimController.CurrentHull.Rect.Right - 200.0f)
|
else if (character.Position.X > character.AnimController.CurrentHull.Rect.Right - WallAvoidDistance)
|
||||||
{
|
{
|
||||||
pathSteering.SteeringManual(deltaTime, -Vector2.UnitX);
|
pathSteering.SteeringManual(deltaTime, -Vector2.UnitX);
|
||||||
}
|
}
|
||||||
@@ -75,8 +67,8 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentTarget == null) return;
|
||||||
character.AIController.SteeringManager.SteeringSeek(currentTarget.SimPosition);
|
character.AIController.SteeringManager.SteeringSeek(currentTarget.SimPosition);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AITarget FindRandomTarget()
|
private AITarget FindRandomTarget()
|
||||||
@@ -111,7 +103,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override bool IsDuplicate(AIObjective otherObjective)
|
public override bool IsDuplicate(AIObjective otherObjective)
|
||||||
{
|
{
|
||||||
return true;
|
return (otherObjective as AIObjectiveIdle != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ namespace Barotrauma
|
|||||||
case "follow":
|
case "follow":
|
||||||
currentOrder = new AIObjectiveGoTo(Character.Controlled, character, true);
|
currentOrder = new AIObjectiveGoTo(Character.Controlled, character, true);
|
||||||
break;
|
break;
|
||||||
|
case "wait":
|
||||||
|
currentOrder = new AIObjectiveGoTo(character.SimPosition, character, true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (order.TargetItem == null) return;
|
if (order.TargetItem == null) return;
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
PrefabList.Add(new Order("Follow", "Following"));
|
PrefabList.Add(new Order("Follow", "Following"));
|
||||||
|
|
||||||
|
PrefabList.Add(new Order("Dismiss", "Dismissed"));
|
||||||
|
|
||||||
|
PrefabList.Add(new Order("Wait", "Wait"));
|
||||||
|
|
||||||
PrefabList.Add(new Order("Operate Reactor", "Operating reactor", typeof(Reactor), new string[] {"Power up", "Shutdown"}));
|
PrefabList.Add(new Order("Operate Reactor", "Operating reactor", typeof(Reactor), new string[] {"Power up", "Shutdown"}));
|
||||||
PrefabList.Add(new Order("Operate Railgun", "Operating railgun", typeof(Turret), new string[] { "Fire at will", "Hold fire" }));
|
PrefabList.Add(new Order("Operate Railgun", "Operating railgun", typeof(Turret), new string[] { "Fire at will", "Hold fire" }));
|
||||||
|
|
||||||
|
|
||||||
PrefabList.Add(new Order("Dismiss", "Dismissed"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Order(string name, string doingText, Type itemComponentType, string[] parameters = null)
|
private Order(string name, string doingText, Type itemComponentType, string[] parameters = null)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void SteeringManual(float deltaTime, Vector2 velocity)
|
public void SteeringManual(float deltaTime, Vector2 velocity)
|
||||||
{
|
{
|
||||||
steering += velocity * deltaTime;
|
steering += velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update(float speed = 1.0f)
|
public virtual void Update(float speed = 1.0f)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Barotrauma
|
|||||||
public bool Unreachable
|
public bool Unreachable
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SteeringPath(bool unreachable = false)
|
public SteeringPath(bool unreachable = false)
|
||||||
|
|||||||
+12
-1
@@ -85,10 +85,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (canOpenDoors) CheckDoorsInPath();
|
if (canOpenDoors) CheckDoorsInPath();
|
||||||
|
|
||||||
currentPath.CheckProgress(host.SimPosition, character.AnimController.InWater ? 1.0f : 0.6f);
|
float allowedDistance = character.AnimController.InWater ? 1.0f : 0.6f;
|
||||||
|
if (currentPath.CurrentNode!=null && currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f) allowedDistance*=0.5f;
|
||||||
|
|
||||||
|
currentPath.CheckProgress(host.SimPosition, allowedDistance);
|
||||||
|
|
||||||
if (currentPath.CurrentNode == null) return Vector2.Zero;
|
if (currentPath.CurrentNode == null) return Vector2.Zero;
|
||||||
|
|
||||||
|
//if (currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f && character.AnimController.Stairs == null)
|
||||||
|
//{
|
||||||
|
// return currentPath.PrevNode.SimPosition - host.SimPosition;
|
||||||
|
//}
|
||||||
|
|
||||||
return currentPath.CurrentNode.SimPosition - host.SimPosition;
|
return currentPath.CurrentNode.SimPosition - host.SimPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +117,7 @@ namespace Barotrauma
|
|||||||
if (door.IsOpen != open)
|
if (door.IsOpen != open)
|
||||||
{
|
{
|
||||||
var buttons = door.Item.GetConnectedComponents<Controller>();
|
var buttons = door.Item.GetConnectedComponents<Controller>();
|
||||||
|
|
||||||
foreach (Controller controller in buttons)
|
foreach (Controller controller in buttons)
|
||||||
{
|
{
|
||||||
if (Vector2.Distance(controller.Item.SimPosition, character.SimPosition) > controller.Item.PickDistance * 2.0f) continue;
|
if (Vector2.Distance(controller.Item.SimPosition, character.SimPosition) > controller.Item.PickDistance * 2.0f) continue;
|
||||||
@@ -131,6 +140,8 @@ namespace Barotrauma
|
|||||||
if (!canOpenDoors) return null;
|
if (!canOpenDoors) return null;
|
||||||
|
|
||||||
var doorButtons = nextNode.Waypoint.ConnectedGap.ConnectedDoor.Item.GetConnectedComponents<Controller>();
|
var doorButtons = nextNode.Waypoint.ConnectedGap.ConnectedDoor.Item.GetConnectedComponents<Controller>();
|
||||||
|
if (!doorButtons.Any()) return null;
|
||||||
|
|
||||||
foreach (Controller button in doorButtons)
|
foreach (Controller button in doorButtons)
|
||||||
{
|
{
|
||||||
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
|
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
|
||||||
@@ -250,10 +250,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float shortestAngle = leg.Rotation - torso.Rotation;
|
float shortestAngle = leg.Rotation - torso.Rotation;
|
||||||
|
|
||||||
if (Math.Abs(shortestAngle)<2.5f) continue;
|
if (Math.Abs(shortestAngle)<2.4f) continue;
|
||||||
//leg = GetLimb((i == 0) ? LimbType.LeftLeg : LimbType.RightLeg);
|
|
||||||
leg.body.ApplyTorque(-shortestAngle*10.0f);
|
leg.body.ApplyTorque(-shortestAngle*10.0f);
|
||||||
|
|
||||||
|
leg = GetLimb((i == 0) ? LimbType.LeftThigh : LimbType.RightThigh);
|
||||||
|
leg.body.ApplyTorque(-shortestAngle * 5.0f);
|
||||||
|
|
||||||
// float torsoRot = MathHelper.WrapAngle(torso.Rotation);
|
// float torsoRot = MathHelper.WrapAngle(torso.Rotation);
|
||||||
// torsoRot = MathHelper.ToDegrees(torsoRot);
|
// torsoRot = MathHelper.ToDegrees(torsoRot);
|
||||||
|
|
||||||
|
|||||||
@@ -480,6 +480,13 @@ namespace Barotrauma
|
|||||||
return keys[(int)inputType].Held;
|
return keys[(int)inputType].Held;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetInput(InputType inputType, bool hit, bool held)
|
||||||
|
{
|
||||||
|
keys[(int)inputType].Hit = hit;
|
||||||
|
keys[(int)inputType].Held = held;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearInput(InputType inputType)
|
public void ClearInput(InputType inputType)
|
||||||
{
|
{
|
||||||
keys[(int)inputType].Hit = false;
|
keys[(int)inputType].Hit = false;
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
|
|
||||||
Hull.renderer = new WaterRenderer(GraphicsDevice);
|
Hull.renderer = new WaterRenderer(GraphicsDevice);
|
||||||
TitleScreen.LoadState = 1.0f;
|
TitleScreen.LoadState = 1.0f;
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
GUI.LoadContent(GraphicsDevice);
|
GUI.LoadContent(GraphicsDevice);
|
||||||
@@ -203,19 +203,25 @@ namespace Barotrauma
|
|||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
JobPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Jobs));
|
JobPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Jobs));
|
||||||
TitleScreen.LoadState = 15.0f;
|
|
||||||
yield return CoroutineStatus.Running;
|
|
||||||
|
|
||||||
StructurePrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Structure));
|
StructurePrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Structure));
|
||||||
TitleScreen.LoadState = 25.0f;
|
TitleScreen.LoadState = 20.0f;
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
ItemPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Item));
|
ItemPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Item));
|
||||||
TitleScreen.LoadState = 40.0f;
|
TitleScreen.LoadState = 30.0f;
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
Debug.WriteLine("sounds");
|
Debug.WriteLine("sounds");
|
||||||
CoroutineManager.StartCoroutine(SoundPlayer.Init());
|
CoroutineManager.StartCoroutine(SoundPlayer.Init());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (!SoundPlayer.Initialized)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
TitleScreen.LoadState = Math.Min((float)TitleScreen.LoadState + 40.0f/41, 70.0f);
|
||||||
|
yield return CoroutineStatus.Running;
|
||||||
|
}
|
||||||
|
|
||||||
TitleScreen.LoadState = 70.0f;
|
TitleScreen.LoadState = 70.0f;
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
@@ -244,10 +250,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
LocationType.Init("Content/Map/locationTypes.xml");
|
LocationType.Init("Content/Map/locationTypes.xml");
|
||||||
MainMenuScreen.Select();
|
MainMenuScreen.Select();
|
||||||
yield return CoroutineStatus.Running;
|
|
||||||
|
|
||||||
TitleScreen.LoadState = 100.0f;
|
TitleScreen.LoadState = 100.0f;
|
||||||
hasLoaded = true;
|
hasLoaded = true;
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,6 +245,43 @@ namespace Barotrauma.Items.Components
|
|||||||
LinkedGap.Open = openState;
|
LinkedGap.Open = openState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (openState > 0.0f && openState < 1.0f)
|
||||||
|
{
|
||||||
|
//push characters out of the doorway when the door is closing/opening
|
||||||
|
Vector2 simPos = ConvertUnits.ToSimUnits(new Vector2(item.Rect.X, item.Rect.Y));
|
||||||
|
Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(doorSprite.size.X,
|
||||||
|
item.Rect.Height * (1.0f - openState)));
|
||||||
|
|
||||||
|
foreach (Character c in Character.CharacterList)
|
||||||
|
{
|
||||||
|
int dir = Math.Sign(c.SimPosition.X - item.SimPosition.X);
|
||||||
|
foreach (Limb l in c.AnimController.Limbs)
|
||||||
|
{
|
||||||
|
if (l.SimPosition.Y > simPos.Y || l.SimPosition.Y < simPos.Y - simSize.Y) continue;
|
||||||
|
|
||||||
|
if (Math.Sign(l.SimPosition.X - item.SimPosition.X) != dir)
|
||||||
|
{
|
||||||
|
l.body.SetTransform(new Vector2(item.SimPosition.X + dir * simSize.X*1.2f, item.SimPosition.Y), l.body.Rotation);
|
||||||
|
SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, 1.0f, l.body.FarseerBody);
|
||||||
|
//c.AddDamage(item.SimPosition, DamageType.Blunt, 1.0f, 0.0f, 0.0f, true);
|
||||||
|
|
||||||
|
l.body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Math.Abs(l.SimPosition.X - item.SimPosition.X) > simSize.X*0.5f) continue;
|
||||||
|
|
||||||
|
|
||||||
|
l.body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -0.5f));
|
||||||
|
c.StartStun(0.2f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
body.Enabled = openState < 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
item.SendSignal((isOpen) ? "1" : "0", "state_out");
|
item.SendSignal((isOpen) ? "1" : "0", "state_out");
|
||||||
}
|
}
|
||||||
@@ -279,31 +316,6 @@ namespace Barotrauma.Items.Components
|
|||||||
new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.size.Y * openState),
|
new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.size.Y * openState),
|
||||||
(int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))),
|
(int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))),
|
||||||
color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth);
|
color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth);
|
||||||
|
|
||||||
if (openState == 0.0f)
|
|
||||||
{
|
|
||||||
body.Enabled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//push characters out of the doorway when the door is closing/opening
|
|
||||||
Vector2 simPos = ConvertUnits.ToSimUnits(new Vector2(item.Rect.X, item.Rect.Y));
|
|
||||||
Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(item.Rect.Width,
|
|
||||||
item.Rect.Height * (1.0f - openState)));
|
|
||||||
|
|
||||||
foreach (Character c in Character.CharacterList)
|
|
||||||
{
|
|
||||||
int dir = Math.Sign(c.AnimController.Limbs[0].SimPosition.X - simPos.X);
|
|
||||||
foreach (Limb l in c.AnimController.Limbs)
|
|
||||||
{
|
|
||||||
if (l.SimPosition.Y < simPos.Y || l.SimPosition.Y > simPos.Y - simSize.Y) continue;
|
|
||||||
if (Math.Abs(l.SimPosition.X - simPos.X) > simSize.X * 2.0f) continue;
|
|
||||||
|
|
||||||
l.body.ApplyForce(new Vector2(dir * 10.0f, 0.0f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnMapLoaded()
|
public override void OnMapLoaded()
|
||||||
|
|||||||
@@ -90,26 +90,18 @@ namespace Barotrauma.Items.Components
|
|||||||
+ Rand.Range(-degreeOfFailure, degreeOfFailure));
|
+ Rand.Range(-degreeOfFailure, degreeOfFailure));
|
||||||
|
|
||||||
projectile.Use(deltaTime);
|
projectile.Use(deltaTime);
|
||||||
|
projectileComponent.User = character;
|
||||||
|
|
||||||
projectile.body.ApplyTorque(projectile.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f));
|
projectile.body.ApplyTorque(projectile.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f));
|
||||||
|
|
||||||
//recoil
|
//recoil
|
||||||
item.body.ApplyLinearImpulse(
|
item.body.ApplyLinearImpulse(
|
||||||
new Vector2((float)Math.Cos(projectile.body.Rotation), (float)Math.Sin(projectile.body.Rotation)) * item.body.Mass * -50.0f);
|
new Vector2((float)Math.Cos(projectile.body.Rotation), (float)Math.Sin(projectile.body.Rotation)) * item.body.Mass * -50.0f);
|
||||||
|
|
||||||
//else
|
projectileComponent.ignoredBodies = limbBodies;
|
||||||
//{
|
|
||||||
projectileComponent.ignoredBodies = limbBodies;
|
|
||||||
|
|
||||||
//recoil
|
|
||||||
//item.body.ApplyLinearImpulse(
|
|
||||||
// new Vector2((float)Math.Cos(projectile.body.Rotation), (float)Math.Sin(projectile.body.Rotation)) * -item.body.Mass);
|
|
||||||
//}
|
|
||||||
|
|
||||||
item.RemoveContained(projectile);
|
item.RemoveContained(projectile);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Rope rope = item.GetComponent<Rope>();
|
Rope rope = item.GetComponent<Rope>();
|
||||||
if (rope != null) rope.Attach(projectile);
|
if (rope != null) rope.Attach(projectile);
|
||||||
|
|
||||||
@@ -118,7 +110,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public List<Body> ignoredBodies;
|
public List<Body> ignoredBodies;
|
||||||
|
|
||||||
|
public Character User;
|
||||||
|
|
||||||
[HasDefaultValue(10.0f, false)]
|
[HasDefaultValue(10.0f, false)]
|
||||||
public float LaunchImpulse
|
public float LaunchImpulse
|
||||||
{
|
{
|
||||||
@@ -127,17 +129,15 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (stickJoint != null && stickJoint.JointTranslation < 0.01f)
|
if (stickJoint != null && stickJoint.JointTranslation < 0.01f)
|
||||||
{
|
{
|
||||||
if (stickTarget!=null)
|
if (stickTarget != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
|
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch
|
||||||
{
|
{
|
||||||
#if DEBUG
|
//the body that the projectile was stuck to has been removed
|
||||||
DebugConsole.ThrowError("Failed to restore collision with stickTarget", e);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stickTarget = null;
|
stickTarget = null;
|
||||||
@@ -147,11 +147,9 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
GameMain.World.RemoveJoint(stickJoint);
|
GameMain.World.RemoveJoint(stickJoint);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch
|
||||||
{
|
{
|
||||||
#if DEBUG
|
//the body that the projectile was stuck to has been removed
|
||||||
DebugConsole.ThrowError("Failed to remove stickJoint", e);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stickJoint = null;
|
stickJoint = null;
|
||||||
@@ -165,17 +163,17 @@ namespace Barotrauma.Items.Components
|
|||||||
if (ignoredBodies.Contains(f2.Body)) return false;
|
if (ignoredBodies.Contains(f2.Body)) return false;
|
||||||
|
|
||||||
AttackResult attackResult = new AttackResult(0.0f, 0.0f);
|
AttackResult attackResult = new AttackResult(0.0f, 0.0f);
|
||||||
if (attack!=null)
|
if (attack != null)
|
||||||
{
|
{
|
||||||
Limb limb;
|
Limb limb;
|
||||||
Structure structure;
|
Structure structure;
|
||||||
if ((limb = (f2.Body.UserData as Limb)) != null)
|
if ((limb = (f2.Body.UserData as Limb)) != null)
|
||||||
{
|
{
|
||||||
attackResult = attack.DoDamage(null, limb.character, item.SimPosition, 1.0f);
|
attackResult = attack.DoDamage(User, limb.character, item.SimPosition, 1.0f);
|
||||||
}
|
}
|
||||||
else if ((structure = (f2.Body.UserData as Structure)) != null)
|
else if ((structure = (f2.Body.UserData as Structure)) != null)
|
||||||
{
|
{
|
||||||
attackResult = attack.DoDamage(null, structure, item.SimPosition, 1.0f);
|
attackResult = attack.DoDamage(User, structure, item.SimPosition, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
var projectiles = GetLoadedProjectiles();
|
var projectiles = GetLoadedProjectiles();
|
||||||
|
|
||||||
if (projectiles.Count==0 || (projectiles.Count==1 && objective.Option.ToLower()=="hold fire"))
|
if (projectiles.Count==0 || (projectiles.Count==1 && objective.Option.ToLower()!="fire at will"))
|
||||||
{
|
{
|
||||||
ItemContainer container = null;
|
ItemContainer container = null;
|
||||||
foreach (MapEntity e in item.linkedTo)
|
foreach (MapEntity e in item.linkedTo)
|
||||||
@@ -175,7 +175,9 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (container == null || container.ContainableItems.Count==0) return true;
|
if (container == null || container.ContainableItems.Count==0) return true;
|
||||||
|
|
||||||
objective.AddSubObjective(new AIObjectiveContainItem(character, container.ContainableItems[0].Names[0], container));
|
var containShellObjective = new AIObjectiveContainItem(character, container.ContainableItems[0].Names[0], container);
|
||||||
|
containShellObjective.IgnoreAlreadyContainedItems = true;
|
||||||
|
objective.AddSubObjective(containShellObjective);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (GetAvailablePower() < powerConsumption)
|
else if (GetAvailablePower() < powerConsumption)
|
||||||
@@ -186,7 +188,7 @@ namespace Barotrauma.Items.Components
|
|||||||
PowerContainer batteryToLoad = null;
|
PowerContainer batteryToLoad = null;
|
||||||
foreach (PowerContainer battery in batteries)
|
foreach (PowerContainer battery in batteries)
|
||||||
{
|
{
|
||||||
if (batteryToLoad==null || battery.Charge < lowestCharge)
|
if (batteryToLoad == null || battery.Charge < lowestCharge)
|
||||||
{
|
{
|
||||||
batteryToLoad = battery;
|
batteryToLoad = battery;
|
||||||
lowestCharge = battery.Charge;
|
lowestCharge = battery.Charge;
|
||||||
@@ -205,7 +207,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
//enough shells and power
|
//enough shells and power
|
||||||
|
|
||||||
Character closestEnemy = null;
|
Character closestEnemy = null;
|
||||||
float closestDist = 3000.0f;
|
float closestDist = 3000.0f;
|
||||||
foreach (Character enemy in Character.CharacterList)
|
foreach (Character enemy in Character.CharacterList)
|
||||||
@@ -256,6 +257,13 @@ namespace Barotrauma.Items.Components
|
|||||||
return availablePower;
|
return availablePower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Remove()
|
||||||
|
{
|
||||||
|
base.Remove();
|
||||||
|
|
||||||
|
barrelSprite.Remove();
|
||||||
|
}
|
||||||
|
|
||||||
private List<Projectile> GetLoadedProjectiles(bool returnFirst = false)
|
private List<Projectile> GetLoadedProjectiles(bool returnFirst = false)
|
||||||
{
|
{
|
||||||
List<Projectile> projectiles = new List<Projectile>();
|
List<Projectile> projectiles = new List<Projectile>();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -19,8 +20,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private int selectedRightPanel;
|
private int selectedRightPanel;
|
||||||
|
|
||||||
private GUIListBox characterList;
|
private GUIListBox characterList, hireList;
|
||||||
private GUIListBox hireList;
|
|
||||||
|
|
||||||
private GUIListBox selectedItemList, itemList;
|
private GUIListBox selectedItemList, itemList;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private string CostTextGetter()
|
private string CostTextGetter()
|
||||||
{
|
{
|
||||||
return "Cost: "+selectedItemCost.ToString();
|
return "Cost: "+selectedItemCost.ToString()+" credits";
|
||||||
}
|
}
|
||||||
|
|
||||||
private int selectedItemCost
|
private int selectedItemCost
|
||||||
@@ -183,32 +183,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
bottomPanel[(int)PanelTab.CurrentLocation].ClearChildren();
|
bottomPanel[(int)PanelTab.CurrentLocation].ClearChildren();
|
||||||
bottomPanel[(int)PanelTab.CurrentLocation].UserData = location;
|
bottomPanel[(int)PanelTab.CurrentLocation].UserData = location;
|
||||||
//rightPanel[(int)PanelTab.Hire].Padding = GUI.style.smallPadding;
|
|
||||||
|
|
||||||
//for (int i = 0; i < Enum.GetNames(typeof(PanelTab)).Length; i++ )
|
|
||||||
//{
|
|
||||||
|
|
||||||
// float size = Math.Max(
|
|
||||||
// (float)GameMain.GraphicsWidth / (float)location.Type.Background.SourceRect.Width,
|
|
||||||
// (float)GameMain.GraphicsHeight / (float)location.Type.Background.SourceRect.Height);
|
|
||||||
// location.Type.Background.size = new Vector2(
|
|
||||||
// location.Type.Background.SourceRect.Width*size,
|
|
||||||
// location.Type.Background.SourceRect.Height*size);
|
|
||||||
|
|
||||||
|
|
||||||
// topPanel.sprites.Clear();
|
|
||||||
// topPanel.TileSprites = false;
|
|
||||||
// topPanel.sprites.Add(location.Type.Background);
|
|
||||||
|
|
||||||
// bottomPanel[i].sprites.Clear();
|
|
||||||
// bottomPanel[i].TileSprites = false;
|
|
||||||
// bottomPanel[i].sprites.Add(location.Type.Background);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//new GUITextBlock(new Rectangle(0, 0, 200, 25),
|
|
||||||
// "Location: "+location.Name, GUI.Style, bottomPanel[(int)PanelTab.CurrentLocation]);
|
|
||||||
//new GUITextBlock(new Rectangle(0, 20, 200, 25),
|
|
||||||
// "("+location.Type.Name+")", GUI.Style, bottomPanel[(int)PanelTab.CurrentLocation]);
|
|
||||||
|
|
||||||
if (location.HireManager != null)
|
if (location.HireManager != null)
|
||||||
{
|
{
|
||||||
@@ -257,17 +231,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (location == null) return;
|
if (location == null) return;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 0), location.Name, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel).Font = GUI.LargeFont;
|
new GUITextBlock(new Rectangle(0, 0, 250, 0), location.Name, GUI.Style, Alignment.TopLeft, Alignment.TopCenter, locationPanel, true, GUI.LargeFont);
|
||||||
|
|
||||||
if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Quest != null)
|
if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Quest != null)
|
||||||
{
|
{
|
||||||
var quest = GameMain.GameSession.Map.SelectedConnection.Quest;
|
var quest = GameMain.GameSession.Map.SelectedConnection.Quest;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 40, 0, 20), "Quest: "+quest.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
|
new GUITextBlock(new Rectangle(0, 80, 0, 20), "Quest: "+quest.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 60, 0, 20), "Reward: " + quest.Reward, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
|
new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + quest.Reward+" credits", Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 80, 0, 0), quest.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true);
|
new GUITextBlock(new Rectangle(0, 120, 0, 0), quest.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,15 +256,6 @@ namespace Barotrauma
|
|||||||
foreach (CharacterInfo c in CrewManager.characterInfos)
|
foreach (CharacterInfo c in CrewManager.characterInfos)
|
||||||
{
|
{
|
||||||
c.CreateCharacterFrame(characterList, c.Name + " ("+c.Job.Name+") ", c);
|
c.CreateCharacterFrame(characterList, c.Name + " ("+c.Job.Name+") ", c);
|
||||||
|
|
||||||
//GUITextBlock textBlock = new GUITextBlock(
|
|
||||||
// new Rectangle(0, 0, 0, 25),
|
|
||||||
// c.Name + " (" + c.Job.Name + ")", GUI.Style,
|
|
||||||
// Alignment.Left,
|
|
||||||
// Alignment.Left,
|
|
||||||
// characterList, false, GameMain.GraphicsWidth<1000 ? GUI.SmallFont : GUI.Font);
|
|
||||||
//textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
//textBlock.UserData = c;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +423,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private string GetMoney()
|
private string GetMoney()
|
||||||
{
|
{
|
||||||
return "Money: " + ((GameMain.GameSession == null) ? "" : CrewManager.Money.ToString());
|
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", CrewManager.Money)) + " credits";
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectCharacter(GUIComponent component, object selection)
|
private bool SelectCharacter(GUIComponent component, object selection)
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private static Sound startDrone;
|
private static Sound startDrone;
|
||||||
|
|
||||||
|
public static bool Initialized;
|
||||||
|
|
||||||
public static IEnumerable<object> Init()
|
public static IEnumerable<object> Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
startDrone = Sound.Load("Content/Sounds/startDrone.ogg", false);
|
startDrone = Sound.Load("Content/Sounds/startDrone.ogg", false);
|
||||||
startDrone.Play();
|
startDrone.Play();
|
||||||
|
|
||||||
@@ -148,6 +148,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Initialized = true;
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,21 +182,30 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect = SpriteEffects.None)
|
public void Draw(SpriteBatch spriteBatch, Vector2 pos, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect = SpriteEffects.None)
|
||||||
{
|
{
|
||||||
spriteBatch.Draw(texture, pos + offset, sourceRect, Color.White, rotation + rotate, origin, scale, spriteEffect, depth);
|
this.Draw(spriteBatch, pos, Color.White, rotate, scale, spriteEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
||||||
{
|
{
|
||||||
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth==null ? this.depth : (float)depth);
|
this.Draw(spriteBatch, pos, color, this.origin, rotate, new Vector2(scale,scale), spriteEffect, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
||||||
{
|
{
|
||||||
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth);
|
this.Draw(spriteBatch, pos, color, origin, rotate, new Vector2(scale, scale), spriteEffect, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
||||||
{
|
{
|
||||||
|
//for (int x = -1; x < 3; x+=2 )
|
||||||
|
//{
|
||||||
|
// for (int y = -1; y < 3; y+=2 )
|
||||||
|
// {
|
||||||
|
|
||||||
|
// spriteBatch.Draw(texture, pos + offset + new Vector2(x, y)*1.0f, sourceRect, Color.Black, rotation + rotate, origin, scale, spriteEffect, (depth == null ? this.depth : (float)depth)+0.0001f);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth);
|
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,12 +224,12 @@ namespace Barotrauma
|
|||||||
//how many times the texture needs to be drawn on the y-axis
|
//how many times the texture needs to be drawn on the y-axis
|
||||||
int yTiles = (int)Math.Ceiling((targetSize.Y+startOffset.Y) / sourceRect.Height);
|
int yTiles = (int)Math.Ceiling((targetSize.Y+startOffset.Y) / sourceRect.Height);
|
||||||
|
|
||||||
Vector2 position = pos-startOffset;
|
Vector2 position = pos - startOffset;
|
||||||
Rectangle drawRect = sourceRect;
|
Rectangle drawRect = sourceRect;
|
||||||
|
|
||||||
position.X = pos.X;
|
position.X = pos.X;
|
||||||
|
|
||||||
for (int x = 0 ; x<xTiles ; x++)
|
for (int x = 0; x < xTiles; x++)
|
||||||
{
|
{
|
||||||
drawRect.X = sourceRect.X;
|
drawRect.X = sourceRect.X;
|
||||||
drawRect.Height = sourceRect.Height;
|
drawRect.Height = sourceRect.Height;
|
||||||
@@ -244,7 +253,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
position.Y = pos.Y;
|
position.Y = pos.Y;
|
||||||
|
|
||||||
for (int y = 0 ; y<yTiles ; y++)
|
for (int y = 0; y < yTiles; y++)
|
||||||
{
|
{
|
||||||
drawRect.Y = sourceRect.Y;
|
drawRect.Y = sourceRect.Y;
|
||||||
|
|
||||||
|
|||||||
+2
-49
@@ -5,14 +5,12 @@ VisualStudioVersion = 12.0.21005.1
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma", "Subsurface\Barotrauma.csproj", "{008C0F83-E914-4966-9135-EA885059EDD8}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma", "Subsurface\Barotrauma.csproj", "{008C0F83-E914-4966-9135-EA885059EDD8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subsurface_contentContent", "Subsurface_content\Subsurface_contentContent\Subsurface_contentContent.contentproj", "{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma_contentContent", "Subsurface_content\Subsurface_contentContent\Barotrauma_contentContent.contentproj", "{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subsurface_content", "Subsurface_content\Subsurface_content\Subsurface_content.csproj", "{1E6BF44D-6E31-40CC-8321-3D5958C983E7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma_content", "Subsurface_content\Subsurface_content\Barotrauma_content.csproj", "{1E6BF44D-6E31-40CC-8321-3D5958C983E7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OldLauncher", "Launcher\OldLauncher.csproj", "{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher2\Launcher.csproj", "{251AAFE1-F24B-4837-9128-9D04FCBFD528}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher2\Launcher.csproj", "{251AAFE1-F24B-4837-9128-9D04FCBFD528}"
|
||||||
@@ -214,51 +212,6 @@ Global
|
|||||||
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|Mixed Platforms.Build.0 = Release|x86
|
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|Mixed Platforms.Build.0 = Release|x86
|
||||||
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|x86.ActiveCfg = Release|x86
|
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|x86.ActiveCfg = Release|x86
|
||||||
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|x86.Build.0 = Release|x86
|
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|x86.Build.0 = Release|x86
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Android|Any CPU.ActiveCfg = Release|Any CPU
|
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Android|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Android|Any CPU.Build.0 = Release|Any CPU
|
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Android|Any CPU.Build.0 = Release|Any CPU
|
||||||
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Android|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Android|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
|||||||
Binary file not shown.
+2
-2
@@ -46,8 +46,8 @@
|
|||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Subsurface_contentContent\Subsurface_contentContent.contentproj">
|
<ProjectReference Include="..\Subsurface_contentContent\Barotrauma_contentContent.contentproj">
|
||||||
<Name>Subsurface_contentContent</Name>
|
<Name>Barotrauma_contentContent</Name>
|
||||||
<XnaReferenceType>Content</XnaReferenceType>
|
<XnaReferenceType>Content</XnaReferenceType>
|
||||||
<Project>{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}</Project>
|
<Project>{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Content\SpriteFont1.xnb
|
||||||
|
Content\SmallFont.xnb
|
||||||
|
Content\LargeFont.xnb
|
||||||
|
Content\SpriteFont1.spritefont
|
||||||
|
Content\SmallFont.spritefont
|
||||||
|
Content\LargeFont.spritefont
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user