void FixedUpdate() { var emission = dustParticles.emission; if (pc.IsSpeeding() && groundCheck.TouchingWall()) { RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.down, 5, 1 << LayerMask.NameToLayer(Layers.Ground)); if (hit.collider != null) { var pos = dustParticles.transform.position; pos.y = hit.point.y; dustParticles.transform.position = pos; } emission.enabled = true; } else { emission.enabled = false; } if (pc.IsSpeeding() && trails.Count > 0) { foreach (TrailRenderer t in trails) { t.emitting = true; } } else if (!pc.IsSpeeding() && trails.Count > 0) { foreach (TrailRenderer t in trails) { t.emitting = false; } } }
void UpdateWallSliding() { bool touchingLastFrame = touchingWall; touchingWall = wallCheck.TouchingWall() && !dead; if (!touchingLastFrame && touchingWall) { OnWallHit(); } else if (touchingLastFrame && !touchingWall) { OnWallLeave(); } }
void UpdateWallSliding() { GameObject touchingLastFrame = touchingWall; touchingWall = wallCheck.TouchingWall(); if (!touchingLastFrame && touchingWall && !justLeftWall) { OnWallHit(touchingWall); } else if (touchingLastFrame && !touchingWall) { OnWallLeave(); } }