• 大小: 83.98MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-05-30
  • 语言: C#
  • 标签: unity  第一人称  

资源简介

主要是用于初学unity用的,此篇unity的脚本使用C#实现的,gensui.cs脚本是放在摄像机上面的,Player....cs是放在第一人称的人物上的

资源截图

代码片段和文件信息

using UnityEngine;
using System;
using UnityEditor;

[CustomEditor(typeof(GerstnerDisplace))]
public class GerstnerDisplaceEditor : Editor 
{    
    private Serializedobject serObj;

public void OnEnable () 
{
serObj = new Serializedobject (target);
}

    public override void OnInspectorGUI () 
    {
     serObj.Update(); 
    
     Gameobject go = ((GerstnerDisplace)serObj.targetobject).gameobject;
     Waterbase wb = (Waterbase)go.GetComponent(typeof(Waterbase));    
     Material sharedWaterMaterial = wb.sharedMaterial;
    
        GUILayout.Label (“Animates vertices using up 4 generated waves“ Editorstyles.miniBoldLabel);    
        
if(sharedWaterMaterial) 
{
Vector4 amplitude = WaterEditorUtility.GetMaterialVector(“_GAmplitude“ sharedWaterMaterial);
Vector4 frequency = WaterEditorUtility.GetMaterialVector(“_GFrequency“ sharedWaterMaterial);
Vector4 steepness = WaterEditorUtility.GetMaterialVector(“_GSteepness“ sharedWaterMaterial);
Vector4 speed = WaterEditorUtility.GetMaterialVector(“_GSpeed“ sharedWaterMaterial);
Vector4 directionAB = WaterEditorUtility.GetMaterialVector(“_GDirectionAB“ sharedWaterMaterial);
Vector4 directionCD = WaterEditorUtility.GetMaterialVector(“_GDirectionCD“ sharedWaterMaterial);

amplitude = EditorGUILayout.Vector4Field(“Amplitude (Height offset)“ amplitude);
frequency = EditorGUILayout.Vector4Field(“Frequency (Tiling)“ frequency);
steepness = EditorGUILayout.Vector4Field(“Steepness“ steepness);
speed = EditorGUILayout.Vector4Field(“Speed“ speed);
directionAB = EditorGUILayout.Vector4Field(“Direction scale (Wave 1 (XY) and 2 (ZW))“ directionAB);
directionCD = EditorGUILayout.Vector4Field(“Direction scale (Wave 3 (XY) and 4 (ZW))“ directionCD);

if (GUI.changed) {
WaterEditorUtility.SetMaterialVector(“_GAmplitude“ amplitude sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector(“_GFrequency“ frequency sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector(“_GSteepness“ steepness sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector(“_GSpeed“ speed sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector(“_GDirectionAB“ directionAB sharedWaterMaterial);
WaterEditorUtility.SetMaterialVector(“_GDirectionCD“ directionCD sharedWaterMaterial);
}

/*
 
Vector4 animationTiling = WaterEditorUtility.GetMaterialVector(“_AnimationTiling“ sharedWaterMaterial);
Vector4 animationDirection = WaterEditorUtility.GetMaterialVector(“_AnimationDirection“ sharedWaterMaterial);

float firstTilingU = animationTiling.x*100.0F;
float firstTilingV = animationTiling.y*100.0F;
float firstDirectionU = animationDirection.x;
float firstDirectionV = animationDirection.y;

float secondTilingU = animationTiling.z*100.0F;
float secondTilingV = animationTiling.w*100.0F;
float secondDirectionU = animationDirection.z;
float secondDirectionV = animationDirection.w;



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-07 22:31  movesth\
     目录           0  2019-03-26 22:43  movesth\.vs\
     目录           0  2019-03-26 22:43  movesth\.vs\movesth-csharp\
     目录           0  2019-03-26 22:53  movesth\.vs\movesth-csharp\v14\
     文件       64512  2019-04-07 22:23  movesth\.vs\movesth-csharp\v14\.suo
     文件       14091  2019-03-26 22:53  movesth\Assembly-Boo-firstpass-vs.booproj
     文件       14091  2019-03-26 22:53  movesth\Assembly-Boo-firstpass.booproj
     文件       15185  2019-03-26 22:43  movesth\Assembly-CSharp-Editor-vs.csproj
     文件       15245  2019-03-26 22:43  movesth\Assembly-CSharp-Editor.csproj
     文件       16684  2019-03-29 08:48  movesth\Assembly-CSharp-firstpass-vs.csproj
     文件       16684  2019-03-29 08:48  movesth\Assembly-CSharp-firstpass.csproj
     文件       15800  2019-03-26 22:43  movesth\Assembly-Unityscript-Editor-vs.unityproj
     文件       15860  2019-03-26 22:43  movesth\Assembly-Unityscript-Editor.unityproj
     文件       17443  2019-03-26 22:43  movesth\Assembly-Unityscript-firstpass-vs.unityproj
     文件       17443  2019-03-26 22:43  movesth\Assembly-Unityscript-firstpass.unityproj
     文件       15444  2019-03-26 22:43  movesth\Assembly-Unityscript-vs.unityproj
     文件       15471  2019-03-26 22:43  movesth\Assembly-Unityscript.unityproj
     目录           0  2019-03-29 09:21  movesth\Assets\
     目录           0  2019-03-26 17:11  movesth\Assets\Editor\
     文件         107  2019-03-26 17:08  movesth\Assets\Editor.meta
     目录           0  2019-03-26 17:08  movesth\Assets\Editor\Image Effects\
     文件         107  2019-03-26 17:08  movesth\Assets\Editor\Image Effects.meta
     文件        2410  2014-06-11 05:51  movesth\Assets\Editor\Image Effects\AntialiasingAsPostEffectEditor.js
     文件         178  2019-03-26 17:08  movesth\Assets\Editor\Image Effects\AntialiasingAsPostEffectEditor.js.meta
     文件        6823  2014-06-11 05:51  movesth\Assets\Editor\Image Effects\BloomAndLensFlaresEditor.js
     文件         178  2019-03-26 17:08  movesth\Assets\Editor\Image Effects\BloomAndLensFlaresEditor.js.meta
     文件        7024  2014-06-11 05:51  movesth\Assets\Editor\Image Effects\BloomEditor.js
     文件         178  2019-03-26 17:08  movesth\Assets\Editor\Image Effects\BloomEditor.js.meta
     文件        3894  2014-06-11 05:51  movesth\Assets\Editor\Image Effects\CameraMotionblurEditor.js
     文件         178  2019-03-26 17:08  movesth\Assets\Editor\Image Effects\CameraMotionblurEditor.js.meta
     文件        5090  2014-06-11 05:51  movesth\Assets\Editor\Image Effects\ColorCorrectionCurvesEditor.js
............此处省略2632个文件信息

评论

共有 条评论