usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassBling:MonoBehaviour{publicTexture img;publicfloat speed;publicstaticbool changeWhite =false;privatefloat alpha=0f;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){}privatevoidOnGUI(){if(changeWhite){alpha += speed * Time.deltaTime;if(alpha>=1){changeWhite =false;}}else{if(alpha>0){alpha -= speed * Time.deltaTime;}}GUI.color =newColor(GUI.color.r, GUI.color.g, GUI.color.b, alpha);GUI.DrawTexture(newRect(0,0,Screen.width,Screen.height),img);}publicstaticvoidblinking(){changeWhite =true;}}
二、在角色脚本触发物体脚本中引用闪烁脚本
usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassFly:MonoBehaviour{//获取小鸟(刚体)privateRigidbody2D bird;//速度publicfloat speed;//跳跃publicfloat jump;//是否存活publicstaticbool life =true;//获取动画器privateAnimator animator;// Start is called before the first frame updatevoidStart(){bird =GetComponent<Rigidbody2D>();animator =GetComponent<Animator>();}// Update is called once per framevoidUpdate(){//村换的时候才能运动if(life){ bird.velocity =newVector2(speed, bird.velocity.y);//鼠标点击给目标一个纵向速度if(Input.GetMouseButtonDown(0)){bird.velocity =newVector2(bird.velocity.x, jump);}}}//如果碰撞器撞到了某个物体privatevoidOnCollisionEnter2D(Collision2D collision){if(life==true){Bling.blinking();}life =false;animator.SetBool("life",false);}}
Linux 系统中 shell 的基本知识
1 什么是 shell
Shell 是一种命令行解释器,它为用户提供了一个向 Linux 内核发送请求以便运行程序的界面系统级程序。用户可以用 shell 来启动、挂起、停止甚至是编写一些程序。
2 Linux 启动过程
Linux 系统的启动过程可以概括为…
Java对象转String
public static String toData(Object object) throws Exception {JAXBContext jc JAXBContext.newInstance(object.getClass());Marshaller m jc.createMarshaller();StringWriter output new StringWriter(2048);m.marshal(object, output);String data …