statuseffect setvalue, new diving suit sprite & character slowdown, welded door sprite
This commit is contained in:
@@ -134,10 +134,12 @@ namespace Subsurface
|
||||
get { return selectedCharacter; }
|
||||
}
|
||||
|
||||
//public AITarget AiTarget
|
||||
//{
|
||||
// get { return aiTarget; }
|
||||
//}
|
||||
private float lowPassMultiplier;
|
||||
public float LowPassMultiplier
|
||||
{
|
||||
get { return lowPassMultiplier; }
|
||||
set { lowPassMultiplier = MathHelper.Clamp(value, 0.0f, 1.0f); }
|
||||
}
|
||||
|
||||
public float SoundRange
|
||||
{
|
||||
@@ -195,6 +197,12 @@ namespace Subsurface
|
||||
bleeding = Math.Max(value, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public float SpeedMultiplier
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Item[] SelectedItems
|
||||
{
|
||||
@@ -296,7 +304,6 @@ namespace Subsurface
|
||||
public Character(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false)
|
||||
{
|
||||
|
||||
|
||||
keys = new Key[Enum.GetNames(typeof(InputType)).Length];
|
||||
keys[(int)InputType.Select] = new Key(false);
|
||||
keys[(int)InputType.ActionHeld] = new Key(true);
|
||||
@@ -319,6 +326,8 @@ namespace Subsurface
|
||||
//blood = 100.0f;
|
||||
aiTarget = new AITarget(this);
|
||||
|
||||
lowPassMultiplier = 1.0f;
|
||||
|
||||
Properties = ObjectProperty.GetProperties(this);
|
||||
|
||||
Info = characterInfo==null ? new CharacterInfo(file) : characterInfo;
|
||||
@@ -499,6 +508,9 @@ namespace Subsurface
|
||||
if (Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir) && GetInputState(InputType.Run))
|
||||
targetMovement *= 3.0f;
|
||||
|
||||
targetMovement *= SpeedMultiplier;
|
||||
SpeedMultiplier = 1.0f;
|
||||
|
||||
AnimController.TargetMovement = targetMovement;
|
||||
AnimController.IsStanding = true;
|
||||
|
||||
@@ -740,6 +752,8 @@ namespace Subsurface
|
||||
UpdateSightRange();
|
||||
aiTarget.SoundRange = 0.0f;
|
||||
|
||||
lowPassMultiplier = MathHelper.Lerp(lowPassMultiplier, 1.0f, 0.1f);
|
||||
|
||||
if (needsAir)
|
||||
{
|
||||
if (AnimController.HeadInWater)
|
||||
|
||||
@@ -414,11 +414,22 @@ namespace Subsurface
|
||||
Vector2 origin = wearingItemSprite.Sprite.Origin;
|
||||
if (body.Dir == -1.0f) origin.X = wearingItemSprite.Sprite.SourceRect.Width - origin.X;
|
||||
|
||||
float depth = sprite.Depth - 0.000001f;
|
||||
|
||||
if (wearingItemSprite.DepthLimb==LimbType.None)
|
||||
{
|
||||
Limb depthLimb = character.AnimController.GetLimb(wearingItemSprite.DepthLimb);
|
||||
if (depthLimb!=null)
|
||||
{
|
||||
depth = depthLimb.sprite.Depth - 0.000001f;
|
||||
}
|
||||
}
|
||||
|
||||
wearingItemSprite.Sprite.Draw(spriteBatch,
|
||||
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
||||
color, origin,
|
||||
-body.DrawRotation,
|
||||
1.0f, spriteEffect, sprite.Depth - 0.000001f);
|
||||
1.0f, spriteEffect, depth);
|
||||
}
|
||||
|
||||
if (!GameMain.DebugDraw) return;
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Subsurface
|
||||
public string[] propertyNames;
|
||||
private object[] propertyEffects;
|
||||
|
||||
private bool setValue;
|
||||
|
||||
private bool disableDeltaTime;
|
||||
|
||||
private string[] onContainingNames;
|
||||
@@ -63,7 +65,6 @@ namespace Subsurface
|
||||
IEnumerable<XAttribute> attributes = element.Attributes();
|
||||
List<XAttribute> propertyAttributes = new List<XAttribute>();
|
||||
|
||||
disableDeltaTime = ToolBox.GetAttributeBool(element, "disabledeltatime", false);
|
||||
|
||||
foreach (XAttribute attribute in attributes)
|
||||
{
|
||||
@@ -96,6 +97,12 @@ namespace Subsurface
|
||||
targetTypes |= (TargetType)Enum.Parse(typeof(TargetType), s, true);
|
||||
}
|
||||
|
||||
break;
|
||||
case "disabledeltatime":
|
||||
disableDeltaTime = ToolBox.GetAttributeBool(attribute, false);
|
||||
break;
|
||||
case "setvalue":
|
||||
setValue = ToolBox.GetAttributeBool(attribute, false);
|
||||
break;
|
||||
case "targetnames":
|
||||
string[] names = attribute.Value.Split(',');
|
||||
@@ -220,11 +227,15 @@ namespace Subsurface
|
||||
Type type = value.GetType();
|
||||
if (type == typeof(float))
|
||||
{
|
||||
property.TrySetValue((float)property.GetValue() + (float)value * deltaTime);
|
||||
float floatValue = (float)value * deltaTime;
|
||||
if (!setValue) floatValue += (float)property.GetValue();
|
||||
property.TrySetValue(floatValue);
|
||||
}
|
||||
else if (type == typeof(int))
|
||||
{
|
||||
property.TrySetValue((int)property.GetValue() + (int)value * deltaTime);
|
||||
int intValue = (int)((int)value * deltaTime);
|
||||
if (!setValue) intValue += (int)property.GetValue();
|
||||
property.TrySetValue(intValue);
|
||||
}
|
||||
else if (type == typeof(bool))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user