water ambience sounds change according to speed, oxygengenerator fills oxygen tanks even if their condition is 0, submarine refactoring & bugfixes, wire node editing bugfixes

This commit is contained in:
Regalis
2015-09-24 15:21:10 +03:00
parent f6966f06c3
commit bf7619bcc4
33 changed files with 635 additions and 490 deletions
@@ -44,6 +44,8 @@ namespace Subsurface
steeringManager = new SteeringManager(this);
}
public virtual void OnAttacked(IDamageable attacker, float amount) { }
public virtual void SelectTarget(AITarget target) { }
public virtual void Update(float deltaTime) { }
@@ -262,6 +262,13 @@ namespace Subsurface
targetEntity = closestBody.UserData as IDamageable;
}
public override void OnAttacked(IDamageable attacker, float amount)
{
if (attacker==null || attacker.AiTarget==null) return;
AITargetMemory targetMemory = FindTargetMemory(attacker.AiTarget);
targetMemory.Priority += amount;
}
private void UpdateLimbAttack(float deltaTime, Limb limb, Vector2 attackPosition)
{
IDamageable damageTarget = null;
@@ -295,8 +302,8 @@ namespace Subsurface
{
attackTimer += deltaTime;
limb.body.ApplyTorque(limb.Mass * 50.0f * Character.AnimController.Dir * dir);
limb.attack.DoDamage(damageTarget, limb.SimPosition, deltaTime, (limb.soundTimer <= 0.0f));
limb.attack.DoDamage(Character, damageTarget, limb.SimPosition, deltaTime, (limb.soundTimer <= 0.0f));
limb.soundTimer = Limb.SoundInterval;
}