void FixedUpdate() { if (!IsDead) { //Ground speed grounded = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, groundLayer); Anime.SetBool("isGrounded", grounded); Anime.SetFloat("verticalSpeed", RB.velocity.y); //Movement float move = Input.GetAxis("Horizontal"); Anime.SetFloat("Speed", Mathf.Abs(move)); RB.velocity = new Vector2(move * maxSpeed, RB.velocity.y); //Facing left and right if (move > 0 && !facingRight || move < 0 && facingRight) { ChangeDirection(); } HandleAttacks(); attack = false; } }
protected virtual void ClimbInput() { Anime.SetFloat(GlobalVar.AnimeValue.CState, NowInput.UpDnAxis == 0 ? 0 : NowInput.UpDnAxis > 0 ? 1 : -1); if (State == GlobalVar.State.Climb) { Main.position += Vector3.up * NowInput.UpDnAxis * GlobalVar.PlayerValue.ClimbSpeed * Time.fixedDeltaTime; } }
public override void StateUpdate() { if (waitForBeat) { GetDestination(); Agent.SetDestination(currentTargetPos); Anime.SetFloat("Velocity", Agent.velocity.magnitude / Agent.speed); if (engine.CurrentHP > 0) { if (Agent.hasPath && goingForNexus && (Vector3.ProjectOnPlane(currentTargetPos, Vector3.up) - Vector3.ProjectOnPlane(Agent.transform.position, Vector3.up)).magnitude < nexusAttackRange) { if (Ai.EnemyType == Enemy.shooterAi) { TransitionTo <AiRangedAttackNexus>(); } else { TransitionTo <AiCoreAttackState>(); } } else if (Agent.hasPath && !goingForNexus && (Vector3.ProjectOnPlane(currentTargetPos, Vector3.up) - Vector3.ProjectOnPlane(Agent.transform.position, Vector3.up)).magnitude < attackRange && Agent.remainingDistance < 0.1f) { shouldFreeSlot = false; TransitionTo <AiAttack>(); } else if (Agent.hasPath && !goingForNexus && Vector3.Distance(Ai.transform.position, PlayerTransform.position) < attackRange) { shouldFreeSlot = false; TransitionTo <AiAttack>(); } } } if (Agent.isOnOffMeshLink) { disableAgent = false; TransitionTo <AiFall>(); } if (Agent.hasPath && Agent.velocity.magnitude == 0f) { if (resetTimer > 1f) { Agent.SetDestination(new Vector3(-33.17f, 0, -50.89f)); resetTimer = 0; } else { resetTimer += Time.deltaTime; } } }
private void SetUpAttack() { Agent.velocity = Vector3.zero; Anime.SetFloat("Velocity", 0f); Anime.SetTrigger(currentAttack.AttackTag); playedIdle = false; hitObjects.Clear(); timer = 0; wasInWindow = false; foreach (ParticleSystem x in chargeUpVFXs) { x.Stop(); x.Play(); } }
public void move() { Anime.SetFloat("Speed", 1); transform.Translate(GetDirecton() * (maxSpeed * Time.deltaTime)); }