public Player(PlayerId id, float maxHealth, int initialCurrency) { _id = id; _maxHealth = _health = maxHealth; _currency = initialCurrency; _path = PlayerServices.GetPlayerPath(_id); }
public void GetDistance_MaxSpeed1000Turns_3000() { var act = PlayerPath.GetDistance(3, 1000, 0); var exp = new Distance(3000); Assert.AreEqual(exp, act); }
public PlayerResponse(bool moved) { responseStr = string.Empty; playerPath = null; pathInOrder = false; playerMoved = moved; }
public void Passing() { var angles = new Angle[51, 600]; var sw = Stopwatch.StartNew(); for (var p = 5f; p <= 10; p += 0.1f) { for (var d = 200; d < 800; d++) { var d2 = d * d; var power = new Power(p); var speed = power.Speed; for (var t = 1; t < 1024; t++) { if (p > 9.8f) { } var ball = BallPath.GetDistance(speed, t); var player = PlayerPath.GetDistance(3, t, 40); if (ball.Squared + player.Squared > d2) { var angle = Angle.Atan((double)player / (double)ball); break; } } } } Console.WriteLine(sw.Elapsed.TotalMilliseconds); }
public PlayerResponse(string response) { responseStr = response; playerPath = null; pathInOrder = false; playerMoved = false; }
void clearMemoryOfRoomsAndMachineLearning() { patrolClearer.clearAllPatrols(); MapGenerator.clearRoomMemory(); PlayerPath.clearPathData(); TimeSpentInEachRoom.clearData(); }
public void Generate(PlayerInfo owner, GameState state, ActionCandidates candidates) { if (!owner.IsBallOwner || owner.CanBeTackled.Any()) { return; } foreach (var direction in WalkingDirections) { var target = owner.Position + direction; // Don't try to leave the field. if (Game.Field.IsOnField(target)) { var dribble = PlayerPath.Create(owner, target, MaximumDribbleLength, Distance.Tackle); var catchUp = dribble.GetCatchUps(state.Current.OtherPlayers).FirstOrDefault(); // don't start (too) short walks. if (catchUp == null || catchUp.Turn >= MinimumDribbleLength) { if (catchUp != null) { target = dribble[catchUp.Turn - 2]; } var action = Actions.Move(owner, target); var length = catchUp == null ? dribble.Count : catchUp.Turn - 1; candidates.Add(Evaluator.GetPositionImprovement(owner, target, length), action); } } } }
static Shoot() { ShootAngles = new Angle[51, 600]; for (var p = 5f; p < 10.01f; p += 0.1f) { for (var d = 200; d < 800; d++) { var d2 = d * d; var power = new Power(p); var speed = power.Speed; for (var t = 1; t < 1024; t++) { var ball = BallPath.GetDistance(speed, t); var player = PlayerPath.GetDistance(3, t, 40); if (ball.Squared + player.Squared > d2) { var angle = Angle.Atan((double)player / (double)ball); var spe = SpeedToKey(speed); var dis = DistanceToKey(d); ShootAngles[spe, dis] = angle; break; } } } } }
public PlayerResponse(PlayerPath path, bool inOrder) { playerPath = path; responseStr = string.Empty; pathInOrder = inOrder; playerMoved = false; }
void OnMouseDown() { if (!_isDrawingPath) { Debug.Log("Start path"); DestroyAllPathes(); _currentPath = Instantiate(linePrefab, Vector3.zero, Quaternion.identity).GetComponent <PlayerPath>(); _isDrawingPath = true; } }
public override void EndCommuncation() { commComplete = false; DestroyTextBoxes(); //reset relevant fields playerPath = null; player = null; ai = null; enabled = false; }
public void Create_Player_ReachesTheTargetIn44Turns() { var player = new PlayerInfo() { Position = new Position(200, 200), Velocity = new Velocity(-2, 0), }; var target = new Position(300, 200); var act = PlayerPath.Create(player, target, 100, Distance.Pickup); var exp = 44; Assert.AreEqual(exp, act.Count); }
public bool Apply(GameState state, PlayerQueue queue) { if (state.Current.Ball.IsOther) { var path = PlayerPath.Create(state.Current.Ball.Owner, Goal.Own.Center, 400, 40f); var sweeper = path.GetCatchUps(queue).FirstOrDefault(); if (sweeper != null) { return(queue.Dequeue(Actions.Move(sweeper.Player, sweeper.Position))); } } return(false); }
private void ClearColor() { for (int i = 0; i < GeneratedPath.Count - 1; i++) { GeneratedPath[i].Type = 0; //generatedPath[i].renderer.material.color = Color.cyan; Object.Destroy(GeneratedPath[i].Tesseract.GetComponent <ParticleSystem>()); } PlayerPath.ForEach(crst => { crst.Type = 1; //crst.renderer.material.color = Color.cyan; Object.Destroy(crst.Tesseract.GetComponent <ParticleSystem>()); }); GeneratePath(); }
public bool Apply(GameState state, PlayerQueue queue) { if (state.Current.Ball.IsOther) { var freeMan = state.Current.Ball.Owner.GetOther(state.Current.OtherPlayers) .OrderBy(player => player.DistanceToOwnGoal) .Skip(Rank).FirstOrDefault(); var path = PlayerPath.Create(freeMan, Goal.Own.Center, 400, 40f); var manMarker = path.GetCatchUps(queue).FirstOrDefault(); if (manMarker != null) { return(queue.Dequeue(Actions.Move(manMarker.Player, manMarker.Position))); } } return(false); }
void Launch() { Debug.Log("Launch player"); if (_pathController == null) { Debug.LogError("Path controller could not be found"); return; } _path = _pathController.GetPlayersPath(); if (_path.points == null || _path.points.Count == 0) { Debug.Log("No path to follow"); return; } Debug.Log("Start following path"); _isLaunched = true; StartCoroutine(SmoothMovement(2)); }
public override void Init() { PlayerPath = Utils.CheckSysPath(new string[] { "mpv.exe" }); if (string.IsNullOrEmpty(PlayerPath)) { PlayerPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\mpv.exe\shell\open\command", "", null); if (!string.IsNullOrEmpty(PlayerPath)) { int idx = PlayerPath.IndexOf("\"", 1); PlayerPath = PlayerPath.Substring(1, idx - 1); } } if (string.IsNullOrEmpty(PlayerPath)) { Active = false; return; } Active = true; }
private void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); if (Physics.Raycast(ray, out hit, float.MaxValue)) { var ln = LayerMask.LayerToName(hit.transform.gameObject.layer); if (!ln.Equals(Consts.PlayerLayerName)) { return; } _currentPath = hit.transform.GetComponentInParent <PlayerPath>(); if (_currentPath == null) { return; } _currentPath.StartMove(); } } else if (Input.GetMouseButtonUp(0)) { if (_currentPath != null) { _currentPath.EndMove(); } } if (Input.GetMouseButton(0)) { if (_currentPath != null) { _currentPath.InMove(); } } }
// Use this for initialization void Start() { isFinished=false; isOpen = false; path=player.GetComponent<PlayerPath>(); path.OnPathAdded+=onPathAdded; //isInitialMap = false; // mapRenderers=GetComponentsInChildren<Renderer> (); // InitializeMap (MapDatas.map2); }
void Start() { playerPathScript = player.GetComponent <PlayerPath> (); timeScript = player.GetComponent <TimeSpentInEachRoom> (); patrolClearer = new PatrolClearer(); }
private void Awake() { inputs = GetComponent <InputListener>(); movement = GetComponent <PlayerMovement>(); path = GetComponent <PlayerPath>(); }
public void SetPathForPlayer(PlayerPath path) { playerPath = path; }
public void SetPathForPlayer(List <Vector3> path) { playerPath = new PlayerPath(path, initWithListOrder: false); }
public void AddChoice(PlayerPath choice) => m_PlayerChoices.Add(choice);
void Start() { playerPathScript = GameObject.Find("Player").GetComponent <PlayerPath> (); timeScript = GameObject.Find("Player").GetComponent <TimeSpentInEachRoom> (); patrolClearer = new PatrolClearer(); }
public void SetPathForPlayer(List<Vector3> path) { playerPath = new PlayerPath(path, initWithListOrder: false); }