SAIPO ca4294b0bf 1.完善了对话内容,使对话内容更加口语化和方言化。
2.添加了Shader的框架(与屏幕后特效相关)
 1)加入了LightController的代码文件,主要控制烛光等灯光的空气扰动现象
 2)加入了VolumeController的代码文件,主要与屏幕后特效的控制变量相关
 3)在场景中加入了Volume的对象,控制屏幕后特效Shader的运行
3.挪动了场景中煤油灯的位置,并且为煤油灯添加了会产生空气扰动使光范围发生变化的功能
4.为测试场景中的镜子添加了临时提示光边Shader
2021-08-14 07:43:34 +08:00

72 lines
2.3 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
public class CGAdministrator : MonoBehaviour
{
// Start is called before the first frame update
//CG管理员相关代码
private RawImage rawImage;
[Tooltip("记录这个场景中的所有CG要加的话直接扩容数组并往新的CG里面加内容")]
public ACG[] CGs;
private IndexRecoder indexRecoder;
private ACG playingCG;//正在播放的CG因为invoke无法传参而存在
void Start()
{
rawImage = GetComponent<RawImage>();
indexRecoder = FindObjectOfType<IndexRecoder>();
rawImage.CrossFadeAlpha(0,0,true);//为了淡入显示必须先把它的阿尔法值降到0对吧
}
// Update is called once per frame
void Update()
{
}
//外部呼叫CG用传入你要调用的CG名
public void CallACG(string CGName)
{
//当外面叫了一个CG传入CG名
foreach(ACG CG in CGs)
{
//找到这个CG
if(CG.CGName.Equals(CGName))
{
Debug.Log("正在显示CG"+CG.name);
rawImage.texture = CG.texture;//把CG的内容装载上
rawImage.CrossFadeAlpha(1,indexRecoder.CGFadeTime,true);//淡入显示CG
playingCG = CG;
Invoke("StopIt",CG.time);
}
}
}
//改变标记使管理员意识到CG该停了
private void StopIt(){rawImage.CrossFadeAlpha(0f,indexRecoder.CGFadeTime,true);//淡出CG
playingCG.OnEnded();}//告诉这个CG它结束了然后触发它的结束事件
//制造一个只读的变量,不要动这些
public class ReadOnlyAttribute : PropertyAttribute{}
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyDrawer : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, label, true);
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true;
}
}
//
}