<commit_before>﻿
// Experimental wall Jump+Crawl component for Motion2D.

// <NAME> ^ <EMAIL> ^ twitter.com/matnesis
// 2015/08/17 12:12 AM


using UnityEngine;
using System.Collections;


[RequireComponent(typeof(Motion2D))]
public class Motion2DWallJump : MonoBehaviour
{
	[Header("Config")]
	public float wallSnapGravity;

	[Header("Motion override")]
	public Vector2 gravityOnWall;
	public float forceLimitOnWall;

	private Motion2D motion;
	private Motion2DJump jump;


	void Start()
	{
		motion = GetComponent<Motion2D>();
		jump = GetComponent<Motion2DJump>();
	}


	void Update()
	{
		// >
		// BEHAVIOUR WHEN TOUCHING THE WALLS
		//

		Vector2 nextGravity = gravityOnWall;

		// Modify gravity towards the wall (left, right)
		if (motion.wallsColliding.w == 1)
			nextGravity.x = wallSnapGravity * -1;

		if (motion.wallsColliding.y == 1)
			nextGravity.x = wallSnapGravity;


		// Left or right
		if (motion.wallsColliding.y == 1 || motion.wallsColliding.w == 1)
		{
			// Config overrides
			motion.gravityOverride = nextGravity;
			motion.forceLimit = forceLimitOnWall;
		}
		else
		{
			// Normal config<commit_msg>Clean up<commit_after>﻿
// Experimental wall Jump+Crawl component for Motion2D.

// <NAME> ^ <EMAIL> ^ twitter.com/matnesis
// 2015/08/17 12:12 AM


using UnityEngine;


[RequireComponent(typeof(Motion2D))]
public class Motion2DWallJump : MonoBehaviour
{
	[Header("Config")]
	public float wallSnapGravity;

	[Header("Motion override")]
	public Vector2 gravityOnWall;
	public float forceLimitOnWall;

	private Motion2D motion;
	private Motion2DJump jump;


	void Start()
	{
		motion = GetComponent<Motion2D>();
		jump = GetComponent<Motion2DJump>();
	}


	void Update()
	{
		Vector2 nextGravity = gravityOnWall;

		// Modify gravity towards the wall (left, right)
		if (motion.wallsColliding.w == 1)
			nextGravity.x = wallSnapGravity * -1;

		if (motion.wallsColliding.y == 1)
			nextGravity.x = wallSnapGravity;


		// Left or right
		if (motion.wallsColliding.y == 1 || motion.wallsColliding.w == 1)
		{
			// Config overrides
			motion.gravityOverride = nextGravity;
			motion.forceLimit = forceLimitOnWall;
		}
		else
		{
			// Normal config
{'fraction_non_alphanumeric': 0.11642890013805798, 'fraction_numerical': 0.02393005062126093, 'mean_word_length': 3.778021978021978, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '647710', 'n_tokens_mistral': 887, 'n_tokens_neox': 733, 'n_words': 175}