public AvalibleActions GetAvalibleMoves(Hex hex) { if (hex != null) { avalibleHices.Clear(); avalibleEnemyHices.Clear(); var temp = GetAvalibleHices(hex, movePoints); temp.RemoveByHex(hex); return(new AvalibleActions(temp, avalibleEnemyHices)); } return(new AvalibleActions(null, null)); }
public void CancelEdit() { if (!_isEditing) { return; } Donated = _mDonated; CheckUpdates = _mCheckUpdates; CurrentLanguage = _mCurrentLanguage; Delimiters = _mDelimiters; Tasks.Clear(); foreach (Task task in _mTtasks) { Tasks.Add(task); task.CancelEdit(); } Profiles.Clear(); foreach (Profile profile in _mProfiles) { Profiles.Add(profile); profile.CancelEdit(); } MoveList.Clear(); foreach (PositionTransform positionTransform in _mMoveList) { MoveList.Add(positionTransform); positionTransform.CancelEdit(); } CopyList.Clear(); foreach (PositionTransform positionTransform in _mCopyList) { CopyList.Add(positionTransform); positionTransform.CancelEdit(); } Languages.Clear(); foreach (Language language in _mLanguages) { Languages.Add(language); language.CancelEdit(); } _mProfiles.Clear(); _mMoveList.Clear(); _mCopyList.Clear(); _mLanguages.Clear(); _mTtasks.Clear(); _isEditing = false; }
public void NewGame(SColor us) { Position.SetHirate(); SetBoard(us); MyColor = us; Winner = SColor.NB; CurrentValue = 0; MoveList.Clear(); MouseControl.State = MouseStateEnum.None; ScreenControl.Clear(); ScreenControl.Interactable(MyColor == SColor.NB, false); }
/// <summary> /// Reset the control so it represents the specified chessboard /// </summary> /// <param name="chessBoard"> Chess board. Starting one if null</param> public void Reset(ChessBoard chessBoard) { int iCurPos; int iCount; MoveList.Clear(); m_chessBoard = chessBoard; iCurPos = chessBoard.MovePosStack.PositionInList; iCount = chessBoard.MovePosStack.Count; chessBoard.UndoAllMoves(); for (int iIndex = 0; iIndex < iCount; iIndex++) { chessBoard.RedoMove(); AddCurrentMove(); } SelectCurrentMove(); }
public void Move() { if (!Owner.IsMobile) { return; } MoveList.Clear(); m_localCells.Clear(); try { if (Owner.CurrentCell == null) { Utils.Log("CurrentCell is null in Creature.Move for " + Owner.ToString(), Utils.LogType.Unknown); } List <Cell> cList = Map.GetAdjacentCells(Owner.CurrentCell, Owner); if (cList != null) { Utilities.Dice dice = new DragonsSpine.Utilities.Dice(1, cList.Count); int rand = dice.Roll() - 1; Cell nCell = (Cell)cList[rand]; AIGotoXYZ(nCell.X, nCell.Y, nCell.Z); } } catch (Exception e) { Utils.Log("Error on Brain.Move()", Utils.LogType.Unknown); Utils.LogException(e); return; } return; }
public override void Update() { base.Update(); oldLocation.Copy(GetLocation()); oldVelocity.Copy(GetVelocity()); oldRotation.Copy(GetRotation()); //are you controlled by a player? //if so, is there a move we haven't processed yet? if (mActorControlType == EActorControlType.ESCT_Human) { if (mClient != null) { MoveList moveList = mClient.GetUnprocessedMoveList(); foreach (var unprocessedMove in moveList.mMoves) { var currentState = unprocessedMove.GetInputState(); float deltaTime = unprocessedMove.GetDeltaTime(); ProcessInput(deltaTime, currentState); // 서버만 y 축 좌표를 업데이트한다. 서버에서는 물리 연산이 없으므로 if (currentState.mIsChangeY) { // todo : y 좌표값 변경 허가 여부 체크 // raycast를 사용하여 위, 아래 // up 근처에 경사로가 있는지 // down 낙하 지점인지 GetLocation().y = currentState.mYaxis; } SimulateMovement(deltaTime); //log.InfoFormat( "Server Move Time: {0} deltaTime: {1} location:{2}, old_location{3}, player_id{4}", unprocessedMove.GetTimestamp(), deltaTime, GetLocation(), oldLocation, GetPlayerId() ); //Log.Information("Location:" + GetLocation() + ", Velocity:" + GetVelocity() + ", player_id:" + GetPlayerId()); } moveList.Clear(); } } else { //do some AI stuff SimulateMovement(Timing.sInstance.GetDeltaTime()); } HandleShooting(); HandleBomb(); #if _USE_BEPU_PHYSICS mCharacterController.Body.Position = GetLocation().CopyTo(ref physicsLocation); mDirection.CopyTo(ref mCharacterController.HorizontalMotionConstraint.LastDirection); if (mCharacterController.HorizontalMotionConstraint.MovementMode != BEPUphysics.Character.MovementMode.Floating) { if (GetVelocity().IsZero() == false) { mCharacterController.Body.LinearVelocity = GetVelocity().CopyTo(ref physicsVelocity); } } #endif if (!oldLocation.Equals(GetLocation()) || !oldVelocity.Equals(GetVelocity()) || !oldRotation.Equals(GetRotation()) ) { //log.InfoFormat("ol {0} cl {1} ov {2} cv {3} or{4} cr{5}", oldLocation, GetLocation(), oldVelocity, GetVelocity(), oldRotation, GetRotation()); NetworkManagerServer.sInstance.SetStateDirty(GetNetworkId(), WorldId, (uint)EActorReplicationState.ECRS_Pose); } }
void UpdateMove() { MoveList moveList = mActorController.GetUnprocessedMoveList(); foreach (var unprocessedMove in moveList.mMoves) { if (IsIgnoreInput) { break; } var currentState = unprocessedMove.GetInputState(); float deltaTime = unprocessedMove.GetDeltaTime(); ProcessInput(deltaTime, currentState); #if !_USE_BEPU_PHYSICS && !_USE_BULLET_SHARP // CHANGE_Y_AXIS_CLIENT // 서버만 y 축 좌표를 업데이트한다. 서버에서는 물리 연산이 없으므로 if (currentState.mIsChangeY) { //Log.Information($"changeY {GetPlayerId()}, {GetNetworkId()}, y{currentState.mYaxis}"); // todo : y 좌표값 변경 허가 여부 체크 // raycast를 사용하여 위, 아래 // up 근처에 경사로가 있는지 // down 낙하 지점인지 GetLocation().y = currentState.mYaxis; if (currentState.mYaxis < World.Map.DieFall) { Log.Information($"died from falling out {GetNetworkId()}, y{currentState.mYaxis}"); TakeDamage((int)ReservedPlayerId.Fall, int.MaxValue); } SetFloor(GetLocation().y); } #endif // 최대 델타 타임 초과시 쪼개서 여러번 시뮬레이션 한다. // 벽을 뚫고 가지 않도록 하기 위함 while (true) { if (MaxDeltaTime < deltaTime) { SimulateMovement(deltaTime); break; } else { SimulateMovement(MaxDeltaTime); deltaTime -= MaxDeltaTime; } } //log.InfoFormat( "Server Move Time: {0} deltaTime: {1} location:{2}, old_location{3}, player_id{4}", unprocessedMove.GetTimestamp(), deltaTime, GetLocation(), oldLocation, GetPlayerId() ); //Log.Information("Location:" + GetLocation() + ", Velocity:" + GetVelocity() + ", player_id:" + GetPlayerId()); #if MOVEMENT_DEBUG debug_x += GetLocation().x - oldLocation.x; debug_delta += deltaTime; debug_cnt += 1; Log.Information($"Location x{GetLocation().x}, debug_x{debug_x}, debug_delta{debug_delta}, debug_cnt{debug_cnt}, debugSeq{currentState.mDebugSeq}, timestamp{unprocessedMove.GetTimestamp()}"); #endif } IsIgnoreInput = false; moveList.Clear(); }