public void on_player_move(object gameengine, PlayerMoveEventArgs eventargs) { if (eventargs.Player != this) { sendThread(eventargs.Move); } }
private void onPlayerMoveSet(PlayerMoveEventArgs i_EventArgs) { if (PlayerMoveSet != null) { PlayerMoveSet.Invoke(this, i_EventArgs); } }
public static void InvokePlayerMove(PlayerMoveEventArgs args) { if (PlayerMove != null) { PlayerMove(args); } }
protected virtual void InvokePlayerMove(PlayerMoveEventArgs e) { if (onPlayerMove != null) { onPlayerMove.Invoke(this, e); } }
/// <summary> /// Event delegate for <see cref="PlayerAI.OnPlayerMove"/> /// </summary> /// <param name="sender">-</param> /// <param name="e">-</param> private void OnPlayerMove(object sender, PlayerMoveEventArgs e) { if (this.Player.AI.FlyMode) { return; } this.Player.Energy -= this.MovementEnergyLoss * Mathf.Abs(e.CurrentMovementSpeed); }
private static void DelayPlayer(object sender, PlayerMoveEventArgs args) { if (!args.CurrentTurn.HasValue) { throw new InvalidOperationException("Tried to delay player but didn't specify turn to do so."); } args.MovingPlayer.ShiftFromPlayerActions(args.CurrentTurn.Value); }
private void PoisonPlayer(object sender, PlayerMoveEventArgs args) { if (poisonedPlayers == null) { poisonedPlayers = new PoisonedPlayers(this); poisonedPlayers.Initialize(SittingDuck, ThreatController, EventMaster); ThreatController.AddInternalThreat(poisonedPlayers, TimeAppears, Position); } poisonedPlayers.PoisonPlayer(args.MovingPlayer); }
/// <summary> /// Handles <see cref="Player.MoveRequest"/> /// (overrides <see cref="GameController.HandlePlayersMoveRequest(object, PlayerMoveEventArgs)"/>). /// </summary> /// <param name="sender">Event source.</param> /// <param name="e">A <see cref="PlayerMoveEventArgs"/> containing event data.</param> public override void HandlePlayersMoveRequest(object sender, PlayerMoveEventArgs e) { if (sender is NetPlayer) { base.HandlePlayersMoveRequest(sender, e); } else { Connection.SendInformation(NetPlayer.MarkCode, new MarksChangedEventArgs(e.MyMove)); } }
/// <summary> /// Handles <see cref="Player.MoveRequest"/> event /// (overrides <see cref="GameController.HandlePlayersMoveRequest(object, PlayerMoveEventArgs)"/>). /// </summary> /// <param name="sender">Event source.</param> /// <param name="e">A <see cref="PlayerMoveEventArgs"/> containing event data.</param> public override void HandlePlayersMoveRequest(object sender, PlayerMoveEventArgs e) { Mark markOfPlayer = State.GetMarkOfPlayer(sender as Player); if (MarkPointIfPossible(e.MyMove, markOfPlayer)) { if (sender is NetPlayer) { Connection.SendInformation(MarkMadeAckCode, new MarkAckInfo(e.MyMove, markOfPlayer)); } } }
/// <summary> /// Grants EoC based on player movement /// </summary> private static void OnMove(PlayerMoveEventArgs args) { Player p = args.Player; if (p.Mounted) { EoCTable[p].MountedSteps++; } else if ((args.Direction & Direction.Running) != 0) { EoCTable[p].WalkingSteps += 2; } else { EoCTable[p].WalkingSteps++; } }
private void Game_OnPlayerMove(object sender, PlayerMoveEventArgs e) { if (Game.State != GameState.Lobby) return; if (e.FromType != (int)PlayerType.Observer) { Console.WriteLine("::::left-slot|" + e.FromType + "|" + e.Player.Name); } if (e.Player.Type != (int)PlayerType.Observer) { Console.WriteLine("::::join-slot|" + e.Player.Type + "|" + e.Player.Name); } if (e.FromType == (int)PlayerType.Observer || e.Player.Type == (int)PlayerType.Observer) { Console.WriteLine("::::spectator|" + Game.Observers.Count); } }
private void Game_OnPlayerMove(object sender, PlayerMoveEventArgs e) { if (Game.State != GameState.Lobby) { return; } if (e.FromType != (int)PlayerType.Observer) { Console.WriteLine("::::left-slot|" + e.FromType + "|" + e.Player.Name); } if (e.Player.Type != (int)PlayerType.Observer) { Console.WriteLine("::::join-slot|" + e.Player.Type + "|" + e.Player.Name); } if (e.FromType == (int)PlayerType.Observer || e.Player.Type == (int)PlayerType.Observer) { Console.WriteLine("::::spectator|" + Game.Observers.Count); } }
private void on_player_moved(object gameengine, PlayerMoveEventArgs eventargs) { BoardState state = eventargs.State; Move move = eventargs.Move; Dispatcher.Invoke(() => { playedMoves.Add(move); int row = move.Row; int col = move.Col; UserControlAnimation.FadeInElement(inactiveImages[row, col], false); if (activeImages[row, col] != null) { Sprite previousSprite = activeImages[row, col] as Sprite; if (previousSprite != null) { previousSprite.Opacity = 0; originalPossibleMoveSprite.RemoveDependent(previousSprite); } } activeImages[row, col] = addPod(state[move], inactiveImages[row, col], move); int redScore, blackScore; eventargs.Board.GetScore(state, out redScore, out blackScore); //change the score labels HumanPodsLabel.Content = state.RedMovesLeft; RobotPodsLabel.Content = state.BlackMovesLeft; HumanScoreLabel.Content = redScore; RobotScoreLabel.Content = blackScore; }); }
/// <summary> /// Event delegate for <see cref="OnPlayerMove"/> /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The event arguments.</param> private void OnPlayerMoveInvoke(object sender, PlayerMoveEventArgs e) { // Update the animator. this.PlayerAnimator.SetFloat("PlayerSpeed", Mathf.Abs(e.CurrentMovementSpeed)); }
public static void InvokePlayerMove( PlayerMoveEventArgs args ) { if( PlayerMove != null ) PlayerMove(args); }
public void UpdateLoadedList(object sender, EventArgs e) { if (e is PlayerMoveEventArgs && sender is Player) { PlayerMoveEventArgs pmea = e as PlayerMoveEventArgs; Player player = sender as Player; #region old calculation code /* * * calculates a "triangle" in the direction the player is facing and loads the chunks in view * * //Calculate three points of view triangle: a, b, and c * * Vector2 a; * Vector2 b; * Vector2 c; * Vector2 d = VectorUtils.ToVector2 (pmea.position); * Vector2 face = VectorUtils.ToVector2 (pmea.faceVector); * Vector2 f; * * float fh = player.FOV / 2; * float v = player.viewDistance; * float theta = MathHelper.ToRadians (pmea.rotation.Y); * Double m; * Double xp; * Double zp; * Double s; * * s = Math.Sqrt (Math.Pow((2 * d.X - face.X), 2) + Math.Pow((2 * d.Y - face.Y), 2)); * a = new Vector2 ((float)(d.X - ((100 * (face.X - d.X)) / s)), (float)(d.Y - ((100 * (face.Y - d.Y)) / s))); * f = new Vector2 ((float)(d.X + ((v * (face.X - d.X)) / s)), (float)(d.Y + ((v * (face.Y - d.Y)) / s))); * * m = (v + 100) * Math.Tan (fh); * xp = m * Math.Sin (theta); * zp = m * Math.Cos (theta); * * b = new Vector2 ((float)(f.X + xp), (float)(f.Y - zp)); * c = new Vector2 ((float)(f.X - xp), (float)(f.Y + zp)); * * //"Rotate" points to standerd position * * Matrix rotationMatrix = new Matrix ((float)Math.Cos (theta), (float)-Math.Sin (theta), 0, 0, (float)Math.Sin (theta), (float)Math.Cos (theta), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); * * * //Get corner vertices for each chunk * * //Check if point is within triangle */ #endregion //"creates" a circle and loads the chunks within the circle //(x ^ 2) + (z ^ 2) = (d ^ 2) float xa = pmea.position.X; float za = pmea.position.Z; float d = player.viewDistance; List <Chunk> temp = new List <Chunk> (); foreach (Chunk c in world) { if ((Math.Pow(c.localPosition.X, 2) + Math.Pow(c.localPosition.Y, 2)) <= Math.Pow(d, 2)) { temp.Add(c); } } loadedWorld = new List <Chunk> (temp.Count); for (int i = 0; i < temp.Count; i++) { loadedWorld.Add(temp [i]); } temp = null; Console.WriteLine("loaded chunks updated"); } }
private void checkersLogic_PlayerMoveSet(object i_Sender, PlayerMoveEventArgs i_PlayerMoveEventArgsEventArgs) { bool computerPlayer = m_CheckersLogic.PlayerTurn.Type == Player.eType.Computer; m_GameForm.SetCheckMenAnimation(i_PlayerMoveEventArgsEventArgs.PlayerMove, computerPlayer); }
private void AttachToPlayer(object sender, PlayerMoveEventArgs args) { attachedPlayer = args.MovingPlayer; SittingDuck.UnsubscribeFromMovingIn(EnumFactory.All <StationLocation>().Where(station => station.IsOnShip()), AttachToPlayer); }
/// <summary> /// Handles <see cref="Player.MoveRequest"/> event of the players. /// </summary> /// <param name="sender">Event source.</param> /// <param name="e">A <see cref="PlayerMoveEventArgs"/> containing data about event.</param> public virtual void HandlePlayersMoveRequest(object sender, PlayerMoveEventArgs e) { MarkPointIfPossible(e.MyMove, State.GetMarkOfPlayer((Player)sender)); }
private static void KnockOutPlayer(object sender, PlayerMoveEventArgs args) { args.MovingPlayer.KnockOut(); }