Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaServer/Source/Traitors/Goals/GoalRandom.cs
T
2019-08-26 19:58:44 +03:00

44 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace Barotrauma
{
partial class Traitor
{
public class GoalRandom : Goal
{
private readonly List<Goal> allGoals;
private readonly List<Goal> selectedGoals = new List<Goal>();
public override IEnumerable<string> InfoTextKeys => base.InfoTextKeys.Concat(new string[] { "[targetname]" });
public override IEnumerable<string> InfoTextValues => base.InfoTextValues.Concat(new string[] { Target?.Name ?? "(unknown)" });
private bool isCompleted = false;
public override bool IsCompleted => isCompleted;
public override bool IsEnemy(Character character) => base.IsEnemy(character) || (!isCompleted && character == Target);
public override void Update(float deltaTime)
{
base.Update(deltaTime);
isCompleted = Target?.IsDead ?? false;
}
public override bool Start(Traitor traitor)
{
if (!base.Start(traitor))
{
return false;
}
Target = traitor.Mission.FindKillTarget(traitor.Character, Filter);
return Target != null && !Target.IsDead;
}
public GoalRandom(params Goal[] goals, int count)
{
this.goals = goals;
}
}
}
}