<commit_before>﻿
// Splender is a collection of ready-to-use simple static effects.

// <NAME> > <EMAIL> > twitter.com/matnesis
// 2015/06/22 04:15:09 PM


using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;


public class Splender : MonoBehaviour
{
    public static void BubbleExplosion(Transform explosion, Vector3 position, float radius, float duration,
                                       Transform spark, int sparksQuantity, float sparkRadius, float sparkDuration)
    {
        // Main explosion
        Transform mainExplosion = explosion.lpSpawn(position, Quaternion.identity);
        MeshRenderer mainMesh = explosion.GetComponent<MeshRenderer>();


        // Defaults
        mainExplosion.localScale = new Vector3(0.1f, 0.1f, 0.1f);
        mainMesh.material.color = Color.white;


        // Explosion fx
        Sequence ts = DOTween.Sequence();
        ts.Insert(0, mainExplosion.DOScale(radius, duration));
        ts.Insert(0, mainMesh.material.DOColor(Color.clear, duration));
        ts.AppendCallback(() =>
        {
            mainMesh.material.color = Color.clear;
            mainExplosion.lpRecycle();
        });


        // Sparks generation
        Sequence sts = DOTween.Sequence();
        while (sparksQuantity-- > 0)
        {
            Vector3 randomPos = Random.insideUnitSphere * radius;
            Transform someSpark = spark.lpSpawn(position + randomPos, Quaternion.identity);
            MeshRenderer sparkMesh = spark.GetComponent<MeshRenderer>();

            // Sparks default
            someSpark.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            sparkMesh.material.color = Color.white;

            // Spark fx
            sts.Insert(0, someSpark.DOScale(sparkRadius, sparkDuration));
            sts.Insert(0, sparkMesh.material.DOColor(Color.clear, sparkDuration));
            sts.AppendCallback(() =>
            {
                sparkMesh.material.color = Color.clear;
                someSpark.lpRecycle();
            });
        }
    }
}<commit_msg>Experimenting with a simple explosion FX made with a sphere and tweens<commit_after>﻿
// Splender is a collection of ready-to-use simple static effects using
// DOTween.

// <NAME> > <EMAIL> > twitter.com/matnesis
// 2015/06/22 04:15:09 PM


using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;


public class Splender : MonoBehaviour
{
    public static void BubbleExplosion(Transform explosion, Vector3 position, float radius, float duration, Color color)
    {
        // Main explosion
        Transform mainExplosion = explosion.lpSpawn(position, Quaternion.identity);
        mainExplosion.SetPosZ(Camera.main.transform.position.z + 1);
        MeshRenderer mainMesh = mainExplosion.GetComponent<MeshRenderer>();

        mainExplosion.localScale = new Vector3(0.1f, 0.1f, 0.1f);
        mainMesh.material.color = color;

        Sequence ts = DOTween.Sequence();

        ts.Insert(0, mainExplosion.DOScale(radius, duration));
        ts.Insert(duration * 0.50f, mainMesh.material.DOColor(Color.white * 0.1f, duration - duration * 0.50f));

        ts.Insert(duration, mainExplosion.DOScale(radius * 1.5f, duration * 2));
        ts.Insert(duration, mainMesh.material.DOColor(Color.clear, duration * 2));

        ts.AppendCallback(() =>
        {
            mainExplosion.lpRecycle();
        });

    }
}
{'fraction_non_alphanumeric': 0.10867659947414549, 'fraction_numerical': 0.02074203914694712, 'mean_word_length': 2.5335397316821466, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2817586', 'n_tokens_mistral': 1066, 'n_tokens_neox': 956, 'n_words': 216}