unity day 4
来源:互联网 发布:linux按时间分割log 编辑:程序博客网 时间:2024/06/03 21:20
编程跑马灯小游戏,感觉就学习了一个Grid Layout Group组件,和熟悉下ugui得使用。
代码:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Specialized;
public class run : MonoBehaviour {
public Image[] touxiang=new Image[20] ;
bool start=false;
bool buttomdowntwo=false;
float time=0;
int i=0;
int temp=0;
int[] num = new int[4];
float timestop=10;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (start&×top>8) {
time += Time.deltaTime;
if (time < 0.1f) {
touxiang [i].color = new Color (0.5f, 0.5f, 0.5f, 0.5f);
} else {
touxiang [i].color = new Color (1, 1, 1, 1);
time = 0;
i++;
if (i > 18) {
i = 0;
}
}
}
if (buttomdowntwo&&temp<4) {
num [temp] = i;
if (temp >= 1) {
for (int j = 0; j <temp; j++) {
if (num [temp] == num [j]) {
temp--;
}
}
}
i = 0;
temp++;
buttomdowntwo = false;
}
if (temp > 0 && temp < 5) {
for (int j = 0; j < temp; j++) {
touxiang [num [j]].color = new Color (1, 1, 1, Random.Range (0, 1.0f));
}
}
}
public void getbuttomdown()
{
if (start == false) {
start = true;
} else {
start = false;
buttomdowntwo = true;
}
}
}
并没有实现随机,也没打算写下去了,因为写太乱,不想写了
- unity day 4
- unity day 1
- unity day 3
- Unity Learning for Day 2
- Unity Learning for Day 3
- Unity Learning for Day 5
- Unity Learning for Day 6
- Unity Learning for Day 9
- Unity Learning for Day 12
- Unity Learning for Day 13
- Unity Learning for Day 14
- Unity Learning for Day 15
- Unity Learning for Day 16
- Unity Learning for Day 17
- Unity Learning for Day 19
- Unity Learning for Day 20
- Unity Learning for Day 21
- Unity Learning for Day 22
- (25)类型转换
- PHP7新特性
- I2C总线协议
- Java 8 实战教学大纲
- oracle--管理子程序的常用系统视图
- unity day 4
- 原生的Ajax的封装
- I2C总线协议详解
- powermock实战教学
- Mybatis foreach嵌套遍历Map的key和value
- Codeforces 476C Dreamoon and Sums【思维】
- 最小路径
- 第92篇跳转关闭窗口开发(二)
- Spring与代理模式和实例工厂模式的整合使用