public void MatchPiece(PuzzleAssemblyPiece matchMe) { pieceName = matchMe.pieceName; transform.localScale = matchMe.transform.lossyScale; meshFilter.mesh = matchMe.GetComponent <MeshFilter>()?.sharedMesh; meshCollider.sharedMesh = meshFilter.sharedMesh; transform.rotation = UnityEngine.Random.rotation; }
private void OnTriggerEnter(Collider other) { Puzzle puzz = other.GetComponent <Puzzle>(); if (puzz != null) { foreach (PuzzleAssemblyPiece piece in puzz.Pieces) { if (!piece.gameObject.activeSelf) { if ((isOnPosSide && piece.transform.position.x > 0) || (!isOnPosSide && piece.transform.position.x < 0)) { targetPiece = piece; agent.SetDestination(piece.transform.position); currentState = State.Chasing; } } } } }
public void StartTrackingPiece(PuzzleAssemblyPiece pieceToEnable) { matchingPiece = pieceToEnable; sphere.radius = matchingPiece.pieceCollisionSize / 200f; matchingPiece.gameObject.SetActive(false); }