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:
parent
c13793565d
commit
b6804e2986
@ -45,8 +45,5 @@ public class CameraMovement : MonoBehaviour {
|
||||
|
||||
public void FindPlayer() {
|
||||
player = GameObject.FindGameObjectWithTag("Player");
|
||||
// if (player == null) {
|
||||
// print("null player!");
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ public class DebugSceneSwitcher : MonoBehaviour
|
||||
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
|
||||
{
|
||||
string newName = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i));
|
||||
print(newName);
|
||||
sceneNames.Add(newName);
|
||||
}
|
||||
sceneDropdown.AddOptions(sceneNames);
|
||||
@ -45,7 +44,6 @@ public class DebugSceneSwitcher : MonoBehaviour
|
||||
|
||||
public void ChangeScene(int index)
|
||||
{
|
||||
// print(index);
|
||||
SceneController.Instance.LoadChosenScene(index);
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ public class DialogBoxes : MonoBehaviour
|
||||
{
|
||||
textField = this.gameObject.GetComponent<TMP_Text>();
|
||||
ReconfigureSpriteArray();
|
||||
print("reconfigured");
|
||||
textField.text = dialogMessages[0];
|
||||
backgroundImageObject.sprite = images[0];
|
||||
}
|
||||
@ -36,8 +35,6 @@ public class DialogBoxes : MonoBehaviour
|
||||
messageCount += 1;
|
||||
if (messageCount < dialogMessages.Length)
|
||||
{
|
||||
print("looking at message " + messageCount);
|
||||
print("messages: " + dialogMessages.Length + ", images: " + images.Length);
|
||||
textField.text = dialogMessages[messageCount];
|
||||
backgroundImageObject.sprite = images[messageCount];
|
||||
}
|
||||
@ -53,11 +50,9 @@ public class DialogBoxes : MonoBehaviour
|
||||
|
||||
void ReconfigureSpriteArray()
|
||||
{
|
||||
print("attempting to reconfigure");
|
||||
// resize if need to
|
||||
if (images.Length != dialogMessages.Length)
|
||||
{
|
||||
print("resizing");
|
||||
Sprite[] newImagesArray = new Sprite[dialogMessages.Length];
|
||||
for (int i = 0; i < newImagesArray.Length; i++)
|
||||
{
|
||||
@ -78,7 +73,6 @@ public class DialogBoxes : MonoBehaviour
|
||||
images[i] = images[i - 1];
|
||||
}
|
||||
}
|
||||
print(images.Length);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -86,11 +86,8 @@ public class EnemyPatrol : MonoBehaviour {
|
||||
this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
|
||||
animator.Play("Explosion");
|
||||
float explosionTime = .25f;
|
||||
// print("explosiontime: " + explosionTime);
|
||||
this.gameObject.GetComponent<AudioSource>().Play();
|
||||
// print("reached early point");
|
||||
yield return new WaitForSeconds(explosionTime);
|
||||
// print("reached late point");
|
||||
this.gameObject.GetComponent<BoxCollider2D>().enabled = true;
|
||||
isPlayingDefeatAnimation = false;
|
||||
this.gameObject.SetActive(false);
|
||||
|
@ -24,7 +24,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
private bool isDash = false;
|
||||
public float dashForce = 1f;
|
||||
public float dashTime = 1.0f;
|
||||
private float dashInc = 0.1f;
|
||||
private float currentDash = 0.0f;
|
||||
private bool forceAdded = false;
|
||||
Vector2 dashVec;
|
||||
@ -146,9 +145,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
if (this.playerInput.actions["CymbalCrash"].WasPressedThisFrame()) {
|
||||
// Play the sound
|
||||
this.gameUI.ToggleCymbal(false);
|
||||
// this.audioSource.clip = cymbalSound;
|
||||
// this.audioSource.loop = false;
|
||||
// this.audioSource.Play();
|
||||
cymbalAudio.Play();
|
||||
|
||||
// Set the cymbal active for the equivalent of one second
|
||||
@ -226,7 +222,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
void LetGoOfGrapple() {
|
||||
bool currentlyPaused = StateController.Instance.isPaused;
|
||||
if (grapplingRope.isGrappling && !currentlyPaused) {
|
||||
// print("currently paused is " + currentlyPaused + ", releasing grapple");
|
||||
if (tambourine != null) {
|
||||
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
|
||||
}
|
||||
@ -241,7 +236,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
else {
|
||||
reflect = new Vector2(saveVelocity.x * reflectForce, -(saveVelocity.y) * reflectForce);
|
||||
//reflect = new Vector2(saveVelocity.x * 1.1f, -(saveVelocity.y) * reflectForce);
|
||||
hasBounced = true;
|
||||
}
|
||||
_rb.AddForce(reflect, ForceMode2D.Impulse);
|
||||
@ -250,7 +244,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
|
||||
void Water() {
|
||||
print("water dash " + isDash);
|
||||
if(isDash) {
|
||||
saveVelocity = _rb.velocity / velocityCut;
|
||||
if (isDash) {
|
||||
@ -268,7 +261,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
grappleSurface = col.gameObject;
|
||||
}
|
||||
else if (col.tag == "instaDeath") {
|
||||
print("player fell in spikes");
|
||||
StartCoroutine(DestroyPlayer());
|
||||
}
|
||||
else if (col.tag == "spawnPoint") {
|
||||
@ -331,7 +323,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
else {
|
||||
StartCoroutine(DestroyPlayer());
|
||||
print("enemy defeated player");
|
||||
}
|
||||
}
|
||||
else if (collision.gameObject.tag == "Projectile") {
|
||||
@ -365,7 +356,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
if (grapplingRope.isGrappling) {
|
||||
LetGoOfGrapple();
|
||||
}
|
||||
// print("destroyPlayer called");
|
||||
playerIsAlive = false;
|
||||
audioSource.clip = deathSound;
|
||||
audioSource.loop = false;
|
||||
@ -378,14 +368,10 @@ public class PlayerBehavior : MonoBehaviour
|
||||
|
||||
// destroy all tambourines
|
||||
GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine");
|
||||
print("tambs found: " + currentTambourines.Length);
|
||||
if (currentTambourines != null) {
|
||||
foreach (GameObject tambourine in currentTambourines) {
|
||||
if (tambourine != null) {
|
||||
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
|
||||
print("tamb destroyed");
|
||||
} else {
|
||||
print("null tamb");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
isRegFalling = false;
|
||||
}
|
||||
else {
|
||||
// print("not jumping");
|
||||
if (!_isJumpFalling && !isRegFalling) {
|
||||
if (unlockedTrumpet) {
|
||||
trumpet = 1;
|
||||
@ -143,7 +142,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
#region JUMP CHECKS
|
||||
if (IsJumping && RB.velocity.y <= 0) {
|
||||
IsJumping = false;
|
||||
// print("isJumping " + IsJumping);
|
||||
_isJumpFalling = true;
|
||||
}
|
||||
|
||||
@ -162,7 +160,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
_isJumpFalling = false;
|
||||
|
||||
bool inCoyoteTime = LastOnGroundTime > 0;
|
||||
//print("coyote time: " + inCoyoteTime);
|
||||
|
||||
Jump();
|
||||
|
||||
@ -186,7 +183,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
// stop sound if needed
|
||||
if (soundPlaying && (isRegFalling || IsJumping || _isJumpFalling)) {
|
||||
print("footsteps stop");
|
||||
audioSource.Stop();
|
||||
soundPlaying = false;
|
||||
}
|
||||
@ -201,10 +197,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
#region GRAVITY
|
||||
//Higher gravity if we've released the jump input or are falling
|
||||
// if (IsSliding)
|
||||
// {
|
||||
// SetGravityScale(0);
|
||||
// }
|
||||
if (RB.velocity.y < 0 && _moveInput.y < 0) {
|
||||
//Much higher gravity if holding down
|
||||
SetGravityScale(Data.gravityScale * Data.fastFallGravityMult);
|
||||
@ -234,13 +226,11 @@ public class PlayerMovement : MonoBehaviour
|
||||
#region SOUND CHECKS
|
||||
if (!IsJumping && !_isJumpFalling && !isRegFalling && _moveInput.x != 0) {
|
||||
if (!soundPlaying) {
|
||||
// print("footsteps PLAY");
|
||||
audioSource.Play();
|
||||
soundPlaying = true;
|
||||
}
|
||||
}
|
||||
else if (soundPlaying && audioSource.clip.name == "footsteps") {
|
||||
// print("footsteps stop");
|
||||
audioSource.Stop();
|
||||
soundPlaying = false;
|
||||
}
|
||||
@ -375,7 +365,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -44,19 +44,8 @@ public class PlayerData : ScriptableObject
|
||||
public float jumpHangAccelerationMult;
|
||||
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)]
|
||||
|
||||
[Header("Slide")]
|
||||
public float slideSpeed;
|
||||
public float slideAccel;
|
||||
|
||||
[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 jumpInputBufferTime; //Grace period after pressing jump where a jump will be automatically performed once the requirements (eg. being grounded) are met.
|
||||
|
@ -29,11 +29,6 @@ public class SceneController : MonoBehaviour
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
GameObject pauseMenu = GameObject.Find("PauseMenuCanvas");
|
||||
if (pauseMenu != null)
|
||||
{
|
||||
// Button quitButton = GameObject.Find("QuitButton").GetComponent<Button>();
|
||||
// quitButton.onClick.AddListener(BackToMainMenu);
|
||||
}
|
||||
if (scene.buildIndex == 0)
|
||||
{ // if this is the menu
|
||||
GameObject.Find("NewGameButton").GetComponent<Button>().onClick.AddListener(NextScene);
|
||||
|
@ -92,10 +92,6 @@ public class StateController : MonoBehaviour
|
||||
if (deathCanvas != null)
|
||||
{
|
||||
Button respawnButton = GameObject.Find("RespawnButton").GetComponent<Button>();
|
||||
if (respawnButton == null)
|
||||
{
|
||||
print("respawn button not found!");
|
||||
}
|
||||
respawnButton.onClick.AddListener(RespawnPlayer);
|
||||
deathCanvas.SetActive(false);
|
||||
}
|
||||
@ -120,7 +116,6 @@ public class StateController : MonoBehaviour
|
||||
|
||||
// keep track of all enemies
|
||||
enemiesInScene = GameObject.FindGameObjectsWithTag("Enemy");
|
||||
// print(enemiesInScene);
|
||||
|
||||
if (isPaused)
|
||||
{
|
||||
|
@ -30,7 +30,6 @@ public class TambourineBehavior : MonoBehaviour {
|
||||
|
||||
|
||||
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);
|
||||
StartCoroutine(CheckToDestroy());
|
||||
}
|
||||
@ -41,15 +40,12 @@ public class TambourineBehavior : MonoBehaviour {
|
||||
} else {
|
||||
if (collidedObject != null && collidedObject.tag != "grappleSurface" && !returnToPlayer) {
|
||||
rb.constraints = RigidbodyConstraints2D.FreezeAll;
|
||||
// this.gameObject.transform.position = col.transform.position;
|
||||
timeLerped += Time.deltaTime;
|
||||
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")) {
|
||||
pinned = true;
|
||||
animator.SetBool("pinned", true);
|
||||
tambourineHitSound.Play();
|
||||
} else {
|
||||
// print("pinned, but not same position: " + this.gameObject.transform.position + " / " + collidedObject.transform.position);
|
||||
}
|
||||
} else if (returnToPlayer) {
|
||||
Destroy(rb);
|
||||
@ -68,17 +64,14 @@ public class TambourineBehavior : MonoBehaviour {
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D col) {
|
||||
// print(col.tag);
|
||||
if (col.tag == "Enemy") {
|
||||
this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
|
||||
collidedObject = col.gameObject;
|
||||
// print("Pinning to enemy");
|
||||
this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
|
||||
collidedObject.GetComponent<EnemyPatrol>().TogglePin(true, this);
|
||||
} else if (col.tag == "Projectile") {
|
||||
this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
|
||||
collidedObject = col.gameObject;
|
||||
// print("pinned to projectile");
|
||||
this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
|
||||
collidedObject.GetComponent<ProjectileBehavior>().Pin();
|
||||
}
|
||||
@ -92,7 +85,6 @@ public class TambourineBehavior : MonoBehaviour {
|
||||
|
||||
IEnumerator CheckToDestroy() {
|
||||
yield return new WaitForSeconds(3f);
|
||||
// print("waited 5");
|
||||
if (!player.GetComponent<PlayerBehavior>().grapplingRope.isGrappling) {
|
||||
DestroySelf();
|
||||
}
|
||||
|
@ -8,9 +8,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
[Header("Scripts References:")]
|
||||
public Tutorial_GrapplingRope grappleRope;
|
||||
|
||||
[Header("Main Camera:")]
|
||||
public Camera m_camera;
|
||||
|
||||
[Header("Transform References:")]
|
||||
public Transform gunHolder;
|
||||
public Transform gunPivot;
|
||||
@ -41,7 +38,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
|
||||
|
||||
void Start() {
|
||||
m_camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
|
||||
grappleRope.enabled = false;
|
||||
m_springJoint2D.enabled = false;
|
||||
m_distanceJoint2D.distance = targetDistance + .5f;
|
||||
@ -51,11 +47,7 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
|
||||
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) {
|
||||
// print(Vector2.Distance(grapplePoint, new Vector2(m_rigidBody2D.transform.position.x, m_rigidBody2D.transform.position.y)) + ", target: " + targetDistance);
|
||||
inDistanceRange = true;
|
||||
}
|
||||
if (grappleRope.isGrappling) {
|
||||
@ -80,14 +72,12 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
|
||||
public void Grapple() {
|
||||
grappleDistanceVector = grapplePoint - (Vector2)gunPivot.position;
|
||||
// print("grapple");
|
||||
|
||||
m_springJoint2D.autoConfigureDistance = false;
|
||||
m_distanceJoint2D.autoConfigureDistance = false;
|
||||
|
||||
m_springJoint2D.connectedAnchor = grapplePoint;
|
||||
m_springJoint2D.enabled = true;
|
||||
// print("Spring Joint Enabled");
|
||||
// print("Sprint Joint Distance:" + m_springJoint2D.distance);
|
||||
|
||||
m_distanceJoint2D.connectedAnchor = grapplePoint;
|
||||
}
|
||||
@ -105,7 +95,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
|
||||
m_springJoint2D.connectedAnchor = grapplePoint;
|
||||
m_springJoint2D.enabled = true;
|
||||
// print("Spring Joint Enabled");
|
||||
|
||||
m_distanceJoint2D.connectedAnchor = grapplePoint;
|
||||
}
|
||||
@ -123,7 +112,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
|
||||
m_springJoint2D.connectedAnchor = grapplePoint;
|
||||
m_springJoint2D.enabled = true;
|
||||
// print("Spring Joint Enabled");
|
||||
|
||||
m_distanceJoint2D.connectedAnchor = grapplePoint;
|
||||
}
|
||||
@ -135,7 +123,6 @@ public class Tutorial_GrapplingGun : MonoBehaviour {
|
||||
inDistanceRange = false;
|
||||
m_rigidBody2D.gravityScale = 1;
|
||||
gunPivot.rotation = Quaternion.AngleAxis(90, Vector3.forward);
|
||||
// print("disabled");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
|
||||
|
||||
|
||||
private void OnEnable() {
|
||||
// print("on enabled called");
|
||||
moveTime = 0;
|
||||
m_lineRenderer.positionCount = precision;
|
||||
waveSize = startWaveSize;
|
||||
@ -45,7 +44,6 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
|
||||
}
|
||||
|
||||
private void OnDisable() {
|
||||
// print("on disabled called");
|
||||
m_lineRenderer.enabled = false;
|
||||
isGrappling = false;
|
||||
hasPlayedThwip = false;
|
||||
@ -69,13 +67,7 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
|
||||
}
|
||||
|
||||
void DrawRope() {
|
||||
// print("drawing");
|
||||
// print("isGrappling: " + isGrappling);
|
||||
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) {
|
||||
straightLine = true;
|
||||
} else {
|
||||
@ -100,7 +92,6 @@ public class Tutorial_GrapplingRope : MonoBehaviour {
|
||||
}
|
||||
|
||||
void DrawRopeWaves() {
|
||||
// print(moveTime);
|
||||
for (int i = 0; i < precision; i++) {
|
||||
float delta = (float)i / ((float)precision - 1f);
|
||||
Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize;
|
||||
|
Loading…
Reference in New Issue
Block a user