public void StartMove(string name) { curMove = name; attack = transform.Find(curMove).gameObject; attackRef = attack.GetComponent <Attack>(); PC.Lag(attackRef.CA.GetMoveLength(), "recovery"); }
public void StartJump() { JumpReset(); if (PC.IsGrounded) { rb.velocity = new Vector2((float)PC.CurHorizDir * PC.Momentum, PC.CD.FullHopHeight); // For now, we will always jump at fullhopheight PC.Lag(PC.CD.LagJump, "recovery"); } else { if (PC.DoubleJumpCount < PC.CD.MaxDoubleJumps && PC.MidairOptionsCount < PC.CD.MaxMidairOptions) { rb.velocity = new Vector2((float)PC.CurHorizDir * PC.Momentum, PC.CD.MidAirJumpHeight); // Will midAirJump if airborne and have enough midair jumps left PC.DoubleJumpCount++; PC.MidairOptionsCount++; PC.Lag(PC.CD.LagDoubleJump, "recovery"); } } }
// This needs WORK but it works for now. We don't want the dash to be so instant public void SetAirDash() { // Should AirDash cancel lag? currently: yes if (PC.IsInLag && PC.LagType != "hit") { //return; PC.Lag(0, "none"); } if (PC.MidairOptionsCount < PC.CD.MaxMidairOptions && PC.CurHorizDir != 0) { PC.Lag(PC.CD.LagAirDash, "recovery"); ChooseDirection(); PC.PlayerAnimator.SetTrigger("AIRDASH"); curPos = transform.position; finalPos = transform.position + PC.CurHorizDir * new Vector3(PC.CD.AirDashDist + PC.Momentum - 1, 0, 0); step = Mathf.Abs(curPos.x - finalPos.x) / PC.CD.LagAirDash; PC.MidairOptionsCount++; isDashing = true; } }
public void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Ground") { if (PC.LagType == "hit" && bounce < maxBounces) { Bounce(); return; } bounce = 0; if (PC.IsInLag) { PC.Lag(PC.CD.LagHardLand, "landing"); } else { PC.Lag(PC.CD.LagNormalLand, "landing"); } SetGrounded(); } }