/// <summary> /// Occurs when the entity enters to this state. /// </summary> public override void Enter() { var goalCenter = new Vector(0, GameClient.FieldHeight / 2); if (!AI.MyTeam.IsOnLeft) { goalCenter.X = GameClient.FieldWidth; } Interpose = new Interpose(Player, 1, 1.0, AI.Ball, goalCenter) { PreferredDistanceFromSecond = Parameters.DefendGoalDistance }; Player.SteeringBehaviorsManager.AddBehavior(Interpose); }
protected override void Start() { base.Start(); PrepareToPlay prepare = new PrepareToPlay(this); Guard guard = new Guard(this); Interpose inter = new Interpose(this); // Pass pass = new Pass(this); fsm.AddState(KeeperStateID.PrepareToPlay, prepare); fsm.AddState(KeeperStateID.Guard, guard); fsm.AddState(KeeperStateID.Interpose, inter); // fsm.AddState(KeeperStateID.Pass, pass); fsm.ChangeState(KeeperStateID.PrepareToPlay); }
/// <summary> /// Creates a new instance /// </summary> public Behaviors() { Alignment = new Alignment(); Arrive = new Arrive(); Cohesion = new Cohesion(); Evade = new Evade(); Flee = new Flee(); Hide = new Hide(); Interpose = new Interpose(); ObstacleAvoidance = new ObstacleAvoidance(); OffsetPursuit = new OffsetPursuit(); PathFollowing = new PathFollowing(); Pursuit = new Pursuit(); Seek = new Seek(); Separation = new Separation(); WallAvoidance = new WallAvoidance(); Wander = new Wander(); }
/// <summary> /// Occurs when the entity enters to this state. /// </summary> public override void Enter() { SetHomeRegions(); Interposes = new List <Interpose>(); var controllingOpponent = AI.OpponentTeam.NearestPlayerToBall; var firstNearestToControlling = AI.OpponentTeam.GetNearestPlayerToPosition( controllingOpponent.Position, controllingOpponent); var secondNearestToControlling = AI.OpponentTeam.GetNearestPlayerToPosition( controllingOpponent.Position, controllingOpponent, firstNearestToControlling); var interpose1 = new Interpose(Team.Forwards[0], 2, 0.8, controllingOpponent, firstNearestToControlling); var interpose2 = new Interpose(Team.Forwards[1], 2, 0.8, controllingOpponent, secondNearestToControlling); Interposes.Add(interpose1); Interposes.Add(interpose2); Team.Forwards[0].SteeringBehaviorsManager.AddBehavior(interpose1); Team.Forwards[1].SteeringBehaviorsManager.AddBehavior(interpose2); }