// Update is called once per frame void FixedUpdate() { if (isUsingLadder) { if (MyInput.GetKey(MyKeyCode.Right)) { Move(Direction.right); } if (MyInput.GetKey(MyKeyCode.Left)) { Move(Direction.left); } if (MyInput.GetKey(MyKeyCode.Up)) { UpLadder(); } if (MyInput.GetKey(MyKeyCode.Down)) { DownLadder(); } if (MyInput.GetKeyUp(MyKeyCode.Up)) { PlayManager.Instance.Player.IsLadderAction = false; } if (MyInput.GetKeyUp(MyKeyCode.Down)) { PlayManager.Instance.Player.IsLadderAction = false; } } }
private void Action() //장착된 무기의 action을 실행 { if (!PlayManager.Instance.Player.equip.equipedWeapon.onAttack) { if (isDashing) { if (SaveManager.GetSkillUnlockInfo(2)) { PlayManager.Instance.Player.equip.equipedWeapon.DashAttack(atkBuff, attackSpd); StartCoroutine(DashAttacking()); } return; } else if (MyInput.GetKey(MyKeyCode.Down) && !IsGround && !isJumpSkillUsing) { if (SaveManager.GetSkillUnlockInfo(1)) { PlayManager.Instance.Player.equip.equipedWeapon.JumpSkillAction(atkBuff, attackSpd); } return; } else { if (PlayManager.Instance.Player.equip.equipedWeapon.atkCooltime <= 0f) { PlayManager.Instance.Player.equip.equipedWeapon.Action(atkBuff, attackSpd); } } } }
// Update is called once per frame protected virtual void Update() { if (MyInput.GetKey(code)) { Vector3 targetScreenPos = Camera.main.WorldToViewportPoint(transform.position); if (targetScreenPos.x >= 0f && targetScreenPos.x <= 1f && targetScreenPos.y >= 0f && targetScreenPos.y <= 1f) { Trigger(); } } }
private void FixedUpdate() { float move = 0f; if (Input.GetKey(KeyCode.D) || MyInput.GetKey(MyKeyCode.Right)) { move = 1f; } else if (Input.GetKey(KeyCode.A) || MyInput.GetKey(MyKeyCode.Left)) { move = -1f; } gameObject.transform.Translate(gameObject.transform.right * 0.05f * move); }
protected override void FixedUpdate() //물리연산용 { base.FixedUpdate(); CheckGround(); if (IsMovable) { if (MyInput.GetKey(MyKeyCode.Right)) { anim.SetBool("isRunning", true); Move(Direction.right); } if (MyInput.GetKey(MyKeyCode.Left)) { sprite.GetComponent <SpriteRenderer>().flipX = true; anim.SetBool("isRunning", true); Move(Direction.left); } } }
protected override void Update() { if (isAtObject) { if (MyInput.GetKey(MyKeyCode.Up)) { if (PlayManager.Instance.Player.transform.position.y <= transform.position.y + transform.lossyScale.y / 2f + 0.1f) { LadderIn(true); } } if (MyInput.GetKey(MyKeyCode.Down)) { if (PlayManager.Instance.Player.transform.position.y >= transform.position.y + transform.lossyScale.y / 2f) { LadderIn(false); } } } }
public void Dash() { isDashing = true; if (MyInput.GetKey(MyKeyCode.Right)) { StartCoroutine(PlayerDash(Direction.right)); sprite.GetComponent <SpriteRenderer>().flipX = false; } else if (MyInput.GetKey(MyKeyCode.Left)) { StartCoroutine(PlayerDash(Direction.left)); sprite.GetComponent <SpriteRenderer>().flipX = true; } else { StartCoroutine(PlayerDash(direction)); } anim.SetBool("isRunning", false); anim.SetBool("isDash", true); anim.Play("dash"); }
IEnumerator PlayerDash(Direction dir) { float timer = 0; IsSuper = dashInvincibleTime; PlayManager.Instance.DoSkill(Skill.Dash); SoundDelegate.Instance.PlayEffectSound(EffectSoundType.Dash); while (timer < dashTime) { yield return(new WaitForFixedUpdate()); //물리적인 이동같은건 fixedUpdate로 if (stopDash) { Debug.Log("StopDash"); stopDash = false; break; } spd = Mathf.Lerp(Spd * 4f, Spd * 2f, timer / dashTime); Move(dir); timer += Time.fixedDeltaTime; } if (MyInput.GetKey(MyKeyCode.Right)) { anim.SetBool("isRunning", true); } if (MyInput.GetKey(MyKeyCode.Left)) { anim.SetBool("isRunning", true); } anim.SetBool("isDash", false); isDashing = false; isDashable = dashCoolTime; }