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

public class KyoukoEchoNoise : MonoBehaviour
{
    
    [SerializeField]
    float speed = 10F;

    [Header("Timings")]
    [SerializeField]
    float hitDelay;
    
    Rigidbody2D rigidBody;
    Animator animator;

    bool canEcho = true;

    // Use this for initialization
    void Start()
    {
        this.rigidBody = GetComponent<Rigidbody2D>();
        this.animator = GetComponent<Animator>();
    }

    public void Fire(float targetX, float upperBoundY, float lowerBoundY, float delay)
    {
        float targetY = Random.Range(lowerBoundY, upperBoundY);
        Vector2 target = new Vector2(targetX, targetY);

        // Set velocity
        Vector2 direction = ((Vector2)this.transform.position - target).normalized;
        StartCoroutine(SetDirection(direction, delay));
    }

    public bool CanEcho()
    {
        return this.canEcho;
    }

    public void Echo(float hitLocation)
    {
        if (this.canEcho)
        {
            // Prevent further interactions
            this.canEcho = false;
            
            // Bounce
            Vector2 direction = new Vector2(1, -hitLocation).normalized;
            this.rigidBody.velocity = this.rigidBody.velocity * 0.5F;
            StartCoroutine(SetDirection(direction, this.hitDelay));

            // Animate
            AnimateEcho();
        }
    }

    IEnumerator SetDirection(Vector2 direction, float delay)
    {
        yield return new WaitForSeconds(delay);

        this.rigidBody.velocity = -direction * this.speed;
    }

    void AnimateEcho()
    {
        this.animator.Play("Reflect");
    }

}<commit_msg>Added rotation for noises.<commit_after>﻿using System.Collections;
using UnityEngine;

public class KyoukoEchoNoise : MonoBehaviour
{
    
    [SerializeField]
    float speed = 10F;

    [Header("Timings")]
    [SerializeField]
    float hitDelay;
    
    Rigidbody2D rigidBody;
    Animator animator;

    bool canEcho = true;

    // Use this for initialization
    void Start()
    {
        this.rigidBody = GetComponent<Rigidbody2D>();
        this.animator = GetComponent<Animator>();
    }

    public void Fire(float targetX, float upperBoundY, float lowerBoundY, float delay)
    {
        float targetY = Random.Range(lowerBoundY, upperBoundY);
        Vector2 target = new Vector2(targetX, targetY);

        // Set velocity
        Vector2 direction = ((Vector2)this.transform.position - target).normalized;
        StartCoroutine(SetDirection(direction, delay));

        // Rotate
        float angle = Mathf.Atan2(-direction.y, -direction.x) * Mathf.Rad2Deg;
        this.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }

    public bool CanEcho()
    {
        return this.canEcho;
    }

    public void Echo(float hitLocation)
    {
        if (this.canEcho)
        {
            // Prevent further interactions
            this.canEcho = false;
            
            // Bounce
            Vector2 direction = new Vector2(1, -hitLocation).normalized;
            this.rigidBody.velocity = this.rigidBody.velocity * 0.5F;
            StartCoroutine(SetDirection(direction, this.hitDelay));

            // Rotate
            float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
            this.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);

            // Animate
            AnimateEcho();
        }
    }

    IEnumerator SetDirection(Vector2 direction, float delay)
    {
        yield return new WaitForSeconds(delay);

        this.rigidBody.velocity = -direction * this.speed;
    }

    void AnimateEcho()
    {
        this.animator.Play("Reflect");
    }

}
{'fraction_non_alphanumeric': 0.09696481332258931, 'fraction_numerical': 0.0091324200913242, 'mean_word_length': 2.191088260497001, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5760063', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1079, 'n_words': 229}