public void SnugFit(HomePieces homePieces) { if (homePieces.shape == shape) { DisablePiece(); transform.position = new Vector3(homePieces.transform.position.x, homePieces.transform.position.y, 1f); transform.rotation = homePieces.transform.rotation; homePieces.Occupied = true; snugFit = true; player.PieceSnugFit(this); GameMaster.Instance.PhraseManager.DisplayFindHomePhrase(); } }
public void GetAttracted(HomePieces homePieces, float force, float magnitude01) { if (!AllowControl || snugFit) { return; } Vector2 dir = (Vector2)homePieces.transform.position - (Vector2)transform.position; dir.Normalize(); if (homePieces.shape == shape) { rb.AddForce(dir * Time.deltaTime * force); transform.rotation = Quaternion.Slerp(transform.rotation, homePieces.transform.rotation, Time.deltaTime * (1f - magnitude01)); } else if (magnitude01 < 0.1f) { GameMaster.Instance.PhraseManager.DisplayWrongHomePhrase(); } }