update 编码格式

master
LeeNux 3 years ago
parent 1185b801fb
commit b445cb7d78

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
@ -6,20 +6,20 @@ using UnityEngine.UI;
public class Game01 : MonoBehaviour
{
public GameObject rocket; // 火箭
public GameObject[] fires; // 成功发射的点火特效
public GameObject fog; // 失败时的冒烟特效
public GameObject rocket; // 火箭
public GameObject[] fires; // 成功发射的点火特效
public GameObject fog; // 失败时的冒烟特效
public GameObject panel;
private GameObject left;
private GameObject right;
private bool fired = false; // 是否点火成功
private float pretime = 3f; // 准备时间
private float timestamp = 0f; // 冷却时间
private float wait = 1f; // 等待时间
private int time = 10; // 倒计时
private int flag = 0; // 标记
private bool fired = false; // 是否点火成功
private float pretime = 3f; // 准备时间
private float timestamp = 0f; // 冷却时间
private float wait = 1f; // 等待时间
private int time = 10; // 倒计时
private int flag = 0; // 标记
private bool passed = false;
// Start is called before the first frame update
@ -34,15 +34,15 @@ public class Game01 : MonoBehaviour
{
if (pretime > 0)
{
// 游戏正式开始前的准备时间
// 游戏正式开始前的准备时间
left.GetComponentInChildren<Text>().text = pretime.ToString("f0");
right.GetComponentInChildren<Text>().text = pretime.ToString("f0");
pretime -= Time.deltaTime;
}
else {
GameLogic(); // 开始游戏主体逻辑
GameLogic(); // 开始游戏主体逻辑
}
// 火箭升空
// 火箭升空
if (fired)
{
rocket.transform.Translate(rocket.transform.up * 0.1f);
@ -112,7 +112,7 @@ public class Game01 : MonoBehaviour
void Success() {
panel.SetActive(true);
panel.transform.GetComponentInChildren<Text>().text = "发射成功";
panel.transform.GetComponentInChildren<Text>().text = "发射成功";
foreach (GameObject f in fires)
{
f.SetActive(true);
@ -122,7 +122,7 @@ public class Game01 : MonoBehaviour
void Failed() {
panel.SetActive(true);
panel.GetComponentInChildren<Text>().text = "发射失败";
panel.GetComponentInChildren<Text>().text = "发射失败";
Instantiate(fog);
}

@ -1,11 +1,11 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float health = 100; // 角色生命值
public float health = 100; // 角色生命值
public Rigidbody rb;
public int speed = 20;
@ -23,26 +23,26 @@ public class Player : MonoBehaviour
Destroy(gameObject);
}
// 前
// 前
if (Input.GetKey(KeyCode.W)){
rb.AddForce(transform.forward * speed);
}
// 后
// 后
if (Input.GetKey(KeyCode.S))
{
rb.AddForce(transform.forward * -speed);
}
// 右
// 右
if (Input.GetKey(KeyCode.D))
{
rb.AddForce(transform.right * speed);
}
// 左
// 左
if (Input.GetKey(KeyCode.A))
{
rb.AddForce(transform.right * -speed);
}
// 跳
// 跳
if (Input.GetKey(KeyCode.Space))
{
rb.AddForce(transform.up * speed);

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@ -21,8 +21,8 @@ public class Skill : MonoBehaviour
{
if (coolDown > 0)
{
// deltaTime 是当前Update执行和上一次Update执行的时间差
// 用来拟合计算现实时间,不受帧率的影响。
// deltaTime 是当前Update执行和上一次Update执行的时间差
// 用来拟合计算现实时间,不受帧率的影响。
coolDown -= Time.deltaTime;
text.text = coolDown.ToString("f1");
image.fillAmount = coolDown / coolDonwTime;
@ -37,9 +37,9 @@ public class Skill : MonoBehaviour
public void UseSkill() {
if(coolDown > 0) { } else
{
// 释放技能,并进入冷却
// 释放技能,并进入冷却
/* 释放技能的代码 */
/* 释放技能的代码 */
coolDown = coolDonwTime;
}
}

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

@ -1,10 +1,10 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class jump : MonoBehaviour
{
public int time = 10; // 次数
public int time = 10; // 次数
// Start is called before the first frame update
void Start()
{

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@ -11,7 +11,7 @@ public class move : MonoBehaviour
// Start is called before the first frame update
void Start()
{
// s = GameObject.Find("Sphere"); // 从层级面板中搜索名字为Sphere的游戏对象
// s = GameObject.Find("Sphere"); // 从层级面板中搜索名字为Sphere的游戏对象
}
@ -20,7 +20,7 @@ public class move : MonoBehaviour
{
if (Input.GetKeyDown(KeyCode.W)) {
float z = this.transform.position.z; // 定义Z接受当前的Z坐标
float z = this.transform.position.z; // 定义Z接受当前的Z坐标
z++;
@ -35,7 +35,7 @@ public class move : MonoBehaviour
if (Input.GetKeyUp(KeyCode.S))
{
float z = this.transform.position.z; // 定义Z接受当前的Z坐标
float z = this.transform.position.z; // 定义Z接受当前的Z坐标
z -= .1f;
@ -59,7 +59,7 @@ public class move : MonoBehaviour
{
float h = Input.GetAxis("Horizontal");
x += h * 0.1f; // 当我们H为负数的时候则向左移
x += h * 0.1f; // 当我们H为负数的时候则向左移
this.transform.position = new Vector3(
x,

Loading…
Cancel
Save