private void Jump() { if (Input.GetKeyDown(KeyCode.Space) && !isDoubleJump) { Debug.Log(TotalScript.GetGravity()); if (!TotalScript.GetGravity()) { rb.AddForce(new Vector2(0, jumpForce)); animator.SetBool("IsJump", true); animator.SetBool("IsOnLadderUp", false); animator.SetBool("IsOnLadderDown", false); } else { rb.AddForce(new Vector2(0, -jumpForce)); animator.SetBool("IsJump", true); animator.SetBool("IsOnLadderUp", false); animator.SetBool("IsOnLadderDown", false); } if (isGrounded == false) { isDoubleJump = true; } isGrounded = false; } }
public void Update() { if (isNormalRotation != TotalScript.GetGravity()) { isNormalRotation = TotalScript.GetGravity(); TotalScript.GravityFlip(gameObject); } }
private void Update() { if (shield != null && !TotalScript.GetGravity()) { shield.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); } else if (shield != null && TotalScript.GetGravity()) { shield.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1); } if (isOnCooldown) { timer += Time.deltaTime; if (timer >= attackDelay) { timer = 0; isOnCooldown = false; if (coolDownObject != null) { coolDownObject.GetComponent <SpriteRenderer>().color = new Color(1, 0, 1, 1); } } } }
public void Start() { isNormalRotation = TotalScript.GetGravity(); }