86 lines
2.0 KiB
C#
86 lines
2.0 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "Ef_rotfog" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
public class Ef_rotfog : MonoBehaviour
|
|||
|
{
|
|||
|
private float _fogHeight;
|
|||
|
|
|||
|
private float _fogSpeed;
|
|||
|
|
|||
|
private int _fogRotation;
|
|||
|
|
|||
|
private int _fogAlpha;
|
|||
|
|
|||
|
private float _xyRatio;
|
|||
|
|
|||
|
private Color _transColor;
|
|||
|
|
|||
|
private Color _targetColor;
|
|||
|
|
|||
|
private Color _currentColor;
|
|||
|
|
|||
|
private Vector3 _plusV;
|
|||
|
|
|||
|
private Material _material;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_material = this.GetComponent<Renderer>().material;
|
|||
|
}
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
transform.localScale = Vector3.zero;
|
|||
|
_targetColor = new Color(0.5f, 0.5f, 0.5f, 0f);
|
|||
|
}
|
|||
|
|
|||
|
public void RotfogOn(float limit_height, float _scale_speed, int _rot_speed, int _fogalpha, float _xyratio)
|
|||
|
{
|
|||
|
this.gameObject.SetActive(true);
|
|||
|
transform.localScale = Vector3.one * 0.3f;
|
|||
|
_fogHeight = limit_height;
|
|||
|
_fogSpeed = _scale_speed;
|
|||
|
_fogRotation = _rot_speed;
|
|||
|
_fogAlpha = _fogalpha;
|
|||
|
_xyRatio = _xyratio;
|
|||
|
_material.color = Color.gray;
|
|||
|
_plusV = new Vector3(_fogSpeed, _fogSpeed * _xyRatio, _fogSpeed);
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
_currentColor = _material.color;
|
|||
|
Vector3 localScale = transform.localScale;
|
|||
|
if (localScale.y > _fogHeight)
|
|||
|
{
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (localScale.y > _fogHeight * 0.5f)
|
|||
|
{
|
|||
|
transform.localScale += _plusV * Time.deltaTime;
|
|||
|
_transColor = Color.Lerp(_currentColor, _targetColor, Time.deltaTime * _fogAlpha);
|
|||
|
_material.color = _transColor;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
transform.localScale += _plusV * Time.deltaTime;
|
|||
|
transform.eulerAngles += Vector3.up * _fogRotation * Time.deltaTime;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|