public override void EnteringState() { tryBreakContactTime = 0.0f; //Set the reflection direction. if (JumpDir > 0) { Owner.MeshController.SetDir(SetMeshFor2D.ReflectDir.Right); float oldVX = Owner.WallslidingParts.WorldVelocity.x; RecBounds a = Owner.ActorBounds; Owner.WallslidingParts.Position = new Vector3(a.left, a.center.y, Owner.WallslidingParts.Position.z); } else { Owner.MeshController.SetDir(SetMeshFor2D.ReflectDir.Left); RecBounds a = Owner.ActorBounds; Owner.WallslidingParts.Position = new Vector3(a.right, a.center.y, Owner.WallslidingParts.Position.z); } //Set the animation. Owner.Animator.CurrentAnimation = Animations.P_WallSlide; //Keep the player flush with the wall. Owner.Velocity.x = 0.0f; //Make the sliding noise. slidingNoise = new FadeLoopNoise(WorldConstants.PlayPhysNoises.GetNoise(PlayerPhysicsNoises.Events.Slide), "Sliding on Wall"); slidingNoise.StartLoop(); slidingNoiseMaxVolume = slidingNoise.Loop.GetComponent <ControlledNoise>().MaxVolume; }
public override void AfterFixed() { //Update running sound. if (!StateMachine.WithinError(Owner.Velocity.x, 0.0f, WorldConstants.MinMovementSpeed)) { runningNoise.StartLoop(); } else { runningNoise.EndLoop(); } if (runningNoise.Running) { runningNoise.UpdateLoop(); } //Check current wall collisions. if (Owner.ColManager.WallSides[ColType.Top].Count == 0) { Owner.ChangeState(ScriptableObject.CreateInstance <InAirState>(), false); } if (Owner.ColManager.WallSides[ColType.Left].Count > 0) { dontPlayEffects = true; HitSide(Owner.ColManager.WallSides[ColType.Left][0], ColType.Left); dontPlayEffects = false; } if (Owner.ColManager.WallSides[ColType.Right].Count > 0) { dontPlayEffects = true; HitSide(Owner.ColManager.WallSides[ColType.Right][0], ColType.Right); dontPlayEffects = false; } //Update the correct timing stat. Owner.OwnerStats.TimeOnGround += Time.fixedDeltaTime; }
public override void EnteringState() { Owner.Animator.CurrentAnimation = Animations.P_CeilingSlide; originalParticleYSpeed = Owner.RunningParts.WorldVelocity.y; Owner.RunningParts.WorldVelocity = new Vector3(Owner.RunningParts.WorldVelocity.x, 0.0f); RecBounds ab = Owner.ActorBounds; Owner.RunningParts.Position = new Vector3(ab.center.x, ab.top, Owner.RunningParts.Position.z); //Make the sliding noise. if (useSlidingNoise) { slidingNoise = new FadeLoopNoise(WorldConstants.PlayPhysNoises.GetNoise(PlayerPhysicsNoises.Events.Slide), "Sliding on Ceiling"); } else { slidingNoise = new FadeLoopNoise(WorldConstants.PlayPhysNoises.GetNoise(PlayerPhysicsNoises.Events.Run), "Runnin on Ceiling"); } slidingNoise.StartLoop(); slidingNoiseMaxVolume = slidingNoise.Loop.GetComponent <ControlledNoise>().MaxVolume; }
public void StartCheering() { startedCheering = true; backgroundCheering.StartLoop(); }