4d225c65f2
- Barotrauma's projects are in the Barotrauma directory - All libraries are in the Libraries directory - MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?) - NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred - Removed Content/effects.mgfx as it didn't seem to be used anywhere - Removed some references to Subsurface directory - Renamed Launcher2 to Launcher
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace Barotrauma
|
|
{
|
|
class AIObjectiveRescue : AIObjective
|
|
{
|
|
private readonly Character targetCharacter;
|
|
|
|
public AIObjectiveRescue(Character character, Character targetCharacter)
|
|
: base (character, "")
|
|
{
|
|
Debug.Assert(character != targetCharacter);
|
|
|
|
this.targetCharacter = targetCharacter;
|
|
}
|
|
|
|
public override bool IsDuplicate(AIObjective otherObjective)
|
|
{
|
|
AIObjectiveRescue rescueObjective = otherObjective as AIObjectiveRescue;
|
|
return rescueObjective != null && rescueObjective.targetCharacter == targetCharacter;
|
|
}
|
|
|
|
public override float GetPriority(Character character)
|
|
{
|
|
if (targetCharacter.AnimController.CurrentHull == null) return 0.0f;
|
|
|
|
float distance = Vector2.DistanceSquared(character.WorldPosition, targetCharacter.WorldPosition);
|
|
|
|
return targetCharacter.IsDead ? 1000.0f / distance : 10000.0f / distance;
|
|
}
|
|
|
|
}
|
|
}
|