public override void Exit() { hasGivenInput = false; Time.timeScale = 1; SwordSwingVFX.Stop(); IsAttackFreeze = false; PlayerAnimator.transform.localPosition = Vector3.zero; if (RelevantCombos.Count == 0 || CurrentAttacks[AttackIndex].RootMotion) { Velocity = Vector3.zero; } PlayerAnimator.SetTrigger("ToIdle"); }
private void SetupVFX() { SwordSwingVFX.Stop(); SwordSwingVFX.transform.localScale = Vector3.one * CurrentAttacks[AttackIndex].Radius * (CurrentAttacks[AttackIndex].AngleOffset < 0 ? -1f : 1f); SwordSwingVFX.transform.localRotation = (Quaternion.Euler(0, (CurrentAttacks[AttackIndex].AngleOffset < 0 ? 180 : 0), 90)); ParticleSystem.MainModule main = SwordSwingVFX.main; main.simulationSpeed = VFXSimulationSpeed; //Cached our sword mat, if anything start bugging out, replace swordswingmat with GetComponent swordSwingMat = CurrentAttacks[AttackIndex].VFXSwingMaterial; SwordSwingVFX.GetComponent <ParticleSystemRenderer>().material.SetFloat("_IntensityBlend", currentAttackGrade == RhythmGrade.Miss ? 0 : 1); Debug.Log("Grade is: " + swordSwingMat.GetFloat("_IntensityBlend")); }
public override void StateUpdate() { if (IsAttackFreeze) { if (freezTimer <= 0) { Time.timeScale = 1; IsAttackFreeze = false; } freezTimer -= Time.unscaledDeltaTime; return; } if (player.CheckSyncPower()) { return; } if (Input.GetButtonDown("Dash")) { TransitionTo <PlayerDashState>(); AttackIndex = 0; SetRelevantCombos(AttackStruct.InputButton.Light); hasGivenInput = false; return; } if (currentFrame > CurrentAttacks[AttackIndex].VfxWindow.x && !SwordSwingVFX.isPlaying && currentFrame < CurrentAttacks[AttackIndex].VfxWindow.y) { SwordSwingVFX.Play(); } else if (currentFrame > CurrentAttacks[AttackIndex].VfxWindow.y) { SwordSwingVFX.Clear(); } if (DirectionInput.magnitude > 0) { Vector3 lookDirection = Vector3.Lerp(PlayerAnimator.transform.position + PlayerAnimator.transform.forward, PlayerAnimator.transform.position + Vector3.ProjectOnPlane(GetInputRelativeToCamera(), Vector3.up), Time.deltaTime * RotationSpeed); PlayerAnimator.transform.LookAt(lookDirection, Vector3.up); } Attacking(); if (RelevantCombos.Count == 0) { return; } CheckForMovementCollsion(); timer += Time.deltaTime; firstFrame = false; if (!hasStarted) { hasStarted = PlayerAnimator.GetCurrentAnimatorStateInfo(attackAnimLayer).IsName(CurrentAttacks[AttackIndex].AttackTag) || PlayerAnimator.GetNextAnimatorStateInfo(attackAnimLayer).IsName(CurrentAttacks[AttackIndex].AttackTag); return; } if (inAttackWindow) { HighruleSwordCollision(); } if (timer < currentClipLength) { return; } TransitionTo <PlayerGroundState>(); }
public override void Initialize(object owner) { base.Initialize(owner); swordSwingMat = SwordSwingVFX.GetComponent <ParticleSystemRenderer>().material; }