// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-09-02 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using UnityEngine; namespace G { public class Ef_splash_uv : MonoBehaviour { private int uvAnimationTileX = 4; private int uvAnimationTileY = 4; private int framesPerSecond = 30; private float index; private float starttime; private float currenttime; private int lastframe; private int var; private GameObject cha1; private GameObject ascraps; private void Start() { cha1 = base.transform.root.gameObject; ascraps = GameObject.Find("Attack_scraps"); Physics.IgnoreCollision(cha1.GetComponent(), base.GetComponent()); currenttime = 0f; starttime = 0f; lastframe = uvAnimationTileX * uvAnimationTileY; base.GetComponent().enabled = false; base.transform.localScale = Vector3.zero; base.GetComponent().isTrigger = true; base.GetComponent().enabled = false; } public void SplashOn() { base.transform.parent = ascraps.transform; base.transform.localScale = new Vector3(2f, 2f, 2f); starttime = Time.time; base.GetComponent().enabled = true; base.GetComponent().enabled = true; base.transform.rotation = cha1.transform.rotation; base.transform.position = cha1.transform.position + new Vector3(0f, 0.02f, 0f) + cha1.transform.forward * 0.1f; base.transform.localRotation = Quaternion.identity; } private void Update() { if (base.GetComponent().enabled) { currenttime = Time.time - starttime; index = currenttime * framesPerSecond; index = (int)(index % lastframe); var -= (int)index; Vector2 scale = new Vector2(1f / uvAnimationTileX, 1f / uvAnimationTileY); float num = index % uvAnimationTileX; int num2 = (int)index / uvAnimationTileX; Vector2 offset = new Vector2(num * scale.x, 1f - scale.y - num2 * scale.y); if (index == 0f && var != 0) { base.GetComponent().enabled = false; base.GetComponent().enabled = false; base.transform.localScale = Vector3.zero; var = 0; base.transform.parent = cha1.transform; base.transform.rotation = cha1.transform.rotation; base.transform.position = cha1.transform.position + new Vector3(0f, 0.02f, 0f) + cha1.transform.forward * 0.3f; } base.GetComponent().material.mainTextureOffset = offset; base.GetComponent().material.mainTextureScale = scale; } } } }