FrameVR示例V0913(Yanlz+VRTK+Oculus+)

  • Post author:
  • Post category:其他












Frame






VR






示例






V0913》






版本





作者





参与者





完成日期





备注




VRTest_FrameV0913_V01_1.0



严立钻



2018.09.21



##《FrameVR代码V0913》目录:


#A、




Base/



#B、




Http/



#C、




Three/



#D、




UI/



#E、




VR/



#F、




xx.cs{}






#A、Base/







#A、Base/





#A、Base/

++++

A.1、




AllEvent.cs


++++

A.2、




BasicEvents.cs


++++

A.3、




ConfigureIP.cs


++++

A.4、




ConfigureIPB.cs


++++

A.5、




ExceutionStep.cs


++++

A.6、




Files.cs


++++

A.7、




MoveToTarget.cs


++++

A.8、




NetMouthEffect.cs


++++

A.9、




NetPort.cs


++++

A.10、




NetPortBase.cs


++++

A.11、




PlayerMove.cs


++++

A.12、




StepThree.cs


++++

A.13、




TriggerBase.cs


++++

A.14、




Twinkle.cs


++++

A.15、




VibrationSound.cs






##A.1、AllEvent.cs







##A.1、AllEvent.cs





++A.1、AllEvent.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




AllEvent.cs





public






class






AllEvent




:




MonoBehaviour




{




public






void






MsYileShow




(




GameObject




game


){}




IEnumerator






YildShow




(




GameObject




game


){}


}



++A.1、AllEvent.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;




public






class






AllEvent




:




MonoBehaviour




{




public






void






MsYileShow




(




GameObject




game


){




StartCoroutine




(




YildShow




(


game


));


}




IEnumerator






YildShow




(




GameObject




game


){




yield return new WaitForSeconds




(


1.0f


);


game


.




SetActive




(


true


);


}


}


//立钻哥哥:public class AllEvent{}





##A.2、BasicEvents.cs







##A.2、BasicEvents.cs





++A.2、BasicEvents.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




BasicEvents.cs





public






class






BasicEvents




{




public






Transform






MsGetTransByName




(




List




<




Transform




>


list


,




string




name


){}


}



++BasicEvents.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;


//基础事件集合




public






class






BasicEvents




{


//通过名字获取列表内的物体




public






Transform






MSGetTransByName




(




List




<




Transform




>


list


,




string




name


){




Transform




current


=


null


;




for




(




int




i


=


0


;


i


<


list


.


Count


;


i


++){




if




(


list


[


i


].


name


.




Equals




(


name


)){


current


=


list


[


i


];


}


}




return




current


;


}


}


//立钻哥哥:public class BasicEvents{}





##A.3、ConfigureIP.cs







##A.3、ConfigureIP.cs





++A.3、ConfigureIP.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




ConfigureIP.cs





public






class






ConfigureIP




:




MonoBehaviour




{




public






void






MsOpenA192




(){}




private Transform






MsGetATrsForName




(




string




name


){}




public






void






Ms192End




(){}




public






void






Ms168End




(){}




public






void






Ms01End




(){}




private void






MsByNameControlFicker




(




string




name


,




bool




off


){}




private void






MsGetFiles




(){}




IEnumerator






YieldOpen




(




string




name


){}


}



++A.3、ConfigureIP.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;


//网路IP配置步骤




public






class






ConfigureIP




:




MonoBehaviour




{




private static






ConfigureIP




msInstance


;




public






static






ConfigureIP MsInstance




{




get




{




return




msInstance


;  }




set




{


msInstance


=


value


;  }


}




public






Transform




MainframeIPA


;


//主机IPA




private void Awake




(){


msInstance


=




this




;


}




private






ClipManager




SourcePlayer


;




private






Files




filesPlayer


;




private






BasicEvents




BasicEvents


;




void Start




(){




BasicEvents




=




new






BasicEvents




();


SourcePlayer


=


gameObject


.




GetComponent




<




ClipManager




>();


filesPlayer


=


gameObject


.




GetComponent




<




Files




>();




MsGetFiles




();


}




public






void






MsStep4




(){




ClipManager




.


MsInstance


.




PlayIndex




(


1


,


MsStep4Back


);


//立钻哥哥:public void PlayIndex(int index, Action action){}


}




private






void






MsStep4Back




(){


}


#region IP 配置逻辑功能




private List




<




Transform




>


ListIPA


=




new List




<




Transform




>();


//开始新的逻辑处理




public






void






MsOpenA192




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}


//通过名字获取A主机上的物品




private Transform






MsGetATrsForName




(




string




name


){




Transform




trans


=


null


;




for




(




int




i


=


0


;


i


<


ListIPA


.


Count


;


i


++){




if




(


ListIPA


[


i


]


.name


.




Equals




(


name


)){


trans


=


ListIPA


[


i


];


}


}




return




trans


;


}




public






void






Ms192End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms168End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms01End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}


//0的两个结果




public






void






Ms012End




(){




if




(




MyConst




.


CurrentMoveTarget


.


name


.




Equals




(





0-1-





)){




Ms01End




();


}




else




{




Ms02End




();


}


}




public






void






Ms1End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms255123End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms2551End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms2552End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms2553End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}




public






void






Ms02End




(){




MsStop15




();


}


//通过名字和bool来控制闪烁效果




private void






MsByNameControlFicker




(




string




name


,




bool




off


){




if




(


off


){




MsGetATrsForName




(


name


).




GetComponent




<




UIFlicker




>().




MsForceFicker




();


}




else




{




MsGetATrsForName




(


name


).




GetComponent




<




UIFlicker




>().




MsCloseForceFicker




();


}


}


//通过名字开启查找




private void






MsByNameControlCollider




(




string




name


){




MsGetATrsForName




(


name


).




GetComponent




<




UICollision




>().




MsOpenCollider




();


}


#endregion


//触碰主机A按钮 展示UI界面




public






void






MsStop4




(){




SourcePlayer




.




PlayIndex




(


3


,




MsStop4End




);


}


//触碰主机A播放完毕,开启主机碰撞




private void






MsStop4End




(){




switch




(




MyConst




.


EnumMode


){




case






MyConst




.


EnumExaminMode


.


Study


;




break




;




case






MyConst




.


EnumExaminMode


.


Practice


;




break




;




case






MyConst




.


EnumExaminMode


.


Examin


;




break




;




default




:




break




;


}


}


//语音:打开网络图标




public






void






MsStop5




(){




SourcePlayer




.




PlayIndex




(


4


,


MsStop5End


);


}


//语音播放结束




private void






MsStop5End




(){




MsOpenCollider




(





NetPort





);




MsOpenFlicker




(





NetPort





);


}


//语音:选择属性




public






void






MsStop6




(){




SourcePlayer




.




PlayIndex




(


5


,




MsStop6End




);


}


//语音播放结束




private void






MsStop6End




(){




MsOpenCollider




(





4.1





);




MsOpenFlicker




(





4.1





);


}


//语音:更改适配器设置




public






bool






MsStop7




(){




switch




(




MyConst




.


EnumMode


){




case






MyConst




.


EnumExaminMode


.


Study


:




SourcePlayer




.




PlayIndex




(


6


,




MsStop7End




);




break




;




case






MyConst




.


EnumExaminMode


.


Practice


:




SourcePlayer




.


PlayIndex


(


6


,




MsStop7End




);




break




;




case






MyConst




.


EnumExaminMode


.


Examin


:




MsStop7End




();




break




;




default




:




break




;


}


}


//语音播放结束




private void






MsStop7End




(){




MsOpenCollider




(





4.1(1)





);




MsOpenFlicker




(





4.1(1)





);


}


//语音:选择以太网




public






void






MsStop8




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}


//语音播放结束




private void






MsStop8End




(){


… … //立钻哥哥:代码优先级不高,暂不拓展


}


… … //立钻哥哥:代码优先级不高,暂不拓展




private List




<




Transform




>


list_BGA


=




new List




<




Transform




>();


//通过名字获取内容节点




private void






MsGetFiles




(){




for




(




int




i


=


0


;


i


<


filesPlayer


.


BGA


.


transform


.


childCount


;


i




++




){


list_BGA


.




Add




(


filesPlayer


.


BGA


.


transform


.




GetChild




(


i


));


}


}


//开启碰撞




private void






MsOpenCollider




(




string




name


){




BasicEvents




.




MsGetTransByName




(


list_BGA


,


name


).




GetChild




(


0


).




GetComponent




<




UICollision




>().




MsOpenCollider




();


}


//开启闪烁




private void






MsOpenFlicker




(




string




name


){




if




(




MyConst




.


FirstEnter


){




BasicEvents




.




MsGetTransByName




(


list_BGA


,


name


).




GetChild




(


0


).




GetComponent




<




UIFlicker




>().




MsForceFicker




();


}


}




IEnumerator






YieldOpen




(




string




name


){




yield return new WaitForSeconds




(


0.5f


);




Transform




tem


=


null


;




for




(




int




i


=


0


;


i


<


list_BGA


.


Count


;


i




++




){






if




(


list_BGA


[


i


].


name


.




Equals




(


name


)){


tem


=


list_BGA


[


i


];




break




;


}


}




if




(


tem


.


childCount


>


0


){


tem


.




GetChild




(


0


).




GetComponent




<




UICollision




>().




MsOpenCollider




();


}




else




{


tem


.




GetComponent




<




UICollision




>().




MsOpenCollider




();


}


}


//立钻哥哥:IEnumerator YieldOpen(string name){}


}


//立钻哥哥:public class ConfigureIP{}





##A.4、ConfigureIPB.cs







##A.4、ConfigureIPB.cs





++A.4、ConfigureIPB.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




ConfigureIPB.cs





public






class






ConfigureIPB




:




MonoBehaviour




{




public






void






MsOpenA192




(){}




private Transform






MsGetATrsForName




(




string




name


){}




public






void






Ms192End




(){}




private void






MsByNameControlFicker




(




string




name


,




bool




off


){}




private void






MsByNameControlCollider




(




string




name


){}




private void






MsGetFiles




(){}




private void






MsOpenCollider




(




string




name


){}




private void






MsOpenFlicker




(




string




name


){}


}



++A.4、ConfigureIPB.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;


//网络IP配置步骤




public






class






ConfigureIPB




:




MonoBehaviour




{




private static






ConfigureIPB




msInstance


;




public






static






ConfigureIPB MsInstance




{




get




{




return




msInstance


;  }




set




{


msInstance


=


value


;  }


}




public






Transform




MainframeIPB


;


//主机IPB




private






ClipManager




SourcePlayer


;




private






Files




filesPlayer


;




private






BasicEvents




BasicEvents


;




private void Awake




(){


msInstance


=




this




;


}




void Start




(){




BasicEvents




=




new






BasicEvents




();


filesPlayer


=


gameObject


.




GetComponent




<




Files




>();


SourcePlayer


=


gameObject


.




GetComponent




<




ClipManager




>();




MsGetFiles




();


}


… …    //立钻哥哥:代码基本和“ConfigureIP.cs”,暂不拓展


}


//立钻哥哥:public class ConfigureIPB{}





##A.5、ExecutionStep.cs







##A.5、ExecutionStep.cs





++A.5、ExceutionStep.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




ExecutionStep.cs





public






class






ExecutionStep




:




MonoBehaviour




{




public






void






Step1




(){}




public






void






Step2




(){}




public






void






Step3




(){}


… …




public






void






Step10




(){}


}



++A.5、ExecutionStep.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;




public






class






ExecutionStep




:




MonoBehaviour




{




public






UnityEvent




step1


=




new UnityEvent




();




public






void






Step1




(){


step1


.




Invoke




();


}




public






UnityEvent




step2


=




new UnityEvent




();




public






void






Step2




(){


step2


.




Invoke




();


}




public






UnityEvent




step3


=




new UnityEvent




();




public






void






Step3




(){


step3


.




Invoke




();


}


… …




public






UnityEvent




step10


=




new UnityEvent




();




public






void






Step10




(){


step10


.




Invoke




();


}


}


//立钻哥哥:public class ExecutionStep{}





##A.6、Files.cs







##A.6、Files.cs





++A.6、Files.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




Files.cs





public






class






Files




:




MonoBehaviour




{


}



++A.6、Files.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using UnityEngine




;


//所有的物品




public






class






Files




:




MonoBehaviour




{




private static






Files




msInstance


;




public






static






Files MsInstance




{




set




{


msInstance


=


value


;  }




get




{




return




msInstance


;  }


}




private void Awake




(){


msInstance


=




this




;


}




public






GameObject




Stop0NextButton


;




public






GameObject




Stop0Text


;




public






GameObject




Stop1


;




public






GameObject




Background


;


//步骤-背景




public






GameObject




HostA


;


//主机A




public






GameObject




HostB


;


//主机B




public






GameObject




BGA


;


//主机A的UI




public






GameObject




BGB


;


//主机B的UI




public






GameObject




ThreeB


;


//步骤三所有内容




public






GameObject




ThreeBPing


;


//步骤三中的Ping总物体




public






GameObject




ThreeB43


;


//步骤三中字体显示




public






GameObject




ThreeBcmd


;


//步骤三中cmd


}


//立钻哥哥:public class Files{}





##A.7、MoveToTarget.cs







##A.7、MoveToTarget.cs





++A.7、MoveToTarget.cs

++++立钻哥哥:




public






class






MoveToTarget




:




MonoBehaviour




{




public






void






MsGetTarget




(




Collider




other


){}


}



++MoveToTarget.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;


//移动到目标物体




public






class






MoveToTarget




:




MonoBehaviour




{




private






float




Speed


=


300


;


//移动速度




public






Transform






[]




target


;


//多个目标物体




private bool




ssMove


=


false


;


//开始移动




private Transform




currentTarget


;


//当前目标




public






UnityEvent




MoveEnd


=




new UnityEvent




();




public






UnityEvent




MoveQure


=




new UnityEvent




();


//移动确认




void Update




(){




if




(


ssMove


){




if




(


transform


.


localPosition


!=




Vector3




.


zero


){




if




(


currentTarget


==


null


){




return




;


}


transform


.


parent


=


currentTarget


;


transform


.


localPosition


=




Vector3




.




MoveTowards




(


transform


.


localPosition


,




Vector3




.


zero


,


Speed


*




Time




.


deltaTime


);




if




(


transform


.


localPosition


==




Vector3




.


zero


){


print(





立钻哥哥:移动到目的地





);




MoveEnd




.




Invoke




();


ssMove


=


false


;


}


}


}


}


//获取到移动目标




public






void






MsGetTarget




(){




if




(


other


.


name


.


IndexOf


(





b_r





) >


-1


){




for




(




int




i


=


0


;


i


<


target


.


Length


;


i


++){




if




(


target


[


i


].


childCount


<


1


){


currentTarget


=


target


[


i


];




if




(


currentTarget


==




MyCount




.


CurrentMoveTarget


){


MoveQure


.




Invoke




();


ssMove


=


true


;


}




break




;


}


}


}


}


//立钻哥哥:public void MsGetTarget(){}


}


//立钻哥哥:public class MoveToTarget{}





##A.8、NetMouthEffect.cs







##A.8、NetMouthEffect.cs





++A.8、NetMouthEffect.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




NetMouthEffect.cs





using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;


//网口音乐特效




public






class






NetMouseEffect




:




MonoBehaviour




{




public






enum






Mode




{


A


,


B


,


C


,


D


}




public Mode




Model


;




public






UnityEvent




SourceEffect


=




new UnityEvent




();




private void OnTriggerEnter




(




Collider




other


){




switch




(


Model


){




case






Mode




.


A


:




if




(


other


.


name


.




Equals




(





NetPortA





)){


SourceEffect


.




Invoke




();


}




break




;




case






Mode




.


B


:




if




(


other


.


name


.




Equals




(





NetPortB





)){


SourceEffect


.




Invoke




();


}




break




;




case






Mode




.


C


:




if




(


other


.


name


.




Equals




(





NetPortC





)){


SourceEffect


.




Invoke




();


}




break




;




case






Mode




.


D


:






if




(


other


.


name


.




Equals




(





NetPortD





)){


SourceEffect


.




Invoke




();


}




break




;




default




:




break




;


}


}


//立钻哥哥:private void OnTriggerEnter(){}


}


//立钻哥哥:public class NetMouseEffect{}





##A.9、NetPort.cs







##A.9、NetPort.cs





++A.9、NetPort.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




NetPort.cs





public






class






NetPort




:




MonoBehaviour




{




private void






MsStep1PlayOver




(){}




IEnumerator






yiedTwo




(){}




public






void






Step1




(){}




private void






MsStep2PlayOver




(){}




public






void






MsNetAGrab




(){}




public






void






MsNetAMarry




(){}




private void






MSLightSwitch




(




Transform




tran


,




bool




off


){}




public






void






MsAConfigureEnd




(){}


}



++NetPort.cs

++++立钻哥哥:




using






HighlightingSystem




;




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;




using






UnityEngine




.




UI




;


//网络水晶头的逻辑使用




public






class






NetPort




:




MonoBehaviour




{




private static






NetPort




msInstance


;




public






static






NetPort MsInstance




{




set




{


msInstance


=


value


;  }




get




{




return




msInstance


;  }


}




public






Transform




NetPortA


,


NetPortB


,


NetPortC


,


NetPortD


;


//网线接口




public






Transform




NetA


,


NetB


,


NetC


,


NetD


;


//网线插口




private






NetPortBase




PortBaseA


,


PortBaseB


,


PortBaseC


,


PortBaseD


;




private






Files




filesPlayer


;




private






ClipManager




SourcePlayer


;




private






ConfigureIP




UIAControl


;




private void






Awake




(){


msInstance


=




this




;


}




private void






Start




(){


PortBaseA


=


NetPortA


.




GetComponent




<




NetPortBase




>();


PortBaseB


=


NetPortB


.




GetComponent




<




NetPortBase




>();


PortBaseC


=


NetPortC


.




GetComponent




<




NetPortBase




>();


PortBaseD


=


NetPortD


.




GetComponent




<




NetPortBase




>();


filesPlayer


=


gameObject


.




GetComponent




<




Files




>();


SourcePlayer


=


gameObject


.




GetComponent




<




ClipManager




>();


UIAControl


=


gameObject


.




GetComponent




<




ConfigureIP




>();


}




public






void






Step0




(){


print(





立钻哥哥:第一执行步骤





);


PortBaseA


.




MsPosReset




();


PortBaseB


.




MsPosReset




();


PortBaseC


.




MsPosReset




();


PortBaseD


.




MsPosReset




();




switch




(




MyConst




.


EnumMode


){




case






MyConst




.


EnumExaminMode


.


Study


:




UIShowControl




.


MsInstance


.




MsOpenBG




(


true


);




UIShowControl




.


MsInstance


.




MsOpenIndex




(


0


);




ClipManager




.


MsInstance


.




PlayIndex




(


1


,


MsStep1PlayOver


);


… ….    //立钻哥哥:代码类似,不再拓展


}


}


//音频播放完毕




private void






MsStep1PlayOver




(){




if




(




MyConst




.


EnumMode


==




MyConst




.


EnumExaminMode


.


Examin


){




StartCoroutine




(




yiedTwo




());


}




else




{


PortBaseB


.




MsOnCancelAll




();


PortBaseA


.




MsCancelAll




();


PortBaseC


.




MsCancelAll




();


PortBaseD


.




MsCancelAll




();


}


}




IEnumerator






yiedTwo




(){




yield return new WaitForSeconds




(


1.5f


);


PortBaseB


.




MsOnCancelAll




();


PortBaseA


.




MsCancelAll




();


PortBaseC


.




MsCancelAll




();


PortBaseD


.




MsCancelAll




();


}




public






void






Step1




(){


… ….    //立钻哥哥:代码类似,不再拓展


}


//音频播放完毕




private void






MsStep2PlayOver




(){




UIShowControl




.


MsInstance


.




MsOpenCollision




(


1


,


1


,


true


);


PortBaseC


.




MsOnCancelAll




();


}


//网线A抓取到




public






void






MsNetAGrab




(){




MsLightSwitch




(


NetA


,


true


);


}


//网线B抓取到




public






void






MsNetBGrab




(){




MsLightSwitch




(


NetB


,


true


);


}


//网线C抓取到




public






void






MsNetCGrab




(){




MsLightSwitch




(


NetC


,


true


);


}


//网线D抓取到




public






void






MsNetDGrab




(){




MsLightSwitch




(


NetD


,


true


);


}


//A口 接触到一起




public






void






MsNetAMarray




(){




switch




(




MyConst




.


EnumMode


){




case






MyConst




.


EnumExaminMode


.


Stduy


:




MsLightSwitch




(


NetA


,


false


);




UIShowControl




.


MsInstance


.




MsOpenCollision




(


0


,


2


,


true


);




if




(




MyConst




.


FirstEnter


){


filesPlayer


.


Stop0NextButton


.


transform


.




GetChild




(


0


).




GetComponent




<




UIFlicker




>().


MsForceFicker


();


}




break




;




case






MyConst




.


EnumExaminMode


.


Practice


:




MsLightSwitch




(


NetA


,


false


);




UIShowControl




.


MsInstance


.




MsOpenCollision




(


0


,


2


,


true


);




break




;




case






MyConst




.


EnumExaminMode


.


Examin


:




Step1




();




break




;




default




:




break




;


}


print(





步骤一结束,执行步骤二





);


}


//B口 接触到一起




public






void






MsNetBMarray




(){




MsLightSwitch




(


NetB


,


false


);


PortBaseA


.




MsOnCancelAll




();


}


//C口 接触到一起




public






void






MsNetCMarry




(){




MsLightSwitch




(


NetC


,


false


);


PortBaseD


.




MsOnCancelAll




();


}


//D口接触到一起




public






void






MsNetDMarry




(){




MsLightSwitch




(


NetD


,


false


);




UIShowControl




.


MsInstance


.




MsOpenCollision




(


1


,


2


,


true


);


Debug.Log(





第二步骤执行结束





);


//执行结束之后开启PC界面


filesPlayer


.


Stop1


.




SetActive




(


false


);


filesPlayer


.


Background


.




GetComponent




<




Image




>().


enabled


=


false


;


//开启主机A的碰撞




MsLightSwitch




(


filesPlayer


.


HostA


.


transform


,


true


);


filesPlayer


.


HostA


.




GetComponent




<




BoxCollider




>().


enabled


=


true


;


}


//呼吸特效灯开关




private void






MsLightSwitch




(




Transform




tran


,




bool




off


){




switch




(




MyConst




.


EnumMode


){




case






MyConst




.


EnumExaminMode


.


Study


:




if




(!




MyConst




.


FirstEnter


){


off


=


false


;


}


tran


.




GetChild




(


0


).




GetComponent




<




MeshRenderer




>().


enabled


=


off


;




break




;




case






MyConst




.


EnumExaminMode


.


Practice


:




break




;




case






MyConst




.


EnumExaminMode


.


Examin


:




break




;






default




:




break




;


}


}


//B机开始触碰




private void






MsStop6




(){


filesPlayer


.


HostB


.




GetComponent




<




BoxCollider




>().


enabled


=


true


;


}


//A机配置结束




public






void






MsAConfigureEnd




(){




MsStop6




();


}


}


//立钻哥哥:public class NetPort : MonoBehaviour{}





##A.10、NetPortBase.cs







##A.10、NetPortBase.cs





++A.10、NetPortBase.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




NetPortBase.cs





public






class






NetPortBase




:




MonoBehaviour




{




public






void






MsPosReset




(){}




IEnumerator






YiedReset




(){}




private void OnTriggerEnter




(




Collider




other


){}




private void OnTriggerStay




(




Collider




other


){}




private void






MsStayA




(




Collider




other


){}




private void






MsStayB




(




Collider




other


){}




private void






MsStayC




(




Collider




other


){}




private void






MsStayD




(




Collider




other


){}




private void OnTriggerExit




(




Collider




other


){}




public






void






MsLightEffect




(




bool




off


){}




public






void






MsCancelRig




(




bool




off


){}




public






void






MsCancelBox




(




bool




off


){}




public






void






MsCancelAll




(){}




public






void






MsOnCancelAll




(){}


}



++NetPortBase.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;


//网线接口的基础功能,与那个做对接,那个触碰发生的变化




public






class






NetPortBase




:




MonoBehaviour




{


//模型编号




public






enum






EnumModelBumber




{


NetPortA


,


NetPortB


,


NetPortC


,


NetPortD


}




public EnumModelBumber




EnumModel


;


//触碰震动反馈




public






bool




TouchShake


=


true


;


//触碰音效反馈




public






bool




TouchSound


=


true


;


//位置重置




public






void






MsPosReset




(){




MsLightEffect




(


false


);




switch




(


EnumModel


){




case






EnumModelBumber




.


NetPortA


:


transform


.


parent


=


null


;


transform


.


localPosition


=




new Vector3




(


15.6f, 3.41f,


1.8285f


);




break




;




case






EnumModelBumber




.


NetPortB


:


transform


.


parent


=


null


;


transform


.


localPosition


=




new Vector3




(


15.6f


,


3.41f


,


1.925f


);




break




;




case






EnumModelBumber




.


NetPortC


:


transform


.


parent


=


null


;


transform


.


localPosition


=




new Vector3




(


15.6f


,


3.41f


,


1.7488f


);




break




;




case






EnumModeBumber




.


NetPortD


:


transform


.


parent


=


null


;


transform


.


localPosition


=




new Vector3




(


15.6f


,


3.41f


,


1.6407f


);




break




;




default




:




break




;


}




StartCoroutine




(




YiedReset




());


}




IEnumerator






YiedReset




(){




MsCancelBox




(


true


);




MsCancelRig




(


false


);




yield return new WaitForSeconds




(


0.5f


);




MsCancelBox




(


false


);




MsCancelRig




(


true


);


}




private void OnTriggerEnter




(




Collider




other


){




switch




(


EnumModel


){




case






EnumModelBumber




.


NetPortA


:




MsEnterA




(


other


);




break




;




case






EnumModelBumber




.


NetPortB


:




MsEnterB




(


other


);




break




;




case






EnumModeBumber




.


NetPortC


:




MsEnterC




(


other


);




break




;




case






EnumModelBumber




.


NetPortD


:




MsEnterD




(


other


);




break




;




default




:




break




;


}


}




private bool




touchSpace


=


true


;




IEnumerator






MsTouchSpace




(){


touchSpace


=


false


;




yield return new WaitForSeconds




(


1.0f


);


touchSpace


=


true


;


}




private void






MsEnterA




(




Collider




other


){


}




private void






MsEnterB




(




Collider




other


){


}




private void






MsEnterC




(




Collider




other


){


}




private void






MsEnterD




(




Collider




other


){


}




private void OnTriggerStay




(




Collider




other


){




switch




(


EnumModel


){




case






EnumModelBumber




.


NetPortA


:




MsStayA




(


other


);




break




;




case






EnumModelBumber




.


NetPortB


:




MsStayB




(


other


);




break




;




case






EnumModelBumber




.


NetPortC


:




MsStayC




(


other


);




break




;




case






EnumModeBumber




.


NetPortD


:




MsStayD




(


other


);




break




;




default




:




break




;


}


}




private void






MsStayA




(




Collider




other


){


//手柄触发




if




(


other


.


name


.




IndexOf




(





b_r





) >


-1


){




if




(




MyConst




.


RIndexTrigger


){


transform


.


parent


=


other


.


transform


;


transform


.


localPosition


=




new Vector3




(


-0.019f


,


-0.054f


,


0.045f


);


transform


.


localEulerAngles


=




new Vector3




(


-51f


,


38.3f


,


78.4f


);


NetPort


.


MsInstance


.




MsNetAGrab




();




MsLightEffect




(


false


);


}


}


//交换器A网口




if




(


other


.


name


.




Equals




(





NetPortAA





)){


transform


.


parent


=


null


;


transform


.


parent


=


other


.


transform


;


transform


.


localEulerAngles


=




Vector3




.


zero


;


transform


.


localPosition


=




new Vector3




(


-0.00011f


,


0f


,


-0.00447f


);




MsCancelBox




(


false


);




MsCancelRig




(


true


);




MsCancelAll




();


NetPort


.


MsInstance


.




MsNetAMarry




();


}


}


//立钻哥哥:private void MsStayA(Collider other){}




private void






MsStayB




(




Collider




other


){


//手柄触发




if




(


other


.


name


.




IndexOf




(





b_r





) >


-1


){




if




(




MyConst




.


RIndexTrigger


){




MsCancelRig




(


true


);


transform


.


parent


=


other


.


transform


;


transform


.


localPosition


=




new Vector3




(


-0.019f


, –


0.054f


,


0.045f


);


NetPort


.


MsInstance


.




MsNetBGrab




();




MsLightEffect




(


false


);


}


}


//机箱网口




if




(


other


.


name


.




Equals




(





NetPortBA





)){


transform


.


parent


=


null


;


transform


.


parent


=


other


.


transform


;


transform


.


localEulerAngles


=




new Vector3




(


0


,


0


, –


90


);


transform


.


localPosition


=




new Vector3




(


-0.00011f


,


0f


, –


0.00284f


);




MsCancelBox




(


false


);




MsCancelRig




(


true


);




MsCancelAll




();


NetPort


.


MsInstance


.




MsNetBMarry




();


}


}


//立钻哥哥:private void MsStayB(Collider other){}




private void






MsStayC




(




Collider




other


){


… …    // 立钻哥哥:代码类似,不再拓展


}




private void






MsStayD




(




Collider




other


){


… …    // 立钻哥哥:代码类似,不再拓展


}




private void OnTriggerExit




(




Collider




other


){




switch




(


EnumModel


){




case






EnumModelBumber




.


NetPortA


:




MsExitA




(


other


);




break




;




case






EnumModelBumber




.


NetPortB


:




MsExitB




(


other


);




break




;




case






EnumModelBumber




.


NetPortC


:




MsExitC




(


other


);




break




;




case






EnumModelBumber




.


NetPortD


:




MsExitD




(


other


);




break




;




default




:




break




;


}


}


//立钻哥哥:private void OnTriggerExit(Collider other){}




private void






MsExitA




(




Collider




collider


){


}




private void






MsExitB




(




Collider




collider


){


}




private void






MsExitC




(




Collider




collider


){


}




private void






MsExitD




(




Collider




collider


){


}


//呼吸特效




public






void






MsLightEffect




(




bool




off


){




if




(




!






MyConst




.


FirstEnter


){


off


=


false


;


}




for




(




int




i


=


0


;


i


<


transform


.




GetChild




(


0


).


childCount


;


i


++){


transform


.




GetChild




(


0


).




GetChild




(


i


).




GetComponent




<




MeshRenderer




>().


enabled


=


off


;


}


}


//立钻哥哥:public void MsLightEffect(bool off){}


//触碰音效




public






AudioClip




TouchClip


;


//触碰音效播放




public






void






MsPlayTouchClip




(




AudioClip




clip


){




if




(!


TouchSound


){




return




;


}




AudioSource




source


;




if




(


transform


.




GetComponent




<




AudioSource




>() !=


null


){


source


=


transform


.




GetComponent




<




AudioSource




>();


}




else




{


source


=


gameObject


.




AddComponent




<




AudioSource




>();


}


source


.


playOnAwake


=


false


;


source


.


clip


=


clip


;


source


.




Play




();


}


//触碰震动




public






void






MsTouchShake




(){




if




(!


TouchShake


){




return




;


}




VRInput




.


MsInstance


.




RightShock




();


}


//刚体效果




public






void






MsCancelRig




(




bool




off


){


transform


.




GetComponent




<




Rigidbody




>().


isKinematic


=


off


;


}


//碰撞器




public






void






MsCancelBox




(




bool




off


){


transform


.




GetComponent




<




BoxCollider




>().


enabled


=


off


;


}


//不可选状态




public






void






MsCancelAll




(){




MsLightEffect




(


false


);




MsCancelBox




(


false


);




MsCancelRig




(


true


);


}


//可选状态




public






void






MsOnCancelAll




(){




switch




(




MyConst




.


EnumMode


){




case






MyConst




.


EnumExaminMode


.


Study


:




MsLightEffect




(


true


);




break




;




case






MyConst




.


EnumExaminMode


.


Practice


:




break




;




case






MyConst




.


EnumExaminMode


.


Examin


:




break




;




default




:






break




;


}




MsCancelRig




(


false


);




MsCancelBox




(


true


);


}


//立钻哥哥:public void MsOnCancelAll(){}


}


//立钻哥哥:public class NetPortBase:MonoBehaviour{}





##A.11、PlayerMove.cs







##A.11、PlayerMove.cs





++A.11、PlayerMove.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




PlayerMove.cs





public






class






PlayerMove




:




MonoBehaviour




{




private void






LeftControl




(){}




private void






RightControl




(){}


}



++PlayerMove.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




public






class






PlayerMove




:




MonoBehaviour




{




public






float




m_speed


= 5f;




void Update




(){




LeftControl




();




RightControl




();


}




bool




s


,


x


,


z


,


y


;


//左手控制




private void






LeftControl




(){


//左手反向左键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


LThumbstickLeft


)){


print(





立钻哥哥:LThumbstickLeft—-<down>—-





);


//this.transform.Translate(Vector3.right * -m_speed * Time.deltaTime);


z


=


true


;


}




if




(




OVRInput




.




GetUp




(




OVRInput




.


RawButton


.


LThumbstickLeft


)){


print(





立钻哥哥:LThumbstickLeft—-<up>—-





);


//this.transform.Translate(Vector3.right * -m_speed * Time.deltaTime);


z


=


false


;


}




if




(


z


){




this




.


transform


.




Translate




(




Vector3




.


right


* –


m_speed


*




Time




.


deltaTime


);


}


//左手反向右键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


LThumbstickRight


)){


p


rint(





立钻哥哥:LThumbstickRight—-<down>—-





);


y


=


true


;


//this.transform.Translate(Vector3.right * m_speed * Time.deltaTime);


}




if




(




OVRInput




.




GetUp




(




OVRInput




.


RawButton


.


LThumbstickRight


)){


Print(





立钻哥哥:LThumbstickRight—-<up>—-





);


y


=


false


;


//this.transform.Translate(Vector3.right * m_speed * Time.deltaTime);


}




if




(


y


){




this




.


transform


.




Translate




(




Vector3




.


right


*


m_speed


*




Time




.


deltaTime


);


}


//左手反向上键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


LThumbstickUp


)){


//this.transform.Translate(Vector3.forward * m_speed * Time.deltaTime);


s


=


true


print(





立钻哥哥:LThumbstickUp—-<down>—-





);


}




if




(




OVRInput




.




GetUp




(




OVRInput




.


RawButton


.


LThumbstickUp


)){


//this.transform.Translate(Vector3.forward * m_speed * Time.deltaTime);


s


=


false


;


print(





立钻哥哥:LThumbstickUp—-<up>—-





);


}




if




(


s


){




this




.


transform


.




Translate




(




Vector3




.


forward


*


m_speed


*




Time




.


deltaTime


);


}


//左手反向下键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


LThumbstickDown


)){


//this.transform.Translate(Vector3.forward * -m_speed * Time.deltaTime);


Print(





立钻哥哥:LThumbstickDown—-<down>—-





);


x


=


true


;


}




if




(




OVRInput




.




GetUp




(




OVRInput




.


RawButton


.


LThumbstickDown


)){


//this.transform.Translate(Vector3.forward * -m_speed * Time.deltaTime);


print(





立钻哥哥:LThumbstickDown—-<up>—-





);


x


=


false


;


}




if




(


x


){




this




.


transform


.




Translate




(




Vector3




.


forward


* –


m_speed


*




Time




.


deltaTime


);


}


//左手反向中键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


LThumbstick


)){


print(





立钻哥哥:LThumbstick—-<down>—-





);


}


}


//立钻哥哥:private void LeftControl(){}


//右手控制




private void






RightControl




(){


//右手反向左键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


RThumbstickLeft


)){


print(





立钻哥哥:RThumbstickLeft—-<down>—-





);


}


//右手反向右键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


RThumbstickRight


)){


print(





立钻哥哥:RThumbstickRight—-<down>—-





);


}


//右手反向上键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


RThumbstickUp


)){


print(





立钻哥哥:RThumbstickUp—-<down>—-





);


}


//右手反向下键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


RThumbstickDown


)){


print(





立钻哥哥:RThumbstickDown—-<down>—-





);


}


//右手反向中键




if




(




OVRInput




.




GetDown




(




OVRInput




.


RawButton


.


RThumbstick


)){


p


rint(





立钻哥哥:RThumbstick





);


}


}


//立钻哥哥:private void RightControl(){}


}


//立钻哥哥:public class PlayerMove:MonoBehaviour{}





##A.12、StepThree.cs







##A.12、StepThree.cs





++A.12、StepThree.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




StepThree.cs





public






class






StepThree




:




MonoBehaviour




{




private void






MsAddList




(




List




<




Transform




>


list


,




Transform




tran


){}




public






void






MsStepNetPort4




(){}




private void






MsStepNetPort4End




(){}




IEnumerator






IntervalShowText




(){}




public






void






MsStepPingOver




(){}




private void






MsStepPingOverEnd




(){}


}



++StepThree.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;


//步骤三:启动ping,用ping测试两台PC机是否连通




public






class






StepThree




:




MonoBehaviour




{




Files




filePlayer


;




List




<




Transform




>


ListMainStep


=




new List




<




Transform




>();


//主步骤集合




List




<




Transform




>


ListViceStep


=




new List




<




Transform




>();


//IP拼写步骤集合




List




<




Transform




>


ListMoveTarget


=




new List




<




Transform




>();


//移动目标排序集合




List




<




Transform




>


ListText


=




new List




<




Transform




>();


//ping的内容显示集合




List




<




Transform




>


ListCMD


=




new List




<




Transform




>();


//运行中CMD的集合




BasicEvents




basicEvents


;




ClipManager




ClipPlayer


;




void Start




(){


basicEvents


=




new






BasicEvents




();


ClipPlayer


=


gameObject


.




GetComponent




<




ClipManager




>();


filePlayer


=


gameObject


.




GetComponent




<




Files




>();




MsAddList




(


ListMainStep


,


filePlayer


.


ThreeB


.


transform


);




MsAddList




(


ListViceStep


,


filePlayer


.


ThreeBPing


.


transform


);




MsAddList




(


ListText


,


filePlayer


.


ThreeB43


.


transform


);




MsAddList




(


ListCMD


,


filePlayer


.


ThreeBcmd


.


transform


);




MsStepPingPing




();


//MsStepNetPort4();    //测试


}


//list的添加




private void






MsAddList




(




List




<




Transform




>


list


,




Transform




tran


){




for




(




int




i


=


0


;


i


<


tran


.


childCount


;


i


++){


list


.




Add




(


tran


.




GetChild




(


i


));


}


}


//语音:打开windows图标




public






void






MsStepNetPort4




(){


ClipPlayer


.




PlayIndex




(


38


,


MsStepNetPort4End


);


}




private void






MsStepNetPort4End




(){


basicEvents


.




MsGetTransByName




(


ListMainStep


,





NetPort





).




GetComponent




<




UICollision




>().




MsOpenCollider




();


}


//语音:打开运行命令




public






void






MsStepRun40




(){


ClipPlayer


.




PlayIndex




(


39


,


MsStepRun40End


);


}




private void






MsStepRun40End




(){


basicEvents


.




MsGetTransByName




(


ListMainStep


,





4.1





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListMainStep


,





4.1





).




GetChild




(


0


).




GetComponent




<




UICollision




>().




MsOpenCollider




();


}


//语言:填写CMD命令




public






void






MsStepCMD41




(){


basicEvents


.




MsGetTransByName




(


ListCMD


,





C





).




GetComponent




<




UICollision




>().




MsCloseCollider




();


basicEvents


.




MsGetTransByName




(


ListCMD


,





M





).




GetComponent




<




UICollision




>().




MsCloseCollider




();


basicEvents


.




MsGetTransByName




(


ListCMD


,





D





).




GetComponent




<




UICollision




>().




MsCloseCollider




();


ClipPlayer


.




PlayIndex




(


40


,


MsStepCMD41End


);


}




private void






MsStepCMD41End




(){


basicEvents


.




MsGetTransByName




(


ListCMD


,





C





).




GetComponent




<




UICollision




>().




MsOpenCollider




();


basicEvents


.




MsGetTransByName




(


ListCMD


,





M





).




GetComponent




<




UICollision




>().




MsOpenCollider




();


basicEvents


.




MsGetTransByName




(


ListCMD


,





D





).




GetComponent




<




UICollision




>().




MsOpenCollider




();




MsStepCMD41C




();


}


//设置cmd中C为默认第一目标




public






void






MsStepCMD41C




(){




MyConst




.


CurrentMoveTarget


=


basicEvents


.




MsGetTransByName




(


ListCMD


,





c-target





);


}


//设置cmd中M为默认第二目标




public






void






MsStepCMD41M




(){




MyConst




.


CurrentMoveTarget


=


basicEvents


.




MsGetTransByName




(


ListCMD


,





m-target





);


}


//设置cmd中D为默认第三目标




public






void






MsStepCMD41D




(){




MyConst




.


CurrentMoveTarget


=


basicEvents


.




MsGetTransByName




(


ListCMD


,





d-target





);


}


//语音:确认按钮




public






void






MsStepQure42




(){


ClipPlayer


.




PlayIndex




(


41


,


MsStepQure42End


);


}




private void






MsStepQure42End




(){


basicEvents


.




MsGetTransByName




(


ListMainStep


,





4.1(2)





).




GetChild




(


0


).




GetComponent




<




UICollision




>().




MsOpenCollider




();


}


//ping过程




public






void






MsStepPing43




(){


ClipPlayer


.




PlayIndex




(


42


,


MsStepPing43End


);


}




private void






MsStepPing43End




(){




MsStepPingPing




();


}


//设置ping为第一目标




public






void






MsStepPingPing




(){




MyConst




.


CurrentMoveTarget


=


basicEvents


.




MsGetTransByName




(


ListViceStep


,





ping-target





);


}


//设置192为第二目标




public






void






MsStepPing192




(){




MyConst




.


CurrentMoveTarget


=


basicEvents


.




MsGetTransByName




(


ListViceStep


,





192-target





);


}


… ….    //立钻哥哥:代码类似,不拓展


//ping的结果展示




public






void






MsStepPingResult




(){




StartCoroutine




(




IntervalShowText




());


}


//间隔显示字体




IEnumerator






IntervalShowText




(){


basicEvents


.




MsGetTransByName




(


ListText


,





Text(5)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(6)





).


gameObject


.




SetActive




(


true


);




yield return new WaitForSeconds




(


1.0f


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(7)





).


gameObject


.




SetActive




(


true


);




yield return new WaitForSeconds




(


0.5f


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(8)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(9)





).


gameObject


.




SetActive




(


true


);




yield return new WaitForSeconds




(


0.5f


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(11)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(12)





).


gameObject


.




SetActive




(


true


);




yield return new WaitForSeconds




(


0.3f


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(13)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(14)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(16)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(17)





).


gameObject


.




SetActive




(


true


);


basicEvents


.




MsGetTransByName




(


ListText


,





Text(17)





).




GetComponent




<




Twinkle




>.




MsOpenTwink




();


}


//语音:关闭cmd窗口




public






void






MsStepPingOver




(){


ClipPlayer


.




PlayIndex




(


41


,


MsStepPingOverEnd


);


}




private void






MsStepPingOverEnd




(){


}


}


//立钻哥哥:public class StepThree:MonoBehaviour{}





##A.13、TriggerBase.cs







##A.13、TriggerBase.cs





++A.13、TriggerBase.cs

++++立钻哥哥:




public






class






TriggerBase




:




MonoBehaviour




{




private void






OnTriggerEnter




(




Collider




other


){}




private void






OnTriggerStay




(




Collider




other


){}




private void






OnTriggerExit




(




Collider




other


){}


}



++TriggerBase.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;


//基础碰撞事件




public






class






TriggerBase




:




MonoBehaviour




{




public






UnityEvent




Enter


=




new UnityEvent




();




private void OnTriggerEnter




(




Collider




other


){


Enter


.




Invoke




();


}




public






UnityEvent




Stay


=




new UnityEvent




();




private void OnTriggerStay




(




Collider




other


){


Stay


.




Invoke




();


}




public






UnityEvent




Exit


=




new UnityEvent




();




private void OnTriggerExit




(




Collider




other


){


Exit


.




Invoke




();


}


}


//立钻哥哥:public class TriggerBase : MonoBehaviour{}





##A.14、Twinkle.cs







##A.14、Twinkle.cs





++A.14、Twinkle.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




Twinkle.cs





public






class






Twinkle




:




MonoBehaviour




{




IEnumerator






TwinkerSounds




(){}




public






void






MsCloseTwinkle




(){}


}



++A.14、Twinkle.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




UI




;


//闪烁




public






class






Twinkle




:




MonoBehaviour




{


//闪烁的类型




public






enum






EnumTwinkleMode




{


Text


,


Image


}




public EnumTwinkleMode




TwinkleMode


;




public






bool




Twink


=


true


;


//开启闪烁




private Text




textTwink


;


//字体闪烁




private Image




imageTwink


;


//图片闪烁




void Start




(){




switch




(


TwinkleMode


){




case






EnumTwinkleMode




.


Text


:


textTwink


=


gameObject


.




GetComponent




<




Text




>();




break




;




case






EnumTwinkleMode




.


Image


:


imageTwink


=


gameObject


.




GetComponent




<




Image




>();




break




;




default




:




break




;


}


//StartCoroutine(TwinkerSounds());


}


//开启闪烁




public






void






MsOpenTwink




(){




switch




(


TwinkleMode


){




case






EnumTwinkleMode




.


Text


:


textTwink


=


gameObject


.




GetComponent




<




Text




>();




break




;




case






EnumTwinkleMode




.


Image


:


imageTwink


=


gameObject


.




GetComponent




<




Image




>();




break




;




default




:




br






e






ak




;


}


Twink


=


true


;




StartCoroutine




(




TwinkerSounds




());


}




IEnumerator






TwinkerSounds




(){




switch




(


TwinkleMode


){




case






EnumTwinkleMode




.


Text


:


textTwink


.


enabled


=


false


;




break




;




case






EnumTwinkleMode




.


Image


:


imageTwink


.


enabled


=


false


;




break




;




default




:




break




;


}




yield return new WaitForSeconds




(


0.5f


);




switch




(


TwinkleMode


){




case






EnumTwinkleMode




.


Text


:


textTwink


.


enabled


=


true


;




break




;




case






EnumTwinkleMode




.


Image


:


imageTwink


.


enabled


=


true


;




break




;




default




:




break




;


}




yield return new WaitForSeconds




(


0.5f


);




if




(


Twink


){




StartCoroutine




(




TwinkerSounds




());


}


}


//取消闪烁




public






void






MsCloseTwinkle




(){


Twink


=


false


;




StopAllCoroutines




();




switch




(


TwinkleMode


){




case






EnumTwinkleMode




.


Text


:


textTwink


.


enabled


=


false


;




break




;




case






EnumTwinkleMode




.


Image


:


imageTwink


.


enabled


=


false


;




default




:




break




;


}


}


}


//立钻哥哥:public class Twinkle:MonoBehaviour{}





##A.15、VibrationSound.cs







##A.15、VibrationSound.cs





++A.15、VibrationSound.cs

++++立钻哥哥:

\Assets\_Apaqi\Script\Base\




VibrationSound.cs





public






class






VibrationSound




:




MonoBehaviour




{




MsPlayTouchClip




();




MsTouchShockR




();




MsTouchShockL




();




OnTriggerEnter




(




Collider




other


){}


}



++VibrationSound.cs

++++立钻哥哥:




using






System




.




Collections




;




using






System




.




Collections




.




Generic




;




using






UnityEngine




;




using






UnityEngine




.




Events




;


//震动与音效




public






class






VibrationSound




:




MonoBehaviour




{




public






AudioClip




TouchClip


;


//触碰音效




AudioSource




source


;




private void Start




(){




if




(


gameObject


.




GetComponent




<




AudioSource




>() !=


null


){


source


=


gameObject


.




GetComponent




<




AudioSource




>();


}




else




{


source


=


gameObject


.




AddComponent




<




AudioSource




>();


}


}


//触碰音效播放




public






void






MsPlayTouchClip




(){


source


.


playOnAwake


=


false


;


source


.


clip


=


TouchClip


;


source


.




Play




();


}


//右手柄触碰震动




public






void






MsTouchShockR




(){




VRInput




.




MsInstance




.




RightShock




();


}


//右手柄触碰震动




public






void






MsTouchShockL




(){




VRInput




.


MsInstance


.




LeftShock




();


}




private void OnTriggerEnter




(




Collider




other


){




if




(


other


.


gameObject


.


tag


.




Equals




(





NOT





)){




return




;


}




if




(!


other


.


tag


.




Equals




(





Extract





)){




LookUpNode




.


MsInstance


.




MsYieldTrigger




();


}




MsPlayTouchClip




();




MsTouchShockR




();


}


}


//立钻哥哥:public class VibrationSound:MonoBehaviour{}





#B、Http/







#B、Http/





#B、Http/

++++

B.1、




HttpPlayer.cs


++++

B.2、




HTTPRequest.cs


++++

B.3、




HTTPResponse.cs


++++

B.4、




ProtacolTypeEnum.cs


++++

B.5、




StepData.cs






##B.1、HttpPlayer.cs







##B.1、HttpPlayer.cs





++





立钻哥哥推荐的拓展学习链接(Link_Url)










立钻哥哥推荐的拓展学习链接(Link_Url)


++++



立钻哥哥






Unity






学习空间




:





http://blog.csdn.net/VRunSoftYanlz/



++++



Unity企业内训(目录)








https://blog.csdn.net/VRunSoftYanlz/article/details/82634668



++++



Unity企业内训(第1讲)








https://blog.csdn.net/VRunSoftYanlz/article/details/82634733



++++



VR实验:以太网帧的构成








https://blog.csdn.net/VRunSoftYanlz/article/details/82598140



++++



FrameVR示例V0913








https://blog.csdn.net/VRunSoftYanlz/article/details/82808498



++++



计算机组成原理(教材篇)








https://blog.csdn.net/VRunSoftYanlz/article/details/82719129



++++



HTC_VIVE开发基础








https://blog.csdn.net/VRunSoftYanlz/article/details/81989970



++++



Oculus杂谈








https://blog.csdn.net/VRunSoftYanlz/article/details/82469850



++++



Oculus安装使用








https://blog.csdn.net/VRunSoftYanlz/article/details/82718982



++++



VRTK杂谈








https://blog.csdn.net/VRunSoftYanlz/article/details/82562993



++++



VRTK代码结构(目录)








https://blog.csdn.net/VRunSoftYanlz/article/details/82780085



++++



VRTK(SceneResources)








https://blog.csdn.net/VRunSoftYanlz/article/details/82795400



++++



Unity5.x用户手册








https://blog.csdn.net/VRunSoftYanlz/article/details/81712741



++++



Unity面试题ABC








https://blog.csdn.net/vrunsoftyanlz/article/details/78630687



++++



Unity面试题D








https://blog.csdn.net/VRunSoftYanlz/article/details/78630838



++++



Unity面试题E








https://blog.csdn.net/vrunsoftyanlz/article/details/78630913



++++



Unity面试题F








https://blog.csdn.net/VRunSoftYanlz/article/details/78630945



++++



Cocos2dx面试题








https://blog.csdn.net/VRunSoftYanlz/article/details/78630967




++++




Lua快速入门篇(Xlua拓展):







https://blog.csdn.net/VRunSoftYanlz/article/details/81173818




++++




Lua快速入门篇(XLua教程)




:





https://blog.csdn.net/VRunSoftYanlz/article/details/81141502




++++




Lua快速入门篇(基础概述)










https://blog.csdn.net/VRunSoftYanlz/article/details/81041359




++++




框架知识点










https://blog.csdn.net/VRunSoftYanlz/article/details/80862879




++++




游戏框架(UI框架夯实篇)










https://blog.csdn.net/vrunsoftyanlz/article/details/80781140



++++



游戏框架(初探篇)








https://blog.csdn.net/VRunSoftYanlz/article/details/80630325



++++



设计模式简单整理








https://blog.csdn.net/vrunsoftyanlz/article/details/79839641




++++




专题:设计模式(精华篇)










https://blog.csdn.net/VRunSoftYanlz/article/details/81322678



++++



U3D小项目参考








https://blog.csdn.net/vrunsoftyanlz/article/details/80141811



++++



Unity案例(Vehicle)








https://blog.csdn.net/VRunSoftYanlz/article/details/82355876



++++



UML类图








https://blog.csdn.net/vrunsoftyanlz/article/details/80289461



++++



Unity知识点0001








https://blog.csdn.net/vrunsoftyanlz/article/details/80302012



++++



Unity知识点0008








https://blog.csdn.net/VRunSoftYanlz/article/details/81153606



++++



U3D_Shader编程(第一篇:快速入门篇)








https://blog.csdn.net/vrunsoftyanlz/article/details/80372071



++++



U3D_Shader编程(第二篇:基础夯实篇)








https://blog.csdn.net/vrunsoftyanlz/article/details/80372628



++++



Unity引擎基础








https://blog.csdn.net/vrunsoftyanlz/article/details/78881685



++++



Unity面向组件开发








https://blog.csdn.net/vrunsoftyanlz/article/details/78881752



++++



Unity物理系统








https://blog.csdn.net/vrunsoftyanlz/article/details/78881879



++++



Unity2D平台开发








https://blog.csdn.net/vrunsoftyanlz/article/details/78882034



++++



UGUI基础








https://blog.csdn.net/vrunsoftyanlz/article/details/78884693



++++



UGUI进阶








https://blog.csdn.net/vrunsoftyanlz/article/details/78884882



++++



UGUI综合








https://blog.csdn.net/vrunsoftyanlz/article/details/78885013



++++



Unity动画系统基础








https://blog.csdn.net/vrunsoftyanlz/article/details/78886068



++++



Unity动画系统进阶








https://blog.csdn.net/vrunsoftyanlz/article/details/78886198



++++



Navigation导航系统








https://blog.csdn.net/vrunsoftyanlz/article/details/78886281



++++



Unity特效渲染








https://blog.csdn.net/vrunsoftyanlz/article/details/78886403



++++



Unity数据存储








https://blog.csdn.net/vrunsoftyanlz/article/details/79251273



++++



Unity中Sqlite数据库








https://blog.csdn.net/vrunsoftyanlz/article/details/79254162



++++



WWW类和协程








https://blog.csdn.net/vrunsoftyanlz/article/details/79254559



++++



Unity网络








https://blog.csdn.net/vrunsoftyanlz/article/details/79254902



++++



C#事件








https://blog.csdn.net/vrunsoftyanlz/article/details/78631267



++++



C#委托








https://blog.csdn.net/vrunsoftyanlz/article/details/78631183



++++



C#集合








https://blog.csdn.net/vrunsoftyanlz/article/details/78631175



++++



C#泛型








https://blog.csdn.net/vrunsoftyanlz/article/details/78631141



++++



C#接口








https://blog.csdn.net/vrunsoftyanlz/article/details/78631122



++++



C#静态类








https://blog.csdn.net/vrunsoftyanlz/article/details/78630979



++++



C#中System.String类








https://blog.csdn.net/vrunsoftyanlz/article/details/78630945



++++



C#数据类型








https://blog.csdn.net/vrunsoftyanlz/article/details/78630913



++++



Unity3D默认的快捷键








https://blog.csdn.net/vrunsoftyanlz/article/details/78630838



++++



游戏相关缩写








https://blog.csdn.net/vrunsoftyanlz/article/details/78630687



++++



UnityAPI.Rigidbody刚体








https://blog.csdn.net/VRunSoftYanlz/article/details/81784053



++++



UnityAPI.Material材质








https://blog.csdn.net/VRunSoftYanlz/article/details/81814303



++++



UnityAPI.Android安卓








https://blog.csdn.net/VRunSoftYanlz/article/details/81843193



++++



UnityAPI.AndroidJNI安卓JNI








https://blog.csdn.net/VRunSoftYanlz/article/details/81879345



++++



UnityAPI.Transform变换








https://blog.csdn.net/VRunSoftYanlz/article/details/81916293



++++



UnityAPI.WheelCollider轮碰撞器








https://blog.csdn.net/VRunSoftYanlz/article/details/82356217



++++



JSON数据结构








https://blog.csdn.net/VRunSoftYanlz/article/details/82026644



++++



CocosStudio快速入门








https://blog.csdn.net/VRunSoftYanlz/article/details/82356839



++++



立钻哥哥Unity 学习空间




:





http://blog.csdn.net/VRunSoftYanlz/



–_–VRunSoft:lovezuanzuan–_–



版权声明:本文为VRunSoftYanlz原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。