示例#1
0
            public AttackEnemy(State previousState, AggressivePlayer player)
                : base(CutterTimeout, DefenseTimeout, player)
            {
                previousState?.Dispose();

                var targetPlayer = player.Player
                                   .GetEnemyPlayers()
                                   .MinBy(enemy => {
                    var keep = (enemy.Plugin as PlayerWithKeep)?.Keep;
                    return(keep == null
                                                                                                                                        ? double.MaxValue
                                                                                                                                        : Vector3.Distance(player.Keep.Building.Center, keep.Building.Center));
                }).FirstOrDefault();

                target = targetPlayer?.Plugin as PlayerWithKeep;
                if (target != null)
                {
                    target.Player.OnRemoval += TargetDied;
                }
            }
示例#2
0
 void TargetDied(IPlayer player)
 {
     target = null;
 }