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);}}
1、容器提供的类型 2、Array
Array大小固定,只允许替换元素的值,不能增加或者移除元素改变大小。Array是一种有序集合,支持随机访问。
std::array<int, 4> x; //elements of x have undefined value
std::array<int, 5> x {…
题目:
HJ103 Redraiment的走法
题解:
dfs 暴力搜索
枚举数组元素,作为起点如果后续节点大于当前节点,继续向后搜索记录每个起点的结果,求出最大值 public int getLongestSub(int[] arr) {int max 0;for (int i 0…