티스토리 뷰
using UnityEngine;
namespace LSM
{
sealed class LSM_ChangeStage : MonoBehaviour
{
float _line;
void Update()
{
var delta = Input.GetKey(KeyCode.Space) ? 1.0f : 0f;
delta *= Time.deltaTime;
float sum = _line + delta;
if (Input.GetKeyUp(KeyCode.Space))
{
sum = 0;
}
_line = Mathf.Clamp01(sum);
var vfx = GetComponent<UnityEngine.VFX.VisualEffect>();
vfx.SetFloat("_Line", sum);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;
using Current;
using DG.Tweening;
using System;
namespace LSM
{
[RequireComponent(typeof(AudioSource))]
public class LSM_Gamemanager : MonoBehaviour
{
public VisualEffect[] vFXColor_s;
//public VisualEffect[] vFXLineLenth_s;
public VisualEffect[] vFXStreetFall;
//public Animator[] animators;
//MS stair
public VisualEffect vFxStair;
//public Texture2D tex_Start;
private int x = 0;
private Texture2D[] pCaches;
public int max_num;
// public GameObject subwayLineEffect;
float delta=0;
//bool isCheck = false;
//float line;
//float lineSum;
//Vector3 b1PosInitial = new Vector3(-3, -53, 159);
//Vector3 b1Pos = Vector3.zero;
//public AudioSource audioSource;
//public AudioClip[] audioClips;
// Start is called before the first frame update
void Start()
{
StateManager.onStateChanged += OnStateChanged;
//subwayLineEffect.SetActive(false);
//if(audioSource== null)
//{
// audioSource = GetComponent<AudioSource>();
//}
//MS
pCaches = Resources.LoadAll<Texture2D>("test_01");
vFxStair.SetTexture("New_Tex", pCaches[0]);
}
private void OnStateChanged(SceneState newScene)
{
if(newScene == SceneState.END)
{
//MS stairEffect
StairEffect();
//SM turbulence 초기화
delta = 0f;
}
}
// Update is called once per frame
void Update()
{
//SubwayEffect();
switch (StateManager.SceneState)
{
case SceneState.SUBWAY:
SubwayEffect();
break;
case SceneState.FALL:
delta += Time.deltaTime*0.2f;
Turbulance();
break;
case SceneState.CORRIDOR:
//CorridorEffect();
break;
case SceneState.CITY:
//CityEffect();
break;
case SceneState.END:
//isCheck = true;
break;
}
}
private void Turbulance()
{
//fall씬에서 터뷸런스 효과를 줘라
for (int i = 0; i < vFXStreetFall.Length; i++)
{
vFXStreetFall[i].SetFloat("_Turbulence",delta);
}
}
private void StairEffect()
{
//씬에 가자마자 한번 실행
StartCoroutine(callPcache());
}
IEnumerator callPcache()
{
for (int x = 1; x <= max_num - 1; x++)
{
yield return new WaitForSeconds(0.03f);
vFxStair.SetTexture("New_Tex", pCaches[x]);
// print("texture is set x = " + x + "texutre name is " + pCaches[x].name);
// print("done!");
}
}
private void SubwayEffect()
{
//오른손은 색깔 변화
float colorValue = ControllerInput.GetTriggerValue(OVRInput.Controller.RTouch);
for (int i = 0; i < vFXColor_s.Length; i++)
{
vFXColor_s[i].SetFloat("_LerpColor", colorValue);
}
//if(ControllerInput.IsTriggerGetDown(OVRInput.Controller.RTouch) || Input.GetKeyDown(KeyCode.Space))
//{
// //audioSource.PlayOneShot(audioClips[0], 0.8f);
//}
//왼손은 subwayLine Effect
// if(ControllerInput.IsTriggerGetDown(OVRInput.Controller.LTouch) || Input.GetKeyDown(KeyCode.Space))
//{
// subwayLineEffect.SetActive(true);
// }
// if(ControllerInput.IsTriggerGetUp(OVRInput.Controller.LTouch) || Input.GetKeyDown(KeyCode.Space))
//{
// subwayLineEffect.SetActive(false);
// audioSource.PlayOneShot(audioClips[1], 0.8f);
// }
}
//private void CityEffect()
//{
// if(ControllerInput.IsTriggerGetDown(OVRInput.Controller.LTouch) || ControllerInput.IsTriggerGetDown(OVRInput.Controller.RTouch))
// {
// //네온 애니메이션을 실행해라
// for (int i = 0; i < animators.Length; i++)
// {
// animators[i].SetBool("isBlinking", true);
// }
// }
// if(ControllerInput.IsTriggerGetUp(OVRInput.Controller.LTouch) || ControllerInput.IsTriggerGetUp(OVRInput.Controller.RTouch))
// {
// for (int i = 0; i < animators.Length; i++)
// {
// animators[i].SetBool("isBlinking", false);
// }
// }
//}
//private void CorridorEffect()
//{
// //오른손은 색깔 변화
// float colorValue = ControllerInput.GetTriggerValue(OVRInput.Controller.RTouch);
// //왼손은 길이
// float lengthValue = ControllerInput.GetTriggerValue(OVRInput.Controller.LTouch);
// for(int i=0; i< vFXLineLenth_s.Length;i++)
// {
// vFXLineLenth_s[i].SetFloat("_ColorEffect", colorValue);
// vFXLineLenth_s[i].SetFloat("_LineLengthEffect", lengthValue);
// }
//}
public float lerpSpeed = 5.0f;
//IEnumerator Expand(Vector3 _b1Pos, int _indexJ, int _indexI)
//{
// Vector3 _tempB1Pos = _b1Pos;
// Vector3 destPos = _b1Pos += new Vector3(0, 0, _indexJ * 10);
// while(_tempB1Pos.z != destPos.z)
// {
// yield return null;
// _tempB1Pos = Vector3.Lerp(_tempB1Pos, destPos, lerpSpeed * Time.deltaTime);
// vFXLineLenth_s[_indexI].SetVector3("_Pos", _tempB1Pos);
// }
// while(_tempB1Pos.z != _b1Pos.z)
// {
// yield return null;
// _tempB1Pos = Vector3.Lerp(_tempB1Pos, _b1Pos, lerpSpeed * Time.deltaTime);
// vFXLineLenth_s[_indexI].SetVector3("_Pos", _tempB1Pos);
// }
// yield return null;
//}
}
}
https://github.com/keijiro/Eyeball/blob/main/Assets/Controller.cs
블랙보드에서 프로퍼티?? 어트리뷰트?? 추가해준다
'Unity > VFX Graph' 카테고리의 다른 글
unity VFX graph asset (0) | 2022.10.14 |
---|---|
Unity VFX Graph : 3d obj -> 2D texture map(position, color)/ SDF? (0) | 2022.10.14 |
Unity VFX Graph : Point Cache (0) | 2022.10.13 |
Unity VFX Graph: 커스텀 오퍼레이터 (0) | 2022.10.05 |
Unity_ VRX Graph : obj -> point cach/ 오브제 따라 파티클 이동하기 (0) | 2022.10.05 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- DeepLeaning
- emotive eeg
- opencv
- Java
- node.js
- motor controll
- Unity
- colab
- JacobianMatrices
- sequelize
- 후디니
- AI
- RNN
- houdini
- Arduino
- CNC
- oculuspro
- unity 360
- 유니티플러그인
- three.js
- 라즈베리파이
- VR
- StableDiffusion
- Python
- ardity
- TouchDesigner
- docker
- 유니티
- MQTT
- Express
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
글 보관함