public void NotifyTurn() { if (OnTurn != null) { OnTurn.Invoke(this, new TurnNotificationArgs(this)); } }
public void OnClickButton(string message) { if (message == "move") { if (OnAttack != null) { OnMove.Invoke(Actor); } } else if (message == "attack") { if (OnAttack != null) { OnAttack.Invoke(Actor); } } else if (message == "turn") { if (OnTurn != null) { OnTurn.Invoke(Actor); } } else if (message == "finish") { if (OnFinish != null) { OnFinish.Invoke(Actor); } } }
/// <summary> /// OnPlayerPlayChess回调 /// </summary> /// <param name="obj"></param> private void ChessBoard_OnPlayerPlayChess(Vector2Int index, ChessState chessState) { //TODO判定是否是否胜利 if (JudeWinOrContinue(index, chessState) == true) { Debug.Log(chessState + "Win"); if (OnWin != null) { OnWin.Invoke();//执行结束的事件 剔除棋盘格子的射线事件 } UIManager.Instance.chessState = chessState; UIManager.Instance.gameStatus = GameStatus.Over; return; } playerIndex++;//增加回合 #region 轮询逻辑 if (OnTurn != null) { OnTurn.Invoke(playerIndex);//暂停事件 } #endregion //TODO增加栈 来储存10步内的悔棋。 }
private void Update() { if (isStunned) { ChangeState(5); return; } if (isGrounded) { if (Mathf.Abs(movementAxes.x) > 0.1f) { ChangeState(1); } else if (Mathf.Abs(movementAxes.x) < 0.1f) { ChangeState(0); } } if (isOnLedge) { ChangeState(4); } if (!isOnLedge && !isWallSliding) { if (isFacingRight && movementAxes.x < -0.1f) { isFacingRight = false; OnTurn?.Invoke(); } if (!isFacingRight && movementAxes.x > 0.1f) { isFacingRight = true; OnTurn?.Invoke(); } } }
public void OnTurnAction() { OnTurn?.Invoke(this, new EventArgs()); }