removed commented out code and print statements

the console should finally be message free! except for the unity memory leak lol but that one's not on us
This commit is contained in:
Sam 2023-05-06 19:05:46 -07:00
parent c13793565d
commit b6804e2986
12 changed files with 1 additions and 91 deletions

View File

@ -45,8 +45,5 @@ public class CameraMovement : MonoBehaviour {
public void FindPlayer() { public void FindPlayer() {
player = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player");
// if (player == null) {
// print("null player!");
// }
} }
} }

View File

@ -33,7 +33,6 @@ public class DebugSceneSwitcher : MonoBehaviour
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++) for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
{ {
string newName = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i)); string newName = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i));
print(newName);
sceneNames.Add(newName); sceneNames.Add(newName);
} }
sceneDropdown.AddOptions(sceneNames); sceneDropdown.AddOptions(sceneNames);
@ -45,7 +44,6 @@ public class DebugSceneSwitcher : MonoBehaviour
public void ChangeScene(int index) public void ChangeScene(int index)
{ {
// print(index);
SceneController.Instance.LoadChosenScene(index); SceneController.Instance.LoadChosenScene(index);
this.gameObject.SetActive(false); this.gameObject.SetActive(false);
} }

View File

@ -26,7 +26,6 @@ public class DialogBoxes : MonoBehaviour
{ {
textField = this.gameObject.GetComponent<TMP_Text>(); textField = this.gameObject.GetComponent<TMP_Text>();
ReconfigureSpriteArray(); ReconfigureSpriteArray();
print("reconfigured");
textField.text = dialogMessages[0]; textField.text = dialogMessages[0];
backgroundImageObject.sprite = images[0]; backgroundImageObject.sprite = images[0];
} }
@ -36,8 +35,6 @@ public class DialogBoxes : MonoBehaviour
messageCount += 1; messageCount += 1;
if (messageCount < dialogMessages.Length) if (messageCount < dialogMessages.Length)
{ {
print("looking at message " + messageCount);
print("messages: " + dialogMessages.Length + ", images: " + images.Length);
textField.text = dialogMessages[messageCount]; textField.text = dialogMessages[messageCount];
backgroundImageObject.sprite = images[messageCount]; backgroundImageObject.sprite = images[messageCount];
} }
@ -53,11 +50,9 @@ public class DialogBoxes : MonoBehaviour
void ReconfigureSpriteArray() void ReconfigureSpriteArray()
{ {
print("attempting to reconfigure");
// resize if need to // resize if need to
if (images.Length != dialogMessages.Length) if (images.Length != dialogMessages.Length)
{ {
print("resizing");
Sprite[] newImagesArray = new Sprite[dialogMessages.Length]; Sprite[] newImagesArray = new Sprite[dialogMessages.Length];
for (int i = 0; i < newImagesArray.Length; i++) for (int i = 0; i < newImagesArray.Length; i++)
{ {
@ -78,7 +73,6 @@ public class DialogBoxes : MonoBehaviour
images[i] = images[i - 1]; images[i] = images[i - 1];
} }
} }
print(images.Length);
} }
} }

View File

@ -86,11 +86,8 @@ public class EnemyPatrol : MonoBehaviour {
this.gameObject.GetComponent<BoxCollider2D>().enabled = false; this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
animator.Play("Explosion"); animator.Play("Explosion");
float explosionTime = .25f; float explosionTime = .25f;
// print("explosiontime: " + explosionTime);
this.gameObject.GetComponent<AudioSource>().Play(); this.gameObject.GetComponent<AudioSource>().Play();
// print("reached early point");
yield return new WaitForSeconds(explosionTime); yield return new WaitForSeconds(explosionTime);
// print("reached late point");
this.gameObject.GetComponent<BoxCollider2D>().enabled = true; this.gameObject.GetComponent<BoxCollider2D>().enabled = true;
isPlayingDefeatAnimation = false; isPlayingDefeatAnimation = false;
this.gameObject.SetActive(false); this.gameObject.SetActive(false);

View File

@ -24,7 +24,6 @@ public class PlayerBehavior : MonoBehaviour
private bool isDash = false; private bool isDash = false;
public float dashForce = 1f; public float dashForce = 1f;
public float dashTime = 1.0f; public float dashTime = 1.0f;
private float dashInc = 0.1f;
private float currentDash = 0.0f; private float currentDash = 0.0f;
private bool forceAdded = false; private bool forceAdded = false;
Vector2 dashVec; Vector2 dashVec;
@ -146,9 +145,6 @@ public class PlayerBehavior : MonoBehaviour
if (this.playerInput.actions["CymbalCrash"].WasPressedThisFrame()) { if (this.playerInput.actions["CymbalCrash"].WasPressedThisFrame()) {
// Play the sound // Play the sound
this.gameUI.ToggleCymbal(false); this.gameUI.ToggleCymbal(false);
// this.audioSource.clip = cymbalSound;
// this.audioSource.loop = false;
// this.audioSource.Play();
cymbalAudio.Play(); cymbalAudio.Play();
// Set the cymbal active for the equivalent of one second // Set the cymbal active for the equivalent of one second
@ -226,7 +222,6 @@ public class PlayerBehavior : MonoBehaviour
void LetGoOfGrapple() { void LetGoOfGrapple() {
bool currentlyPaused = StateController.Instance.isPaused; bool currentlyPaused = StateController.Instance.isPaused;
if (grapplingRope.isGrappling && !currentlyPaused) { if (grapplingRope.isGrappling && !currentlyPaused) {
// print("currently paused is " + currentlyPaused + ", releasing grapple");
if (tambourine != null) { if (tambourine != null) {
tambourine.GetComponent<TambourineBehavior>().DestroySelf(); tambourine.GetComponent<TambourineBehavior>().DestroySelf();
} }
@ -241,7 +236,6 @@ public class PlayerBehavior : MonoBehaviour
} }
else { else {
reflect = new Vector2(saveVelocity.x * reflectForce, -(saveVelocity.y) * reflectForce); reflect = new Vector2(saveVelocity.x * reflectForce, -(saveVelocity.y) * reflectForce);
//reflect = new Vector2(saveVelocity.x * 1.1f, -(saveVelocity.y) * reflectForce);
hasBounced = true; hasBounced = true;
} }
_rb.AddForce(reflect, ForceMode2D.Impulse); _rb.AddForce(reflect, ForceMode2D.Impulse);
@ -250,7 +244,6 @@ public class PlayerBehavior : MonoBehaviour
} }
void Water() { void Water() {
print("water dash " + isDash);
if(isDash) { if(isDash) {
saveVelocity = _rb.velocity / velocityCut; saveVelocity = _rb.velocity / velocityCut;
if (isDash) { if (isDash) {
@ -268,7 +261,6 @@ public class PlayerBehavior : MonoBehaviour
grappleSurface = col.gameObject; grappleSurface = col.gameObject;
} }
else if (col.tag == "instaDeath") { else if (col.tag == "instaDeath") {
print("player fell in spikes");
StartCoroutine(DestroyPlayer()); StartCoroutine(DestroyPlayer());
} }
else if (col.tag == "spawnPoint") { else if (col.tag == "spawnPoint") {
@ -331,7 +323,6 @@ public class PlayerBehavior : MonoBehaviour
} }
else { else {
StartCoroutine(DestroyPlayer()); StartCoroutine(DestroyPlayer());
print("enemy defeated player");
} }
} }
else if (collision.gameObject.tag == "Projectile") { else if (collision.gameObject.tag == "Projectile") {
@ -365,7 +356,6 @@ public class PlayerBehavior : MonoBehaviour
if (grapplingRope.isGrappling) { if (grapplingRope.isGrappling) {
LetGoOfGrapple(); LetGoOfGrapple();
} }
// print("destroyPlayer called");
playerIsAlive = false; playerIsAlive = false;
audioSource.clip = deathSound; audioSource.clip = deathSound;
audioSource.loop = false; audioSource.loop = false;
@ -378,14 +368,10 @@ public class PlayerBehavior : MonoBehaviour
// destroy all tambourines // destroy all tambourines
GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine"); GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine");
print("tambs found: " + currentTambourines.Length);
if (currentTambourines != null) { if (currentTambourines != null) {
foreach (GameObject tambourine in currentTambourines) { foreach (GameObject tambourine in currentTambourines) {
if (tambourine != null) { if (tambourine != null) {
tambourine.GetComponent<TambourineBehavior>().DestroySelf(); tambourine.GetComponent<TambourineBehavior>().DestroySelf();
print("tamb destroyed");
} else {
print("null tamb");
} }
} }
} }

View File

@ -125,7 +125,6 @@ public class PlayerMovement : MonoBehaviour
isRegFalling = false; isRegFalling = false;
} }
else { else {
// print("not jumping");
if (!_isJumpFalling && !isRegFalling) { if (!_isJumpFalling && !isRegFalling) {
if (unlockedTrumpet) { if (unlockedTrumpet) {
trumpet = 1; trumpet = 1;
@ -143,7 +142,6 @@ public class PlayerMovement : MonoBehaviour
#region JUMP CHECKS #region JUMP CHECKS
if (IsJumping && RB.velocity.y <= 0) { if (IsJumping && RB.velocity.y <= 0) {
IsJumping = false; IsJumping = false;
// print("isJumping " + IsJumping);
_isJumpFalling = true; _isJumpFalling = true;
} }
@ -162,7 +160,6 @@ public class PlayerMovement : MonoBehaviour
_isJumpFalling = false; _isJumpFalling = false;
bool inCoyoteTime = LastOnGroundTime > 0; bool inCoyoteTime = LastOnGroundTime > 0;
//print("coyote time: " + inCoyoteTime);
Jump(); Jump();
@ -186,7 +183,6 @@ public class PlayerMovement : MonoBehaviour
// stop sound if needed // stop sound if needed
if (soundPlaying && (isRegFalling || IsJumping || _isJumpFalling)) { if (soundPlaying && (isRegFalling || IsJumping || _isJumpFalling)) {
print("footsteps stop");
audioSource.Stop(); audioSource.Stop();
soundPlaying = false; soundPlaying = false;
} }
@ -201,10 +197,6 @@ public class PlayerMovement : MonoBehaviour
#region GRAVITY #region GRAVITY
//Higher gravity if we've released the jump input or are falling //Higher gravity if we've released the jump input or are falling
// if (IsSliding)
// {
// SetGravityScale(0);
// }
if (RB.velocity.y < 0 && _moveInput.y < 0) { if (RB.velocity.y < 0 && _moveInput.y < 0) {
//Much higher gravity if holding down //Much higher gravity if holding down
SetGravityScale(Data.gravityScale * Data.fastFallGravityMult); SetGravityScale(Data.gravityScale * Data.fastFallGravityMult);
@ -234,13 +226,11 @@ public class PlayerMovement : MonoBehaviour
#region SOUND CHECKS #region SOUND CHECKS
if (!IsJumping && !_isJumpFalling && !isRegFalling && _moveInput.x != 0) { if (!IsJumping && !_isJumpFalling && !isRegFalling && _moveInput.x != 0) {
if (!soundPlaying) { if (!soundPlaying) {
// print("footsteps PLAY");
audioSource.Play(); audioSource.Play();
soundPlaying = true; soundPlaying = true;
} }
} }
else if (soundPlaying && audioSource.clip.name == "footsteps") { else if (soundPlaying && audioSource.clip.name == "footsteps") {
// print("footsteps stop");
audioSource.Stop(); audioSource.Stop();
soundPlaying = false; soundPlaying = false;
} }
@ -375,7 +365,6 @@ public class PlayerMovement : MonoBehaviour
} }
public bool IsGrounded() { public bool IsGrounded() {
// print(Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
return (Physics2D.OverlapBox(new Vector2(this.transform.position.x, this.transform.position.y - _groundCheckOffset), _groundCheckSize, 0, _groundLayer) && !IsJumping); return (Physics2D.OverlapBox(new Vector2(this.transform.position.x, this.transform.position.y - _groundCheckOffset), _groundCheckSize, 0, _groundLayer) && !IsJumping);
} }

View File

@ -44,19 +44,8 @@ public class PlayerData : ScriptableObject
public float jumpHangAccelerationMult; public float jumpHangAccelerationMult;
public float jumpHangMaxSpeedMult; public float jumpHangMaxSpeedMult;
[Header("Wall Jump")]
public Vector2 wallJumpForce; //The actual force (this time set by us) applied to the player when wall jumping.
[Space(5)]
[Range(0f, 1f)] public float wallJumpRunLerp; //Reduces the effect of player's movement while wall jumping.
[Range(0f, 1.5f)] public float wallJumpTime; //Time after wall jumping the player's movement is slowed for.
public bool doTurnOnWallJump; //Player will rotate to face wall jumping direction
[Space(20)] [Space(20)]
[Header("Slide")]
public float slideSpeed;
public float slideAccel;
[Header("Assists")] [Header("Assists")]
[Range(0.01f, 0.5f)] public float coyoteTime; //Grace period after falling off a platform, where you can still jump [Range(0.01f, 0.5f)] public float coyoteTime; //Grace period after falling off a platform, where you can still jump
[Range(0.01f, 0.5f)] public float jumpInputBufferTime; //Grace period after pressing jump where a jump will be automatically performed once the requirements (eg. being grounded) are met. [Range(0.01f, 0.5f)] public float jumpInputBufferTime; //Grace period after pressing jump where a jump will be automatically performed once the requirements (eg. being grounded) are met.

View File

@ -29,11 +29,6 @@ public class SceneController : MonoBehaviour
void OnSceneLoaded(Scene scene, LoadSceneMode mode) void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{ {
GameObject pauseMenu = GameObject.Find("PauseMenuCanvas"); GameObject pauseMenu = GameObject.Find("PauseMenuCanvas");
if (pauseMenu != null)
{
// Button quitButton = GameObject.Find("QuitButton").GetComponent<Button>();
// quitButton.onClick.AddListener(BackToMainMenu);
}
if (scene.buildIndex == 0) if (scene.buildIndex == 0)
{ // if this is the menu { // if this is the menu
GameObject.Find("NewGameButton").GetComponent<Button>().onClick.AddListener(NextScene); GameObject.Find("NewGameButton").GetComponent<Button>().onClick.AddListener(NextScene);

View File

@ -92,10 +92,6 @@ public class StateController : MonoBehaviour
if (deathCanvas != null) if (deathCanvas != null)
{ {
Button respawnButton = GameObject.Find("RespawnButton").GetComponent<Button>(); Button respawnButton = GameObject.Find("RespawnButton").GetComponent<Button>();
if (respawnButton == null)
{
print("respawn button not found!");
}
respawnButton.onClick.AddListener(RespawnPlayer); respawnButton.onClick.AddListener(RespawnPlayer);
deathCanvas.SetActive(false); deathCanvas.SetActive(false);
} }
@ -120,7 +116,6 @@ public class StateController : MonoBehaviour
// keep track of all enemies // keep track of all enemies
enemiesInScene = GameObject.FindGameObjectsWithTag("Enemy"); enemiesInScene = GameObject.FindGameObjectsWithTag("Enemy");
// print(enemiesInScene);
if (isPaused) if (isPaused)
{ {

View File

@ -30,7 +30,6 @@ public class TambourineBehavior : MonoBehaviour {
void Start() { void Start() {
// rb.AddForce(new Vector2(horizSpeed, vertSpeed), ForceMode2D.Impulse);
this.gameObject.transform.localScale = new Vector2(transform.localScale.x * player.GetComponent<PlayerBehavior>().forward, transform.localScale.y); this.gameObject.transform.localScale = new Vector2(transform.localScale.x * player.GetComponent<PlayerBehavior>().forward, transform.localScale.y);
StartCoroutine(CheckToDestroy()); StartCoroutine(CheckToDestroy());
} }
@ -41,15 +40,12 @@ public class TambourineBehavior : MonoBehaviour {
} else { } else {
if (collidedObject != null && collidedObject.tag != "grappleSurface" && !returnToPlayer) { if (collidedObject != null && collidedObject.tag != "grappleSurface" && !returnToPlayer) {
rb.constraints = RigidbodyConstraints2D.FreezeAll; rb.constraints = RigidbodyConstraints2D.FreezeAll;
// this.gameObject.transform.position = col.transform.position;
timeLerped += Time.deltaTime; timeLerped += Time.deltaTime;
this.gameObject.transform.position = Vector2.Lerp(this.gameObject.transform.position, collidedObject.transform.position, timeLerped/timeToLerp); this.gameObject.transform.position = Vector2.Lerp(this.gameObject.transform.position, collidedObject.transform.position, timeLerped/timeToLerp);
if (this.gameObject.transform.position.x == collidedObject.transform.position.x && this.gameObject.transform.position.y == collidedObject.transform.position.y && !animator.GetBool("pinned")) { if (this.gameObject.transform.position.x == collidedObject.transform.position.x && this.gameObject.transform.position.y == collidedObject.transform.position.y && !animator.GetBool("pinned")) {
pinned = true; pinned = true;
animator.SetBool("pinned", true); animator.SetBool("pinned", true);
tambourineHitSound.Play(); tambourineHitSound.Play();
} else {
// print("pinned, but not same position: " + this.gameObject.transform.position + " / " + collidedObject.transform.position);
} }
} else if (returnToPlayer) { } else if (returnToPlayer) {
Destroy(rb); Destroy(rb);
@ -68,17 +64,14 @@ public class TambourineBehavior : MonoBehaviour {
} }
void OnTriggerEnter2D(Collider2D col) { void OnTriggerEnter2D(Collider2D col) {
// print(col.tag);
if (col.tag == "Enemy") { if (col.tag == "Enemy") {
this.gameObject.GetComponent<BoxCollider2D>().enabled = false; this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
collidedObject = col.gameObject; collidedObject = col.gameObject;
// print("Pinning to enemy");
this.gameObject.GetComponent<CircleCollider2D>().enabled = false; this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
collidedObject.GetComponent<EnemyPatrol>().TogglePin(true, this); collidedObject.GetComponent<EnemyPatrol>().TogglePin(true, this);
} else if (col.tag == "Projectile") { } else if (col.tag == "Projectile") {
this.gameObject.GetComponent<BoxCollider2D>().enabled = false; this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
collidedObject = col.gameObject; collidedObject = col.gameObject;
// print("pinned to projectile");
this.gameObject.GetComponent<CircleCollider2D>().enabled = false; this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
collidedObject.GetComponent<ProjectileBehavior>().Pin(); collidedObject.GetComponent<ProjectileBehavior>().Pin();
} }
@ -92,7 +85,6 @@ public class TambourineBehavior : MonoBehaviour {
IEnumerator CheckToDestroy() { IEnumerator CheckToDestroy() {
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f);
// print("waited 5");
if (!player.GetComponent<PlayerBehavior>().grapplingRope.isGrappling) { if (!player.GetComponent<PlayerBehavior>().grapplingRope.isGrappling) {
DestroySelf(); DestroySelf();
} }

View File

@ -8,9 +8,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
[Header("Scripts References:")] [Header("Scripts References:")]
public Tutorial_GrapplingRope grappleRope; public Tutorial_GrapplingRope grappleRope;
[Header("Main Camera:")]
public Camera m_camera;
[Header("Transform References:")] [Header("Transform References:")]
public Transform gunHolder; public Transform gunHolder;
public Transform gunPivot; public Transform gunPivot;
@ -41,7 +38,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
void Start() { void Start() {
m_camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
grappleRope.enabled = false; grappleRope.enabled = false;
m_springJoint2D.enabled = false; m_springJoint2D.enabled = false;
m_distanceJoint2D.distance = targetDistance + .5f; m_distanceJoint2D.distance = targetDistance + .5f;
@ -51,11 +47,7 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
void Update() { void Update() {
// Vector2 mousePos = m_camera.ScreenToWorldPoint(Mouse.current.position.ReadValue());
// RotateGun(mousePos, true);
if (grappleRope.isGrappling && !inDistanceRange && Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) < targetDistance) { if (grappleRope.isGrappling && !inDistanceRange && Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) < targetDistance) {
// print(Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) + ", target: " + targetDistance);
inDistanceRange = true; inDistanceRange = true;
} }
if (grappleRope.isGrappling) { if (grappleRope.isGrappling) {
@ -80,14 +72,12 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
public void Grapple() { public void Grapple() {
grappleDistanceVector = grapplePoint - (Vector2)gunPivot.position; grappleDistanceVector = grapplePoint - (Vector2)gunPivot.position;
// print("grapple");
m_springJoint2D.autoConfigureDistance = false; m_springJoint2D.autoConfigureDistance = false;
m_distanceJoint2D.autoConfigureDistance = false; m_distanceJoint2D.autoConfigureDistance = false;
m_springJoint2D.connectedAnchor = grapplePoint; m_springJoint2D.connectedAnchor = grapplePoint;
m_springJoint2D.enabled = true; m_springJoint2D.enabled = true;
// print("Spring Joint Enabled");
// print("Sprint Joint Distance:" + m_springJoint2D.distance);
m_distanceJoint2D.connectedAnchor = grapplePoint; m_distanceJoint2D.connectedAnchor = grapplePoint;
} }
@ -105,7 +95,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
m_springJoint2D.connectedAnchor = grapplePoint; m_springJoint2D.connectedAnchor = grapplePoint;
m_springJoint2D.enabled = true; m_springJoint2D.enabled = true;
// print("Spring Joint Enabled");
m_distanceJoint2D.connectedAnchor = grapplePoint; m_distanceJoint2D.connectedAnchor = grapplePoint;
} }
@ -123,7 +112,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
m_springJoint2D.connectedAnchor = grapplePoint; m_springJoint2D.connectedAnchor = grapplePoint;
m_springJoint2D.enabled = true; m_springJoint2D.enabled = true;
// print("Spring Joint Enabled");
m_distanceJoint2D.connectedAnchor = grapplePoint; m_distanceJoint2D.connectedAnchor = grapplePoint;
} }
@ -135,7 +123,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
inDistanceRange = false; inDistanceRange = false;
m_rigidBody2D.gravityScale = 1; m_rigidBody2D.gravityScale = 1;
gunPivot.rotation = Quaternion.AngleAxis(90, Vector3.forward); gunPivot.rotation = Quaternion.AngleAxis(90, Vector3.forward);
// print("disabled");
} }
} }

View File

@ -32,7 +32,6 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
private void OnEnable() { private void OnEnable() {
// print("on enabled called");
moveTime = 0; moveTime = 0;
m_lineRenderer.positionCount = precision; m_lineRenderer.positionCount = precision;
waveSize = startWaveSize; waveSize = startWaveSize;
@ -45,7 +44,6 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
} }
private void OnDisable() { private void OnDisable() {
// print("on disabled called");
m_lineRenderer.enabled = false; m_lineRenderer.enabled = false;
isGrappling = false; isGrappling = false;
hasPlayedThwip = false; hasPlayedThwip = false;
@ -69,13 +67,7 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
} }
void DrawRope() { void DrawRope() {
// print("drawing");
// print("isGrappling: " + isGrappling);
if (!straightLine) { if (!straightLine) {
// float roundedLinePos = Mathf.Round(m_lineRenderer.GetPosition(precision - 1).x * 100.0f) * .01f;
// float roundedGrapplePos = Mathf.Round(m_lineRenderer.GetPosition(precision - 1).x * 100.0f) * .01f;
// // print(roundedLinePos + " / " + roundedGrapplePos);
// if (roundedLinePos == roundedGrapplePos) {
if (m_lineRenderer.GetPosition(precision - 1).x == grapplingGun.grapplePoint.x) { if (m_lineRenderer.GetPosition(precision - 1).x == grapplingGun.grapplePoint.x) {
straightLine = true; straightLine = true;
} else { } else {
@ -100,7 +92,6 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
} }
void DrawRopeWaves() { void DrawRopeWaves() {
// print(moveTime);
for (int i = 0; i < precision; i++) { for (int i = 0; i < precision; i++) {
float delta = (float)i / ((float)precision - 1f); float delta = (float)i / ((float)precision - 1f);
Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize; Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize;