/// <summary> /// Picks up a piece on the board /// </summary> void TryPickup() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit) && hit.transform.tag == "chessPiece") { heldPiece = hit.transform.GetComponent <PieceScript>(); if (heldPiece.team == GameManager.Instance.playerTeam) { ClearValidMoves(); List <int> moves = MoveValidator.FindValidMoves(BoardManager.PositionToBoardIndex(hit.transform.position), BoardManager.BoardToCharArray(board)); for (int i = 0; i < moves.Count; i++) { validMoves.Add(board[moves[i]]); } ApplyHighlight(); } else { heldPiece = null; } } }
void CreatePiece(Vector2 tileLocation, int team, int type) { GameObject piece = Instantiate(piece_prefab, Vector3.zero, Quaternion.AngleAxis(-90.0f, Vector3.right)) as GameObject; piece.transform.RotateAround(transform.position, Vector3.forward, 180.0f); piece.transform.parent = this.transform; PieceScript pieceScript = piece.GetComponent <PieceScript>(); if (type == (int)PieceScript.Type.General) { pieceScript.CreateGeneral(tileLocation, team); } else { pieceScript.CreatePiece(tileLocation, team, type); } if (team == (int)PieceScript.Team.White) { whiteTeam.Add(pieceScript); } else { blackTeam.Add(pieceScript); } }
void WeldPiece(PieceScript floater) { if ((m_SelectMount == null) || (m_NearestMount == null)) { return; } print("Weld Piece " + m_SelectMount.Owner.name + " to " + m_NearestMount.Owner.name); // Ensure Rotation & Position floater.transform.rotation = Quaternion.FromToRotation( m_SelectMount.Mount.localRotation * Vector3.down, m_NearestMount.Mount.up); floater.transform.position = m_NearestMount.Mount.position - (m_SelectMount.Mount.position - floater.transform.position); // Check if its a valid piece if (m_SelectMount.Solution == m_NearestMount) { // Connect m_SelectMount.connectMount(m_NearestMount); } else { // Bounce Away floater.rigidbody.AddForce(m_NearestMount.Mount.up * 1000.0f); floater.rigidbody.AddForceAtPosition(m_SelectMount.Mount.right * 50.0f, m_SelectMount.Mount.position); } }
public void build_Mesh_Piece(int type) { type = type % 6; gridscript = new PieceScript(type); localgrid = gridscript.pieceGrid; for (int x = 0; x < 4; x++) { for (int y = 0; y < 4; y++) { if (localgrid[x, y]) { GameObject go = Instantiate(acube, new Vector3(x+3, y+18, 0), Quaternion.identity) as GameObject; localCUBEmatrrix[x, y] = go; go.renderer.material.color = Color.green; go.transform.parent = this.transform; go.tag = "visible_active"; } else { GameObject go = Instantiate(acube, new Vector3(x+3, y + 18, 0), Quaternion.identity) as GameObject; go.transform.parent = this.transform; go.renderer.material.color = Color.white; go.tag = "invisible_active"; localCUBEmatrrix[x, y] = go; } } } }
public void MovePiece() { int yutResult = selectedBlock.GetComponent <BlockScript>().yutResult; wayBlocks[selectedPiece.GetComponent <PieceScript>().curWaypoint].GetComponent <BlockScript>().whosOn = null; selectedPiece.GetComponent <PieceScript>().Move(yutResult); PieceScript whosOn = selectedBlock.GetComponent <BlockScript>().whosOn; // block 위에 아무 말도 없는 경우 if (whosOn == null) { selectedBlock.GetComponent <BlockScript>().whosOn = selectedPiece.GetComponent <PieceScript>(); } // block 위에 상대팀 말이 있는 경우 else if (whosOn.teamNumber != whichTeamTurn) { Debug.Log("상대팀 말 잡음!"); whosOn.InitPosition(); selectedBlock.GetComponent <BlockScript>().whosOn = selectedPiece.GetComponent <PieceScript>(); YutCheckZone.remainedThrow++; // 기회 +1 } // block 위에 같은팀 말이 있는 경우 else { Debug.Log("같은 팀 말 위에 업힘!"); whosOn.GetChild(selectedPiece); } yutResultList.Remove(yutResult); // Remove(): List<T>에서 처음 발견되는 특정 개체를 제거합니다. //SetResultText(); }
public MountPoint(PieceScript owner, Transform tMount) { m_TypeIndex = -1; m_Solution = null; m_Other = null; m_Mount = tMount; m_Owner = owner; }
private void initiPieces() { foreach (GameObject pieceObj in pieces) { PieceScript piece = pieceObj.gameObject.GetComponent <PieceScript>(); piece.setSize(totalPieces); piece.setProximity(proximity); } }
public Board(GameObject piece) { currentPlayer = PieceColor.WHITE; board = new PieceColor[8, 8]; board_pieces = new GameObject[8, 8]; GamePiece = piece; //height to drop piece from height = 2; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { this.board[i, j] = PieceColor.NONE; } } board[3, 3] = PieceColor.WHITE; board[4, 4] = PieceColor.WHITE; board[3, 4] = PieceColor.BLACK; board[4, 3] = PieceColor.BLACK; //Add actual objects 3,3 GameObject temp = GameObject.Instantiate <GameObject>(GamePiece); temp.name = "piece33"; temp.transform.position = new Vector3(3 + 0.5f, height, 7 - 3 + 0.5f); PieceScript abc = temp.GetComponent <PieceScript>(); abc.setWhite(); temp.GetComponent <PieceScript>().setWhite(); board_pieces[3, 3] = temp; //4,4 temp = GameObject.Instantiate <GameObject>(GamePiece); temp.name = "piece44"; temp.transform.position = new Vector3(4 + 0.5f, height, 7 - 4 + 0.5f); temp.GetComponent <PieceScript>().setWhite(); board_pieces[4, 4] = temp; //3,4 temp = GameObject.Instantiate <GameObject>(GamePiece); temp.name = "piece34"; temp.transform.position = new Vector3(4 + 0.5f, height, 7 - 3 + 0.5f); temp.transform.Rotate(180f, 0.0f, 0.0f, Space.Self); temp.GetComponent <PieceScript>().setBlack(); board_pieces[3, 4] = temp; //4,3 temp = GameObject.Instantiate <GameObject>(GamePiece); temp.name = "piece43"; temp.transform.position = new Vector3(3 + 0.5f, height, 7 - 4 + 0.5f); temp.transform.Rotate(180f, 0.0f, 0.0f, Space.Self); temp.GetComponent <PieceScript>().setBlack(); board_pieces[4, 3] = temp; print(board_pieces[3, 3].GetComponent <PieceScript>().Color); }
/// <summary> /// Spawn a piece and put it on the square /// </summary> /// <param name="type"> which type of piece should be spawned </param> /// <param name="team"> which team the spawned piece should be on </param> public void SpawnPiece(PieceScript.Type type, PieceScript.Team team) { GameObject startingPiece = GameObject.Instantiate(GameManager.Instance.basePiecePrefab, new Vector3(position.x, position.y, -1), Quaternion.Euler(0, 0, 180)); linkedPiece = startingPiece.GetComponent <PieceScript>(); linkedPiece.SetSquare(this); linkedPiece.name = (team + " " + type); linkedPiece.type = type; linkedPiece.team = team; linkedPiece.SetMaterial(type, team); BoardManager.Instance.RegisterPiece(linkedPiece); }
/// <summary> /// Add a game piece to the board /// </summary> /// <param name="piece">piece to add</param> public void RegisterPiece(PieceScript piece) { switch (piece.team) { case PieceScript.Team.White: instance.activeWhitePieces.Add(piece); break; case PieceScript.Team.Black: instance.activeBlackPieces.Add(piece); break; } }
void linkingPiecesAndPositions() { int i = 0; foreach (GameObject pieceObj in pieces) { PieceScript piece = pieceObj.gameObject.GetComponent <PieceScript> (); string[] lineAndColumn = positions [i].ToString().Split(';'); piece.setLine(int.Parse(lineAndColumn [0])); piece.setColumn(int.Parse(lineAndColumn [1])); i++; } }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { piece = transform.GetChild(1).GetComponent <PieceScript>(); if (P2 != null) { pieceP2 = P2.transform.GetChild(1).GetComponent <PieceScript>(); if (piece.gameOver && pieceP2.gameOver) { return; } } else if (piece.gameOver) { return; } if (canvas.activeInHierarchy) { piece.isStaticPiece = false; if (P2 != null) { pieceP2.isStaticPiece = false; } canvas.SetActive(false); canvas.transform.Find("Text").GetComponent <Text>().text = "GAME OVER"; } else { piece.isStaticPiece = true; if (P2 != null) { pieceP2.isStaticPiece = true; } canvas.transform.Find("Text").GetComponent <Text>().text = "PAUSE"; canvas.SetActive(true); } } }
// Update is called once per frame void Update() { foreach (GameObject pieceObj in pieces) { PieceScript piece = pieceObj.gameObject.GetComponent <PieceScript>(); if (piece.isDone()) { Debug.Log("VENCEU!!!"); } else { Debug.Log("AINDA NÃO!!!"); } } }
/// <summary> /// Remove a game piece from play /// </summary> /// <param name="piece">piece to remove</param> public void RemovePiece(PieceScript piece) { switch (piece.team) { case PieceScript.Team.White: instance.removedWhitePieces.Add(piece); instance.activeWhitePieces.Remove(piece); break; case PieceScript.Team.Black: instance.removedBlackPieces.Add(piece); instance.activeBlackPieces.Remove(piece); break; } piece.gameObject.SetActive(false); }
void TestBlock() { // print("Testing Letter " + m_iLetter); PieceScript currBlockData = m_PuzzleBlocks[m_iLetter].GetComponent <PieceScript>(); // Did we fail if (currBlockData.m_intersecting == true) { // print("Trying new Position"); m_testIncr += 1; GenerateBlockLetter(false); return; } // Fitted in currBlockData.PlaceInPlay(); m_TestSlot.Solution = m_TestTab; m_TestTab.Solution = m_TestSlot; // Add Free Points then Remove Points we Used m_FreePoints.AddRange(m_TestTab.Owner.GetFreeMounts()); m_FreePoints.Remove(m_TestSlot); m_FreePoints.Remove(m_TestTab); // Move onto Next Letter m_testIncr = 0; ++m_iLetter; if (m_iLetter >= m_PassPhrase.Length) { // Cleanup for (int i = 0; i < m_MagicBlocks.Length; ++i) { Destroy(m_MagicBlocks[i]); } Time.fixedDeltaTime = 0.02f; m_MagicBlocks = null; print("Done Generating"); m_isScatterReady = true; return; } m_PuzzleBlocks[m_iLetter] = null; GenerateBlockLetter(true); }
public void ConnectBody(PieceScript other) { if (m_isChild == true) { transform.parent.GetComponent <PieceScript>().ConnectBody(other); return; } while (other.m_isChild) { other = other.transform.parent.GetComponent <PieceScript>(); } if (other.m_hasChildren) { PieceScript[] subPieces = other.GetComponentsInChildren <PieceScript>(); foreach (PieceScript sP in subPieces) { sP.transform.parent = transform; } } SelectOff(); other.SelectOff(); // Child other.transform.parent = transform; other.m_isChild = true; // Merge Rigid Body rigidbody.centerOfMass = (rigidbody.centerOfMass * rigidbody.mass) + (other.rigidbody.centerOfMass * other.rigidbody.mass); rigidbody.mass += other.rigidbody.mass; Destroy(other.rigidbody); // Add Mount Points m_Mounts.AddRange(other.GetFreeMounts()); SendMessageUpwards("SelectObj", gameObject); m_hasChildren = true; }
void SelectObj(GameObject newSelection) { PieceScript[] puzzleBits = GetComponentsInChildren <PieceScript>(); m_SelectPiece = null; foreach (PieceScript bit in puzzleBits) { if (newSelection == bit.gameObject) { bit.SelectOn(); m_SelectPiece = bit; m_NearestMount = m_SelectPiece.GetNextMount(null, false, true); } else { bit.SelectOff(); } } m_puzCam.SelectObj(newSelection); }
void OnCollisionStay(Collision other) { if (other.collider.tag == "Sol") { if (m_IsFirst == false) { m_IsFirst = true; m_PieceRenderer.material.color=m_ColorFirstRed; } } if (other.collider.tag == "Piece") { m_PieceScript = other.gameObject.GetComponent<PieceScript> (); if (m_PieceScript.m_IsFirst == true || m_PieceScript.m_IsTop == true) { m_IsTop = true; m_PieceRenderer.material.color=m_ColorTopGreen; } } }
/// <summary> /// Gets the piece type of a piece fom a piece /// </summary> /// <param name="piece"> the piece to get the type of </param> /// <returns> the type of piece </returns> public static char GetCharFromPieceScript(PieceScript piece) { char t = '\0'; switch (piece.type) { case PieceScript.Type.Pawn: t = 'p'; break; case PieceScript.Type.Rook: t = 'r'; break; case PieceScript.Type.Bishop: t = 'b'; break; case PieceScript.Type.Knight: t = 'n'; break; case PieceScript.Type.Queen: t = 'q'; break; case PieceScript.Type.King: t = 'k'; break; case PieceScript.Type.BLOCK: t = 'X'; break; } return((piece.team == GameManager.Instance.playerTeam) ? char.ToUpper(t) : char.ToLower(t)); }
/// <summary> /// Lets go of the piece that the player is holding on to /// </summary> void DropPiece() { Vector3 newPos = new Vector3( Mathf.RoundToInt(heldPiece.transform.position.x), Mathf.RoundToInt(heldPiece.transform.position.y), heldPiece.transform.position.z ); //Actually move int indexOfThisMove = BoardManager.PositionToBoardIndex(newPos); if (indexOfThisMove >= 0 && indexOfThisMove < board.Length && validMoves.Contains(board[indexOfThisMove])) //Move is valid { BoardManager.Instance.MakeMove(new Move(BoardManager.Instance.boardChars, heldPiece.index, indexOfThisMove)); } else //Not valid, return to last position { heldPiece.ResetToLast(); } heldPiece = null; ClearValidMoves(); }
// Use this for initialization void Start() { print("We have " + m_BaseBlocks.Length + " blocks"); print(Time.fixedDeltaTime); Time.fixedDeltaTime = 0.0001f; m_PartSlot.enabled = false; m_PartTab.enabled = false; Renderer[] groupRenderer = m_PlayArea.GetComponentsInChildren <Renderer>(); foreach (Renderer cr in groupRenderer) { cr.enabled = false; } // Sanity Check Word Block List int numError = 0; for (int i = 0; i < m_BaseBlocks.Length; ++i) { if (m_BaseBlocks[i].GetComponent <PieceScript>() == null) { print("Error using Piece [" + m_BaseBlocks[i].name + "]"); numError += 1; } } // BAD BAD BAD Claire int newLength = m_BaseBlocks.Length - numError; int safeIter = 0; m_MagicBlocks = new GameObject[newLength]; for (int iBlock = 0; iBlock < newLength; ++iBlock) { if (m_BaseBlocks[iBlock].GetComponent <PieceScript>() != null) { m_MagicBlocks[safeIter] = (GameObject)Instantiate(m_BaseBlocks[iBlock], Vector3.zero, Quaternion.identity); m_MagicBlocks[safeIter].active = false; safeIter += 1; } } print("We have " + m_MagicBlocks.Length + " magical blocks"); m_FreePoints = new List <MountPoint>(); m_PuzzleBlocks = new GameObject[m_PassPhrase.Length]; // Pick Block int blockID = (m_PassPhrase[0]) % m_MagicBlocks.Length; GameObject currBlock = (GameObject)Instantiate(m_MagicBlocks[blockID]); // Root Node currBlock.transform.localPosition = Vector3.zero; currBlock.transform.rotation = Quaternion.identity; currBlock.transform.localScale = Vector3.one; currBlock.name = "Letter 0"; currBlock.transform.parent = transform; // Mark as in Play PieceScript currBlockData = currBlock.GetComponent <PieceScript>(); currBlockData.PlaceInPlay(); // Add Mount Points m_FreePoints.AddRange(currBlockData.GetFreeMounts()); m_PuzzleBlocks[0] = currBlock; // Generate all other blocks m_iLetter = 1; GenerateBlockLetter(true); }
public Piece(string notation = "", PieceScript ps = null) { movement = MParser.parse(notation); script = ps; }
// Use this for initialization void Start() { //Setting both the 2D and 3D version of the position vector to zeroed vectors pos3D = new Vector3 (0, 0, 0); pos2D = new Vector2 (0, 0); //Setting the top burst and last burst values to zero initially, as players begin having not burst any blocks. topBurst = 0; lastBurst = 0; //A 10-block long, 15-block high game board works pretty well, giving 150 overall blocks to use in the game. rowSizeNum = 10; colSizeNum = 15; //Initializing the allBlocks array with the size corresponding to the rowSizeNum and colSizeNum, coming out to the overall size of blocks. allBlocks = new GameObject[rowSizeNum*colSizeNum]; //Going through each number i which represents the overall amount of rows (the size of a column) for(int i=0;i<colSizeNum;i++) { //Then going through each number j which represents the overall amount of columns (the size of a row) for(int j=0;j<rowSizeNum;j++) { //Then we go through our array and take the current row (i* the number of blocks in a row) plus the number j we are in the row and create a new block in that position allBlocks[(i * rowSizeNum) + j] = (GameObject)Instantiate(block, new Vector2(j - 2, i - 2), Quaternion.identity); //Then we get the script component for the PieceScript of the block and set its color to a random value pScript = allBlocks[(i * rowSizeNum) + j].GetComponent<PieceScript>(); pScript.ChooseColor((int)(Random.value*3)); } } }
void MoveToClosestAnchor(RaycastHit sphereHitInfo, PieceScript floater) { float mountDist = 10000000000.0f; m_NearestMount = null; m_isValidConnection = false; // Locate Nearest Mount Point foreach (MountPoint iMount in m_SelectPiece.GetFreeMounts()) { float mDist = (iMount.Mount.position - sphereHitInfo.point).magnitude; if ((iMount.TypeID >= 0) && (mDist < mountDist)) { mountDist = mDist; m_NearestMount = iMount; m_isValidConnection = true; } } // Align Floating Piece Quaternion qAlter = Quaternion.FromToRotation( m_SelectMount.Mount.localRotation * Vector3.down, m_NearestMount.Mount.up); if (m_SelectMount.Owner != floater) { // There MUST be a cleaner way todo this Vector3 newDown = m_SelectMount.Owner.transform.localRotation * m_SelectMount.Mount.localRotation * Vector3.down; qAlter = Quaternion.FromToRotation( newDown, m_NearestMount.Mount.up); } floater.transform.rotation = Quaternion.Lerp(floater.transform.rotation, qAlter, 0.1f); // Move Point Vector3 tarPoint = m_NearestMount.Mount.position - ( m_SelectMount.Mount.position - floater.transform.position ); if (m_isValidConnection == false) { tarPoint = tarPoint + m_NearestMount.Mount.up; } // Move to Mount floater.transform.position = Vector3.Lerp(floater.transform.position, tarPoint, 0.05f); // Draw Line to indicate Bubble Debug.DrawLine( m_SelectMount.Mount.position, m_NearestMount.Mount.position); DrawTrans(m_SelectMount.Mount.transform); DrawTrans(m_NearestMount.Mount.transform); }
void UpdateDragInput() { RaycastHit hitInfo; if (Input.GetMouseButtonDown(1) && (m_SelectPiece != null)) { if (Physics.Raycast(m_puzCam.camera.ScreenPointToRay(Input.mousePosition), out hitInfo)) { if (hitInfo.rigidbody != m_SelectPiece.rigidbody) { m_DragBody = hitInfo.rigidbody; m_SelectMount = m_DragBody.GetComponent <PieceScript>().GetNextMount(null, false, true); print(m_SelectMount); m_isDragging = true; m_isValidConnection = false; m_DragBody.isKinematic = true; } } } if (m_isDragging) { // Rotate and Move point PieceScript floater = m_DragBody.GetComponent <PieceScript>(); if (Input.GetKeyUp(KeyCode.Space)) { m_SelectMount = m_DragBody.GetComponent <PieceScript>().GetNextMount(m_SelectMount, false, true); print(m_SelectMount); } if ((m_SelectPiece != null) && (m_SelectMount != null)) { // Position Hit Bubble m_MousePin.transform.position = m_SelectPiece.transform.position; // Check if we hit bubble Ray mouseRay = m_puzCam.camera.ScreenPointToRay(Input.mousePosition); RaycastHit sphereHitInfo; if (m_MousePin.Raycast(mouseRay, out sphereHitInfo, 1000.0f)) { MoveToClosestAnchor(sphereHitInfo, floater); } else { Vector3 newPos; if (sphereHitInfo.distance < 0.00001f) { // Setup Infinite Plane Plane hitPlane = new Plane(m_puzCam.transform.forward, m_SelectPiece.transform.position); float rayDist = 1.0f; hitPlane.Raycast(mouseRay, out rayDist); newPos = mouseRay.GetPoint(rayDist); } else { newPos = sphereHitInfo.point; } floater.transform.position = Vector3.Lerp(floater.transform.position, newPos, 0.15f); } } if (Input.GetMouseButtonUp(1)) { m_isDragging = false; m_DragBody.isKinematic = false; WeldPiece(floater); m_DragBody = null; m_SelectMount = null; } } }
/// <summary> /// Links a square to a piece /// </summary> /// <param name="piece"> the piece to link to the square </param> public void SetPiece(PieceScript piece) { linkedPiece = piece; }
// Update is called once per frame void Update() { RaycastHit hit; if (getLine() == 1) { forward = true; } else { if (Physics.Raycast(new Ray(transform.position, Vector3.forward), out hit, 300)) { if (hit.collider.tag == "Piece") { PieceScript piece = hit.collider.gameObject.GetComponent <PieceScript> (); if (getColumn() == piece.getColumn() && (getLine() - piece.getLine() == 1)) { Debug.DrawRay(transform.position, Vector3.forward * 300, Color.red); forward = true; } else { forward = false; } } } else { forward = false; } } if (getLine() == Mathf.Sqrt((float)getSize())) { back = true; } else { if (Physics.Raycast(new Ray(transform.position, Vector3.back), out hit, 300)) { if (hit.collider.tag == "Piece") { PieceScript piece = hit.collider.gameObject.GetComponent <PieceScript> (); if (getColumn() == piece.getColumn() && (piece.getLine() - getLine() == 1)) { Debug.DrawRay(transform.position, Vector3.back * 300, Color.red); back = true; } else { back = false; } } } else { back = false; } } if (getColumn() == 1) { left = true; } else { if (Physics.Raycast(new Ray(transform.position, Vector3.left), out hit, 300)) { if (hit.collider.tag == "Piece") { PieceScript piece = hit.collider.gameObject.GetComponent <PieceScript> (); if (getLine() == piece.getLine() && (getColumn() - piece.getColumn() == 1)) { Debug.DrawRay(transform.position, Vector3.left * 300, Color.red); left = true; } else { left = false; } } } else { left = false; } } if (getColumn() == Mathf.Sqrt((float)getSize())) { right = true; } else { if (Physics.Raycast(new Ray(transform.position, Vector3.right), out hit, 300)) { if (hit.collider.tag == "Piece") { PieceScript piece = hit.collider.gameObject.GetComponent <PieceScript> (); if (getLine() == piece.getLine() && (piece.getColumn() - getColumn() == 1)) { Debug.DrawRay(transform.position, Vector3.right * 300, Color.red); right = true; } else { right = false; } } } else { right = false; } } }
void OnTriggerStay(Collider other) { if (other.gameObject.tag=="Piece") { m_PieceScript = other.gameObject.GetComponent<PieceScript>(); if (m_PieceScript.m_IsTop == true) { if (m_AlreadyChecked ==false) { switch (m_ObjectifNumber) { case 1: break; case 2: break; case 3: m_ThirdCheck = true; #region Save //Sauvegarde int m_LastStep; string m_Difficulty; int m_Flags; int m_FlagsWin; ///////////////// PlayerPrefs.SetInt("ConstructionGameDifficulty", 0); //////////////// m_LastStep = PlayerPrefs.GetInt("ConstructionGameDifficulty", 0); m_Difficulty = PlayerPrefs.GetString("Difficulty"); m_Flags = PlayerPrefs.GetInt("Flags"); m_FlagsWin = 0; switch (m_Difficulty) { case "Easy": if (m_LastStep == 0) { PlayerPrefs.SetInt("ConstructionGameDifficulty", 1); //Gain de drapeau PlayerPrefs.SetInt("Flags", m_Flags++); m_FlagsWin++; } break; case "Medium": if (m_LastStep < 2) { if (m_LastStep == 0) { PlayerPrefs.SetInt("Flags", m_Flags++); m_FlagsWin++; } m_Flags = PlayerPrefs.GetInt("Flags"); PlayerPrefs.SetInt("Flags", m_Flags++); m_FlagsWin++; PlayerPrefs.SetInt("ConstructionGameDifficulty", 2); //Gain de drapeau } break; case "Hard": if (m_LastStep < 3) { if (m_LastStep < 2) { if (m_LastStep < 1) { m_Flags = PlayerPrefs.GetInt("Flags"); PlayerPrefs.SetInt("Flags", m_Flags++); m_FlagsWin++; } m_Flags = PlayerPrefs.GetInt("Flags"); PlayerPrefs.SetInt("Flags", m_Flags++); m_FlagsWin++; } m_Flags = PlayerPrefs.GetInt("Flags"); PlayerPrefs.SetInt("Flags", m_Flags++); m_FlagsWin++; PlayerPrefs.SetInt("ConstructionGameDifficulty", 3); } break; } PlayerPrefs.SetInt("FlagWin", m_FlagsWin); #endregion m_PanelUI.SetActive (false); m_PanelWhirlPool.SetActive (true); m_PanelVictory.SetActive(true); break; } m_AlreadyChecked =true; } } } }