// Update is called once per frame void Update() { switch (m_ProcessingTurn) { case TurnType.OrderPlayer: // プレイヤーを一定の条件でシャッフルする m_ProcessingTurn = TurnType.SelectCard; break; case TurnType.SelectCard: // どのカードでゲーム開始を行うか foreach (var cardData in m_DatabaseController.SelectCardMaster()) { var cardBuilder = new CardBuilder(); var card = cardBuilder.CreateCard(cardData); m_Supply.AddSupply(card); } m_ProcessingTurn = TurnType.PlayerTurn; break; case TurnType.PlayerTurn: // ゲーム開始を行う // プレイヤーがターン終了するまで他のプレイヤーは待機 Player nowPlayer = m_PlayerList[0]; break; } }
public KnowExpression(string expression, ushort indexer, bool isReverse, TurnType turnType) { Expression = expression; Indexer = indexer; IsReverse = isReverse; TurnType = turnType; }
/// <summary> /// Sets new turn. /// Saves the current player block and disables its controller. /// Restores the next-player's block and enables its controller. /// Activates the corresponding icon. /// If next turn if Result, deactivates both controllers. /// </summary> public void SetTurn(TurnType turn) { CurrentTurn = turn; controllerManager.SetCurrentController(turn); if (turn == TurnType.FIRST) { boardManager.SavePlayerBlock(TurnType.SECOND); controllerManager.DisableController(TurnType.SECOND); boardManager.SetPlayerBlockActive(TurnType.FIRST); controllerManager.EnableController(TurnType.FIRST); secondIcon.SetActive(false); firstIcon.SetActive(true); } else if (turn == TurnType.SECOND) { boardManager.SavePlayerBlock(TurnType.FIRST); controllerManager.EnableController(TurnType.SECOND); boardManager.SetPlayerBlockActive(TurnType.SECOND); controllerManager.DisableController(TurnType.FIRST); secondIcon.SetActive(true); firstIcon.SetActive(false); } else if (turn == TurnType.RESULT) { controllerManager.DeactivateAll(); } }
public void InitiatePack(List <GameObject> cards) { if (isMyTurn) { if (turnType == TurnType.none || turnType == TurnType.pick) { if (cards.Count > 0) { packInitiator.InitiatePack(cards); // if(!firstCheckDone) // turnType = TurnType.through; // else{ // turnType = TurnType.throughtorshow; // } turnType = TurnType.throughtorshow; } } else { if (!showChangeTurn) { dialog = "Cant pick card,\n" + turnType.ToString() + " one card to pick"; } else { dialog = "Cant Pick card,\n" + " Press Change Turn Button"; } UIEventHandler.Ins.OpenMenu("PickCardNotification"); UIEventHandler.Ins.pickNotificationText.text = dialog; //showDialogBox = true; } } }
public void CalculateScore(int destroyNum, TurnType turntype) { switch (turntype) { case TurnType.Aturn: if (destroyNum < 7) { score += 5 * destroyNum * destroyNum * MULTIPLE; } else { score += 7 * destroyNum * destroyNum * MULTIPLE; } break; case TurnType.Bturn: if (destroyNum < 7) { Bscore += 5 * destroyNum * destroyNum * MULTIPLE; } else { Bscore += 7 * destroyNum * destroyNum * MULTIPLE; } break; } }
private void TeleportToPoint() { int index = currentPoint.BoardModel.BoardNumber; TeleportModel teleportModel = teleporter.Teleports.FindTeleportByTrigger(index); Vector2 playerPosition = transform.position; Vector2 startPosition = boardManagerPosition + playerPosition; Vector2 nextPosition = boardManagerPosition + teleportModel.BoardPoint.finalPoint.BoardPosition; Vector3 vectorDirection = nextPosition - startPosition; vectorDirection.Normalize(); if (Vector2.Distance(transform.position, nextPosition) > stoppedDistance) { transform.position += vectorDirection * speed * Time.deltaTime; } else { currentPoint = teleportModel.BoardPoint.finalPoint; nextPoint = NextBoardPosition(); numberOfMove = 0; diceNumber = 0; turnType = TurnType.Wating; CallFinishMoveDelegate(); } }
public void SendCommand(MoveType move, TurnType turn) { if (!Connected) { return; } string command = ""; if (move == MoveType.Accelerate) { command += "a"; } else if (move == MoveType.Brake) { command += "b"; } if (turn == TurnType.Left || turn == TurnType.HardLeft) { command += "l"; } else if (turn == TurnType.Right || turn == TurnType.HardRight) { command += "r"; } command += ";"; SendMessage(command); }
void UpdateBrakingForIntersection(Collider other) { try { IntersectionLightSingleton intersection = other.transform.gameObject.GetComponentInChildren <IntersectionLightSingleton>(); TargetNavigation tv = GetComponent <TargetNavigation>(); TurnType turnType = tv.CurrentTrajectory.Turn; IntersectionRoad road = tv.CurrentTrajectory.Road; LightPhase phase = (road == IntersectionRoad.Road1) ? intersection.phase.road1 : intersection.phase.road2; switch (phase) { case LightPhase.Green: _brakingForRedLight = false; break; case LightPhase.Yellow: _brakingForRedLight = true; break; case LightPhase.Red: _brakingForRedLight = true; break; } Debug.Log("Vehicle performing " + turnType.ToString() + " movement on " + road.ToString() + " has entered IntersectionInteriorVolume when light is " + phase.ToString()); } catch (NullReferenceException ex) { Debug.Log(ex.Message); } return; }
public void RemoveTurnType(int Id) { TurnType temp = context.TurnTypes.SingleOrDefault(t => t.Id == Id); context.TurnTypes.Remove(temp); context.SaveChanges(); }
public TurnResp(bool success, PlayerColor currentPlayer, TurnType type) : base(MessageType.Info) { this.turnType = type; this.success = success; this.player = currentPlayer; }
public static MatchSettings CreateSettingsWithHost(Mode mode = Mode.OneUp, TurnType type = TurnType.Classic) { var settings = CreateSettings(mode, type); settings.Host = UserMockCreator.CreateHost(); return(settings); }
/// <summary> /// Collects input from user for passive turn, ensures legality, then executes move. /// Also updates Turn properties to reflect upcoming aggressive turn. /// </summary> private void ExecutePassiveTurn() { while (!PassiveTurnDone) { while (!GetUserInputForTurn()) { CurrentGame.Refresh(); } if (MoveLogic.MoveIsLegal(this.CurrentMove)) { ExecuteCurrentMove(this.CurrentMove); CurrentPlayer.LastMoveMade = CurrentMove; TurnIsPassive = false; PassiveTurnDone = true; this.currentTurnType = TurnType.Aggressive; } else { Console.WriteLine(MoveLogic.PrintErrorMessage(this.CurrentMove) + " Press enter to continue..."); Console.ReadLine(); PassiveTurnDone = false; } CurrentGame.Refresh(); } }
public static MatchSettings CreateSettings(Mode mode = Mode.OneUp, TurnType type = TurnType.Classic) => new MatchSettings { Mode = mode, TurnType = type, TurnTime = 1, };
const int Turn_Manual_Down = 493; //D-1 //手动转动 public static void Turn(TurnType fx) { int adr = 0; switch (fx) { case TurnType.Up: adr = Turn_Manual_Up; break; case TurnType.Down: adr = Turn_Manual_Down; break; } string send = ""; string response = ""; if (fx == TurnType.Stop) { send = RegDMW + GetAdrD_1000(Turn_Manual_Up) + "000204" + "00000000"; } else { send = RegDSW + GetAdrD_1000(adr) + "0001"; } SendPLC(send, "手动转动", out response); }
/*public override void LateJoinGame(NetworkReader messageReader) * { * // TODO * }*/ protected override void OnStartTurn(TBPlayer player) { if (tt != TurnType.None) { Log.Warn("Unexpected TurnType {0} (A)", tt); } int role = player.GetRole(); var turtles = Match.GetTurtlesForRole(role); var aliveTurtles = turtles.FindAll(t => !t.dead); if (/*turtles == null || */ aliveTurtles.Count == 0) { Log.Warn("No alive turtles with role {0}", role); tt = TurnType.Wait; turnEnded = false; StartCoroutine(EndTurnDelayed()); return; } tt = TurnType.Keyboard; targetTurtle = GetNextTurtle(aliveTurtles); targetTurtle.SetPlaying(true); }
public void CreatesOneUp_WhenModeSetToOneUp(Mode mode, TurnType type) { var match = MatchMockCreator.CreateSettingsWithHost(mode, type) .CreateMatch(); Assert.Equal(mode, match.Mode); }
public void ShowTurn(TurnType current, float time) { turnText.text = current.ToString(); float widthScale; switch (current) { case TurnType.MovePiece: turnTime = 0; widthScale = 1 - time / GameManager.inst.turnSystem.turnTimers[current]; turnImage.color = new Color(0, 1, 0.5f); break; case TurnType.Attack: case TurnType.AttackReady: turnTime = turnTime > 1 ? time + 1 : time; widthScale = turnTime * 0.5f; turnImage.color = Color.red; break; default: Debug.LogError("[ERR-ShowTurn] default called"); widthScale = 1; break; } turnImage.fillAmount = widthScale; }
List <PanelAreaType> GetReachPanelAreaTypeList(TurnType turnType) { var area1 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area1); var area2 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area2); var area3 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area3); var area4 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area4); var area5 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area5); var area6 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area6); var area7 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area7); var area8 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area8); var area9 = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == PanelAreaType.Area9); List <PanelAreaType> reachPanelAreaTypeList = new List <PanelAreaType>(); // Vertical addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area1, area2, area3); addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area4, area5, area6); addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area7, area8, area9); // Horizontal addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area1, area4, area7); addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area2, area5, area8); addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area3, area6, area9); // Diagonal addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area1, area5, area9); addPanelAreaTypeWhenReach(reachPanelAreaTypeList, turnType, area3, area5, area7); return(reachPanelAreaTypeList); }
public TurnResp(ErrorCode errorCode, PlayerColor currentPlayer, TurnType type) : base(MessageType.Info) { this.turnType = type; this.success = false; this.errorCode = errorCode; this.player = currentPlayer; }
AgentActionType GetTurnedHeading() { turnIndex += 1; turnIndex %= turnPatternLength; TurnType turn = turnPattern[turnIndex]; return(Agent.Turn(heading, turn)); }
public void ReplaceTurn(TurnType newType) { var index = GameComponentsLookup.Turn; var component = CreateComponent <TurnComponent>(index); component.type = newType; ReplaceComponent(index, component); }
protected override bool TurnIsOn() { if (tt == TurnType.Wait) { if (turnEnded) { tt = TurnType.None; return(false); } else { return(true); } } else if (tt != TurnType.Keyboard) { Log.Warn("Unexpected TurnType {0} (A)", tt); return(false); } if (Time.frameCount % FrameStep == 0) { SendToServer(MsgType.ClientUpdate, Match.GetState()); } if (targetTurtle.dead) { tt = TurnType.None; return(false); } float hor = Input.GetAxis("Horizontal"); float fire3 = Input.GetAxis("Fire3"); if (hor > 0) { targetTurtle.AddTorque(-torque); } else if (hor < 0) { targetTurtle.AddTorque(+torque); } if (fire3 > 0) { targetTurtle.SetPlaying(false); tt = TurnType.None; return(false); } foreach (var t in Match.GetAllTurtles()) { t.SetDead(t.transform.position.y < -1.5f); } return(true); }
// unfortunately this doesn't work out public void DoShortTurn(TurnType direction, double time) { //DoTurn(direction); // m_spinTime += time; //Stopwatch s = Stopwatch.StartNew(); //while (s.Elapsed.TotalMilliseconds < time + m_msPadding) ; // spin DoTurn(TurnType.Straight); m_pendingTurn = TurnType.Straight; }
private void OnPlayerTurnEnded(TurnType turnType, int amount) { Debug.Log("OnPlayerTurnEnded"); if (turnType == TurnType.Invalid) { Debug.Log("OnPlayerTurnEnded: invalid turn type."); return; } if (turnType == TurnType.Fold) { CurrentHand.RemovePlayer(CurrentPlayer); } else if (turnType == TurnType.Call) { PutChipsToPot(CurrentPlayer, amount); GameController.Instance.UpdatePlayerCard(CurrentPlayerIndex, CurrentPlayer); GameController.Instance.UpdatePotSizeTexts(CurrentHand.Pots); } else if (turnType == TurnType.Raise) { PutChipsToPot(CurrentPlayer, amount); GameController.Instance.UpdatePlayerCard(CurrentPlayerIndex, CurrentPlayer); GameController.Instance.UpdatePotSizeTexts(CurrentHand.Pots); } else if (turnType == TurnType.Bet) { PutChipsToPot(CurrentPlayer, amount); GameController.Instance.UpdatePlayerCard(CurrentPlayerIndex, CurrentPlayer); GameController.Instance.UpdatePotSizeTexts(CurrentHand.Pots); } else if (turnType == TurnType.Check) { // TODO } CurrentPlayer.LastTurn = turnType; GameController.Instance.HighlightActivePlayer(false); GameController.Instance.StopTurnTimer(); if (!HandHasWinner(CurrentHand)) { if (NeedToDealNextStreet()) { DealNextStreet(); } else { PlayTurn(); } } else { EndHand(CurrentHand); } }
public void MakeTurn(Point coordinates, TurnType turnType) { if (coordinates.X > _gameBoardSize || coordinates.Y > _gameBoardSize) { throw new IndexOutOfRangeException("Coordinats are out of range"); } GameMap[coordinates.X][coordinates.Y] = (int)turnType; }
public void StartBombardmentTurn() { turnType = TurnType.bombardment; UI_Manager.instance.boatPanel.SetUpBoatUI(); UI_Manager.instance.timelinePanel.NextIconTurn(); BombardmentManager.Instance.StartBombardment(); }
// This routine is used to get the graphics path for the page under the current page and the page on the // backside of the turning page. It will return either a triangle or trapezoid graphics path. private GraphicsPath GetPageUnderGraphicsPath(int x, ref double a, int height, int width, bool isUnderSide, TurnType type) { double radians; double calculated_x; double calculated_y = 0d; int undersideOffset = 0; GraphicsPath gp = new GraphicsPath(); if ((type == TurnType.RightPageTurn && isUnderSide) || (type == TurnType.LeftPageTurn && !isUnderSide)) { undersideOffset = width; } // This is the angle formed at the bottom of the rectangle just under the line of symmetry a = 45d + ((45d * x) / width); radians = a * (Math.PI / 180); // convert to radians for the math function if (isPathTrapezoid == false) { calculated_y = (x) * (Math.Tan(radians)); if (calculated_y > height) { isPathTrapezoid = true; } } if (isPathTrapezoid == true) { gp.AddLine(new PointF(Math.Abs(width - x - undersideOffset), height), new PointF(width - undersideOffset, height)); gp.AddLine(new PointF(width - undersideOffset, height), new PointF(width - undersideOffset, 0)); calculated_x = height / Math.Tan(radians); // This adds a line to the top of the trapezoid, this is the distance in the horizontal direction // that the line of symmetry has traveled. gp.AddLine(new Point(width - undersideOffset, 0), new PointF(Math.Abs(width - (x - (float)calculated_x) - undersideOffset), 0)); gp.CloseFigure(); } else { // Still a triangle calculated_y = (x) * (Math.Tan(radians)); gp.AddLine(new PointF(Math.Abs(width - x - undersideOffset), height), new PointF(width - undersideOffset, height)); gp.AddLine(new PointF(width - undersideOffset, height), new PointF(width - undersideOffset, (height - (float)calculated_y))); gp.CloseFigure(); } return(gp); }
public void Input(TurnType value) { foreach (var binding in bindings) { if (binding.id == value) { Output.Invoke(GetDirection(binding)); } } }
public void Roll() { var player = Players[CurrentPlayerIndex]; player.Roll(); AddText("你投出了" + player.Movement.Vatality); AddText("选择一个单位行动吧!"); CurrentTurn = TurnType.WaitForMove; SwithButtons(CurrentTurn);//总是在更新内在内容后更新外在表现 }
void ExtraAI() { if (currentNode != null) { Node node = currentNode.gameObject.GetComponent <Node>(); if (node != null) { forwardSpeed = node.SpeedLimit; } } if (nextNode.GetComponent <WaysControl>() && !isTurning) { isTurning = true; oldDir = transform.forward; nextWay = RandomWay(nextNode, currentNode); Vector3 dir1 = nextNode.position - currentNode.position; Vector3 dir2 = nextWay.position - nextNode.position; dir1.y = 0; dir2.y = 0; if (Vector3.Angle(dir1, dir2) > 20) { float turn = Vector3.Cross(dir1, dir2).y; nextTurn = (turn > 0) ? TurnType.Right : TurnType.Left; } else { nextTurn = TurnType.Straight; } } if (isTurning) { leftIndicator.SetActive(nextTurn == TurnType.Left); rightIndicator.SetActive(nextTurn == TurnType.Right); if (nextTurn == TurnType.Straight) { isTurning = currentNode.GetComponent <Node>(); } else { diff = Vector3.Angle(oldDir, transform.forward); if (diff > 42) { isTurning = false; } } } else { leftIndicator.SetActive(false); rightIndicator.SetActive(false); } }
public void HandlePacket(Byte[] buf, int nStreamLength) { remains.ForcedEncode(buf, nStreamLength); while (true) { if (_curTurn == TurnType.HEADER) { if (remains.GetRemainLength() < kHEADER_LENGTH) { break; } else { String type = remains.DecodeString(8); String bodyLength = remains.DecodeString(8); String packetID = remains.DecodeString(8); SetCurPacketTypeAndBodyLength(type, bodyLength, packetID); _curTurn = TurnType.BODY; } } if (_curTurn == TurnType.BODY) { if (remains.GetRemainLength() >= _curBodyLength) { String pbPacket = remains.DecodeString(_curBodyLength); if (_curPacketType == TossPacketType.HTS) { KBHTSTossClient.Ins().HandlePacket(_curPacketID, pbPacket); } else { logger.Error("예상하지 못한 패킷타입 ({0})", _curPacketType); Util.KillWithNotice("Unexpected packet type"); } _curTurn = TurnType.HEADER; } else { break; } } } remains.AdvancePivot(); remains.Shrimp(); }
public MapCell.FlowDirectionType TurnFlow(MapCell.FlowDirectionType type, TurnType turn) { switch (type) { case MapCell.FlowDirectionType.North: return turn == TurnType.Right ? MapCell.FlowDirectionType.NorthEast : MapCell.FlowDirectionType.NorthWest; case MapCell.FlowDirectionType.NorthEast: return turn == TurnType.Right ? MapCell.FlowDirectionType.SouthEast : MapCell.FlowDirectionType.North; case MapCell.FlowDirectionType.SouthEast: return turn == TurnType.Right ? MapCell.FlowDirectionType.South : MapCell.FlowDirectionType.NorthEast; case MapCell.FlowDirectionType.South: return turn == TurnType.Right ? MapCell.FlowDirectionType.SouthWest : MapCell.FlowDirectionType.SouthEast; case MapCell.FlowDirectionType.SouthWest: return turn == TurnType.Right ? MapCell.FlowDirectionType.NorthWest : MapCell.FlowDirectionType.South; case MapCell.FlowDirectionType.NorthWest: return turn == TurnType.Right ? MapCell.FlowDirectionType.North : MapCell.FlowDirectionType.SouthWest; } return MapCell.FlowDirectionType.NoFlowdirection; }
private void NotifyOnTurnChanged(TurnType _currentTurn) { if (OnTurnChanged != null) { OnTurnChanged(_currentTurn); } }
private void RotateCubeByZAxis(TurnType type) { Dictionary<CubeFace, CubeFaceType> newCube = new Dictionary<CubeFace, CubeFaceType>(); if (type.Equals(TurnType.HalfTurnRight)) { newCube.Add(this[CubeFaceType.F], CubeFaceType.L); newCube.Add(this[CubeFaceType.L], CubeFaceType.B); newCube.Add(this[CubeFaceType.B], CubeFaceType.R); newCube.Add(this[CubeFaceType.R], CubeFaceType.F); newCube.Add(this[CubeFaceType.U], CubeFaceType.U); newCube.Add(this[CubeFaceType.D], CubeFaceType.D); } else if (type.Equals(TurnType.HalfTurnLeft)) { newCube.Add(this[CubeFaceType.F], CubeFaceType.R); newCube.Add(this[CubeFaceType.R], CubeFaceType.B); newCube.Add(this[CubeFaceType.B], CubeFaceType.L); newCube.Add(this[CubeFaceType.L], CubeFaceType.F); newCube.Add(this[CubeFaceType.U], CubeFaceType.U); newCube.Add(this[CubeFaceType.D], CubeFaceType.D); } else { newCube.Add(this[CubeFaceType.F], CubeFaceType.B); newCube.Add(this[CubeFaceType.L], CubeFaceType.R); newCube.Add(this[CubeFaceType.B], CubeFaceType.F); newCube.Add(this[CubeFaceType.R], CubeFaceType.L); newCube.Add(this[CubeFaceType.U], CubeFaceType.U); newCube.Add(this[CubeFaceType.D], CubeFaceType.D); } CubeMap.Clear(); CubeMap = newCube; }
public GameflowModel() { m_lastNotifiedTime = 0; m_currentTurn = TurnType.Pc; }
public NeatAiTurnChoice(double weight, int index, TurnType turnType) { Weight = weight; Index = index; TurnType = turnType; }
/// <summary> /// Alimenta as variáveis de direção para movimentar, pular e as variáveis de animação /// </summary> private void Setup() { //animation.wrapMode = WrapMode.Loop; //animation["AxeSlash"].layer = 1; //animation["AxeSlash"].wrapMode = WrapMode.Once; //animation.Play("CombatStance"); this._currentDirection = DirectionType.NONE; this._jumping = false; this._run = false; this._currentTurn = TurnType.NONE; this._currentState = State.RUN; }
public void ToogleTurn() { m_currentTurn = (m_currentTurn == TurnType.Pc) ? TurnType.Player : TurnType.Pc; NotifyOnTurnChanged(m_currentTurn); }
public void CheckDashboard() { print("checking dashboard"); int points = 0; bool isSequenceCorrect = true; bool lessThanThreePairCards = false; int lessThanThreePairCardsCount = 0; if (!firstCheckDone) { print("frist check"); for (int i = 0; i < dashBoardCardHolder.Count; i++) { dashBoardCardHolder[i].doNotCheckforsequence = true; if (dashBoardCardHolder[i].cardsPositionPoints.Count >= 3) { bool numberCheck = true; bool sequenceCheck = true; int number = dashBoardCardHolder[i].cardsPositionPoints[0].cards.number; List<string> cardNames = new List<string>(); List<string> tempCardNames = new List<string>(); int tempPoints = number; cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[0].cards.cardName); for (int j = 1; j < dashBoardCardHolder[i].cardsPositionPoints.Count; j++) { if (dashBoardCardHolder[i].cardsPositionPoints[j].cards.number == number) { tempPoints += number; cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[j].cards.cardName); } else { print("no number match"); numberCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; break; } } for (int a = 0; a < cardNames.Count; a++) { if (!ExistInNameList(tempCardNames, cardNames[a])) { tempCardNames.Add(cardNames[a]); } else { print("same color card twice"); numberCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; break; } } if (numberCheck) { points += tempPoints; print("number match found points = " + points); } else { isSequenceCorrect = true; dashBoardCardHolder[i].doNotCheckforsequence = true; ArrangeCardsByNumber(); number = dashBoardCardHolder[i].cardsPositionPoints[0].cards.number; cardNames.Clear(); cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[0].cards.cardName); for (int j = 1; j < dashBoardCardHolder[i].cardsPositionPoints.Count; j++) { if ((dashBoardCardHolder[i].cardsPositionPoints[j].cards.number - number) == 1) { number = dashBoardCardHolder[i].cardsPositionPoints[j].cards.number; tempPoints += number; cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[j].cards.cardName); } else { print("no color match"); sequenceCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; break; } } if (!AreAllElementsSame(cardNames, cardNames[0])) { print("different color card found , no sequence match"); sequenceCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; } if (sequenceCheck) { points += tempPoints; print("sequence match found points = " + points); } } } else if (dashBoardCardHolder[i].cardsPositionPoints.Count < 3) { print("count less than 3 in i = " + i); lessThanThreePairCards = true; lessThanThreePairCardsCount++; //if(lessThanThreePairCardsCount > 2 || packInitiator.cardsPositionPoints.Count > 0) //dashBoardCardHolder[i].doNotCheckforsequence = false; } } if (points >= 51 && isSequenceCorrect) { if (lessThanThreePairCards && lessThanThreePairCardsCount <= 2) { if (packInitiator.cardsPositionPointsList.Count <= 2) { print("count less than 3 packInitiator.cardsPositionPoints.Count <= 0"); turnType = TurnType.none; UIEventHandler.Ins.OpenMenu("GameOverNotification"); GameManager.Ins.showGameFinish = true; } else { print("count less than 3 packInitiator.cardsPositionPoints.Count > 0"); turnType = TurnType.none; GameManager.Ins.ChangeTurn(); firstCheckDone = true; } } else { if (lessThanThreePairCardsCount > 2) { print("lessThanThreePairCardsCount > 2"); //dashBoardCardHolder[i].doNotCheckforsequence = false; canTouch = false; showFalseCombinationMenu = true; UIEventHandler.Ins.OpenMenu("WronOrderNotification"); UIEventHandler.Ins.arrangementIssueText.text = "You should arrange cards properly, and atleast have 51 points"; } else { if (packInitiator.cardsPositionPointsList.Count <= 2) { print("gameover"); UIEventHandler.Ins.OpenMenu("GameOverNotification"); //dashBoardCardHolder[i].doNotCheckforsequence = true; turnType = TurnType.none; GameManager.Ins.ChangeTurn(); firstCheckDone = true; } else { print("count less than 3 packInitiator.cardsPositionPoints.Count > 0"); turnType = TurnType.none; GameManager.Ins.ChangeTurn(); firstCheckDone = true; } } } } else { //dashBoardCardHolder[i].doNotCheckforsequence = false; for (int i = 0; i < dashBoardCardHolder.Count; i++) dashBoardCardHolder[i].doNotCheckforsequence = false; canTouch = false; showFalseCombinationMenu = true; UIEventHandler.Ins.OpenMenu("WronOrderNotification"); UIEventHandler.Ins.arrangementIssueText.text = "You should arrange cards properly, and atleast have 51 points"; } } else { for (int i = 0; i < dashBoardCardHolder.Count; i++) { dashBoardCardHolder[i].doNotCheckforsequence = true; if (dashBoardCardHolder[i].cardsPositionPoints.Count >= 3) { bool numberCheck = true; bool sequenceCheck = true; int number = dashBoardCardHolder[i].cardsPositionPoints[0].cards.number; List<string> cardNames = new List<string>(); List<string> tempCardNames = new List<string>(); cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[0].cards.cardName); for (int j = 1; j < dashBoardCardHolder[i].cardsPositionPoints.Count; j++) { if (dashBoardCardHolder[i].cardsPositionPoints[j].cards.number == number) { cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[j].cards.cardName); } else { //print ("no number match"); numberCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; break; } } for (int a = 0; a < cardNames.Count; a++) { if (!ExistInNameList(tempCardNames, cardNames[a])) { tempCardNames.Add(cardNames[a]); } else { //print("same color card twice"); numberCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; break; } } if (numberCheck) { //print ("number match found points = "+points); } else { isSequenceCorrect = true; dashBoardCardHolder[i].doNotCheckforsequence = true; ArrangeCardsByNumber(); number = dashBoardCardHolder[i].cardsPositionPoints[0].cards.number; cardNames.Clear(); cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[0].cards.cardName); for (int j = 1; j < dashBoardCardHolder[i].cardsPositionPoints.Count; j++) { if ((dashBoardCardHolder[i].cardsPositionPoints[j].cards.number - number) == 1) { number = dashBoardCardHolder[i].cardsPositionPoints[j].cards.number; cardNames.Add(dashBoardCardHolder[i].cardsPositionPoints[j].cards.cardName); } else { //print ("no color match"); sequenceCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; break; } } if (!AreAllElementsSame(cardNames, cardNames[0])) { //print("different color card found , no sequence match"); sequenceCheck = false; isSequenceCorrect = false; dashBoardCardHolder[i].doNotCheckforsequence = false; } if (sequenceCheck) { //print ("sequence match found points = "+points); } } } else if (dashBoardCardHolder[i].cardsPositionPoints.Count < 3) { print("count less than 3 in i = " + i); //showFalseCombinationMenu = true; lessThanThreePairCards = true; lessThanThreePairCardsCount++; if (lessThanThreePairCardsCount > 2) dashBoardCardHolder[i].doNotCheckforsequence = false; } } if (isSequenceCorrect) { //print ("seq correct "); if (lessThanThreePairCards && lessThanThreePairCardsCount <= 2) { //dashBoardCardHolder[i].doNotCheckforsequence = true; if (packInitiator.cardsPositionPointsList.Count <= 0) { //print ("count less than 3 packInitiator.cardsPositionPoints.Count <= 0"); turnType = TurnType.none; //GameManager.Ins.showGameFinish = true; UIEventHandler.Ins.OpenMenu("GameOverNotification"); GameManager.Ins.ShowGameOverGUI(); } else { //print ("count less than 3 packInitiator.cardsPositionPoints.Count >= 0"); if (packInitiator.cardsPositionPointsList.Count <= 2) { UIEventHandler.Ins.OpenMenu("GameOverNotification"); turnType = TurnType.none; GameManager.Ins.ChangeTurn(); } else { print("count less than 3 packInitiator.cardsPositionPoints.Count > 0"); turnType = TurnType.none; GameManager.Ins.ChangeTurn(); firstCheckDone = true; } } } else { if (lessThanThreePairCardsCount > 2) { print("greaterThanThreePairCardsCount > 2"); //dashBoardCardHolder[i].doNotCheckforsequence = false; canTouch = false; showFalseCombinationMenu = true; UIEventHandler.Ins.OpenMenu("WronOrderNotification"); UIEventHandler.Ins.arrangementIssueText.text = "You should arrange cards properly"; } else { if (packInitiator.cardsPositionPointsList.Count <= 2) { print("gameover"); UIEventHandler.Ins.OpenMenu("GameOverNotification"); //dashBoardCardHolder[i].doNotCheckforsequence = true; turnType = TurnType.none; GameManager.Ins.ChangeTurn(); firstCheckDone = true; } else { print("count less than 3 packInitiator.cardsPositionPoints.Count > 0"); turnType = TurnType.none; GameManager.Ins.ChangeTurn(); firstCheckDone = true; } } } } else { //dashBoardCardHolder[i].doNotCheckforsequence = false; canTouch = false; showFalseCombinationMenu = true; UIEventHandler.Ins.OpenMenu("WronOrderNotification"); UIEventHandler.Ins.arrangementIssueText.text = "You should arrange cards properly"; } } }
public void InitiatePack(List<GameObject> cards) { if (isMyTurn) { if (turnType == TurnType.none || turnType == TurnType.pick) { if (cards.Count > 0) { packInitiator.InitiatePack(cards); // if(!firstCheckDone) // turnType = TurnType.through; // else{ // turnType = TurnType.throughtorshow; // } turnType = TurnType.throughtorshow; } } else { if (!showChangeTurn) { dialog = "Cant pick card,\n" + turnType.ToString() + " one card to pick"; } else dialog = "Cant Pick card,\n" + " Press Change Turn Button"; UIEventHandler.Ins.OpenMenu("PickCardNotification"); UIEventHandler.Ins.pickNotificationText.text = dialog; //showDialogBox = true; } } }
IEnumerator RevertCardsOnDashboard() { if (placedDeckCards) { placedDeckCards.cardType = CardType.hand; packInitiator.PlaceDeckCardOnPlayerHands(placedDeckCards); ThrownCardsDeck.Ins.RemoveCardFromThrownCards(); placedDeckCards = null; } for (int i = 0; i < dashBoardCardHolder.Count; i++) { // if this dashboard has unmatched cards than revert if (!dashBoardCardHolder[i].doNotCheckforsequence) { for (int j = 0; j < dashBoardCardHolder[i].cardsPositionPoints.Count; j++) { if (dashBoardCardHolder[i].cardsPositionPoints[j].transform.childCount >= 1) { dashBoardCardHolder[i].cardsPositionPoints[j].cards.cardType = CardType.hand; packInitiator.PlaceDeckCardOnPlayerHands(dashBoardCardHolder[i].cardsPositionPoints[j].cards); } } } } for (int i = dashBoardCardHolder.Count - 1; i > -1; i--) { if (!dashBoardCardHolder[i].doNotCheckforsequence) { Destroy(dashBoardCardHolder[i].gameObject); dashBoardCardHolder.RemoveAt(i); } } yield return new WaitForSeconds(2.5f); if (cardMovementManager.tempCardHolder != null) if (pickedDeckCards != null) pickedDeckCards.StartAnimation(cardMovementManager.tempCardHolder); else print("tempCardHolder is null"); yield return new WaitForSeconds(1f); canTouch = true; if (pickedDeckCards != null) { pickedDeckCards.cardType = CardType.deck; pickedDeckCards = null; } if (packInitiator.cardsPositionPointsList.Count >= 15) turnType = TurnType.throughtorshow; else if (packInitiator.cardsPositionPointsList.Count < 15) turnType = TurnType.pick; }
/// <summary> /// Altera a variável informa a direção do movimento horizontal, /// é chamada pelo PlayerInput.cs através de um evento do teclado /// </summary> /// <param name="x"></param> public void MovementHorizontal(TurnType x) { _currentTurn = x; }
/// <summary> /// Altera a variável informa a direção do movimento horizontal, /// é chamada pelo PlayerInput.cs através de um evento do teclado /// </summary> /// <param name="x"></param> public void MovementHorizontal(TurnType x) { _currentTurn = x; //if(_currentTurn == TurnType.LEFT) // animation.CrossFade("strafe_left"); //if (_currentTurn == TurnType.RIGHT) // animation.CrossFade("strafe_right"); }