Character freezing + Misc fixes

This commit is contained in:
juanjp600
2016-09-21 16:46:12 -03:00
parent 3314c8501c
commit edab86f730
9 changed files with 70 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ namespace Barotrauma
public override void UpdateAnim(float deltaTime)
{
if (character.IsDead) return;
if (Frozen) return;
Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition;

View File

@@ -19,6 +19,10 @@ namespace Barotrauma
protected Hull currentHull;
public Limb[] Limbs;
private bool isFrozen = false;
public bool Frozen = false;
private Dictionary<LimbType, Limb> limbDictionary;
public RevoluteJoint[] limbJoints;
@@ -320,7 +324,7 @@ namespace Barotrauma
public void AddLimb(Limb limb)
{
limb.body.FarseerBody.OnCollision += OnLimbCollision;
Array.Resize(ref Limbs, Limbs.Length + 1);
Limbs[Limbs.Length-1] = limb;
@@ -684,6 +688,27 @@ namespace Barotrauma
{
if (!character.Enabled) return;
if (Frozen)
{
if (!isFrozen)
{
foreach (Limb l in Limbs)
{
l.body.PhysEnabled = false;
}
isFrozen = true;
}
return;
}
if (isFrozen)
{
for (int i=0;i < Limbs.Length;i++)
{
Limbs[i].body.PhysEnabled = true;
}
isFrozen = false;
}
UpdateNetPlayerPosition();
Vector2 flowForce = Vector2.Zero;