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 EnteringState() { Owner.Velocity.y = 0.0f; yPos = Owner.transform.position.y; SetAnim(); RecBounds ab = Owner.ActorBounds; Owner.RunningParts.Position = new Vector3(ab.center.x, ab.bottom, Owner.RunningParts.Position.z); runningNoise = new FadeLoopNoise(WorldConstants.PlayPhysNoises.GetNoise(PlayerPhysicsNoises.Events.Run), "Running"); }
/// <summary> /// Changes state to levitating. /// </summary> public void Levitate() { State = States.Levitated; Vector3 playerToMe = (MyRigid.position - Human.MyTransform.position).normalized; Levitating.TargetDir = new Vector2(playerToMe.x, playerToMe.z); MyRigid.AddTorque(new Vector3(Levitating.InitialRotImpulseVariance.x * (-1.0f + (2.0f * Random.value)), Levitating.InitialRotImpulseVariance.y * (-1.0f + (2.0f * Random.value)), Levitating.InitialRotImpulseVariance.z * (-1.0f + (2.0f * Random.value))), ForceMode.Impulse); if (HoveringNoise == null) HoveringNoise = new FadeLoopNoise(AudioSources.Instance.LevitateLoopNoiseSourcePrefab, transform, "Levitation loop"); HoveringNoise.StartLoop(); }
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; }
void Awake() { backgroundCheering = new FadeLoopNoise(BackgroundCheersPrefab, "Background Cheers"); }
void Start() { if (ThrowableMeshRenderer != null) ThrowableMeshRenderer.material = ThrowableMaterialController.Instance.ThrowableMat; if (HoveringNoise == null) HoveringNoise = new FadeLoopNoise(AudioSources.Instance.LevitateLoopNoiseSourcePrefab, transform, "HoverLoop"); }