<commit_before>﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class TeleportationMovement : BaseMovement {

    public bool isRandom;
    public float teleportMaxDistance;
    public List<Vector3> points;
    public float teleportInterval = 1;
    public Animator anim;

    private int currentPoint = 0;

    void Start() {
        StartCoroutine(TeleportLoop());
    }

    IEnumerator TeleportLoop() {
        while(true) {
            yield return new WaitForSeconds(teleportInterval);
            anim.SetTrigger("Teleport");
        }
    }

    //Called from animation;
    public void Teleport() {
        if(isRandom) {
            _transform.position =  new Vector3(_transform.position.x + Random.Range(-teleportMaxDistance, teleportMaxDistance), _transform.position.y + Random.Range(-teleportMaxDistance, teleportMaxDistance), 0);
        }
        else {
            currentPoint = (currentPoint + 1) % points.Count;
            _transform.position = points[currentPoint];
        }
    }

    void OnTriggerEnter2D(Collider2D other) {
        if (other.tag == "Wall") {
            Teleport();
        }
    }
}<commit_msg>TeleportationMovement fixed to use with Swithcing<commit_after>﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class TeleportationMovement : BaseMovement {

    public bool isRandom;
    public float teleportMaxDistance;
    public List<Vector3> points;
    public float teleportInterval = 1;
    public Animator anim;

    private int currentPoint = 0;
    private float timer = 0;
    private bool isTeleporting = false;

    void Start() {
        timer = teleportInterval;
    }

    void Update() {
        if(!isTeleporting) {
            timer -= Time.deltaTime;
            if(timer <= 0) {
                anim.SetTrigger("Teleport");
                isTeleporting = true;
                timer = teleportInterval;
            }
        }
    }

    //Called from animation;
    public void Teleport() {
        if(isRandom) {
            _transform.position =  new Vector3(_transform.position.x + Random.Range(-teleportMaxDistance, teleportMaxDistance), _transform.position.y + Random.Range(-teleportMaxDistance, teleportMaxDistance), 0);
        }
        else {
            currentPoint = (currentPoint + 1) % points.Count;
            _transform.position = points[currentPoint];
        }

        isTeleporting = false;
    }

    void OnTriggerEnter2D(Collider2D other) {
        if (other.tag == "Wall") {
            Teleport();
        }
    }
}
{'fraction_non_alphanumeric': 0.0934108527131783, 'fraction_numerical': 0.0069767441860465115, 'mean_word_length': 2.3606770833333335, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '1879822', 'n_tokens_mistral': 722, 'n_tokens_neox': 699, 'n_words': 162}