Skip to content

Commit 018e097

Browse files
committed
完成api文档的部署docfx docfx.json --force --serve这是部署指令
1 parent 8a692ce commit 018e097

38 files changed

+2229
-829
lines changed

team_project/Assets/CommonScripts/CameraSystem.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44

5+
/// <summary>
6+
/// Manages camera switching functionality in the game.
7+
/// </summary>
58
public class CameraSwitch : MonoBehaviour
69
{
7-
public GameObject Camera1; // First camera
8-
public GameObject Camera2; // Second camera
10+
/// <summary>
11+
/// The first camera GameObject.
12+
/// </summary>
13+
public GameObject Camera1;
914

10-
// Update is called once per frame
15+
/// <summary>
16+
/// The second camera GameObject.
17+
/// </summary>
18+
public GameObject Camera2;
19+
20+
/// <summary>
21+
/// Updates the camera states based on input, called once per frame.
22+
/// </summary>
1123
void Update()
1224
{
1325
if (Input.GetButtonDown("camera1"))
@@ -23,4 +35,4 @@ void Update()
2335
Camera2.SetActive(true);
2436
}
2537
}
26-
}
38+
}

team_project/Assets/CommonScripts/DayNightCycle.cs

Lines changed: 91 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,83 @@
88
* usage: I used the prompt "我想要基于unity制作一个赛车小游戏,现在我要实现时间变化脚本,你能帮我写一下控制脚本吗", and
99
* directly copy the code from its response
1010
*/
11+
/// <summary>
12+
/// Manages the day-night cycle in the game, controlling sun and moon lighting based on time and weather.
13+
/// </summary>
1114
public class DayNightCycle : MonoBehaviour
1215
{
13-
[Header("时间设置")]
14-
public float dayLengthInMinutes = 1f; // 一天的长度(1分钟 = 一天)
15-
private float timeOfDay = 0f; // 范围 0.0~1.0,表示一天的进度
16+
/// <summary>
17+
/// The length of a full day in minutes.
18+
/// </summary>
19+
public float dayLengthInMinutes = 1f;
1620

17-
[Header("太阳设置")]
21+
/// <summary>
22+
/// The current progress of the day, ranging from 0.0 to 1.0.
23+
/// </summary>
24+
private float timeOfDay = 0f;
25+
26+
/// <summary>
27+
/// The light representing the sun.
28+
/// </summary>
1829
public Light sun;
30+
31+
/// <summary>
32+
/// Animation curve controlling the sun's light intensity over time.
33+
/// </summary>
1934
public AnimationCurve lightIntensity;
2035

21-
[Header("月亮设置")]
36+
/// <summary>
37+
/// The light representing the moon.
38+
/// </summary>
2239
public Light moon;
23-
public AnimationCurve moonIntensity; // 控制月亮亮度随时间变化
24-
public Gradient moonColor; // 控制月亮颜色随时间变化
2540

26-
[Header("天气影响强度")]
41+
/// <summary>
42+
/// Animation curve controlling the moon's light intensity over time.
43+
/// </summary>
44+
public AnimationCurve moonIntensity;
45+
46+
/// <summary>
47+
/// Gradient controlling the moon's color changes over time.
48+
/// </summary>
49+
public Gradient moonColor;
50+
51+
/// <summary>
52+
/// Reference to the weather system affecting light intensity.
53+
/// </summary>
2754
public WeatherSystem weatherSystem;
55+
56+
/// <summary>
57+
/// Maximum light intensity during clear weather.
58+
/// </summary>
2859
public float maxIntensityClear = 1.2f;
60+
61+
/// <summary>
62+
/// Maximum light intensity during rainy weather.
63+
/// </summary>
2964
public float maxIntensityRain = 0.6f;
30-
public float maxIntensityFog = 0.4f;
3165

32-
[Header("不同天气的光照颜色渐变")]
66+
/// <summary>
67+
/// Maximum light intensity during foggy weather.
68+
/// </summary>
69+
public float maxIntensityFog = 0.4f;
70+
/// <summary>
71+
/// Gradient for light color during clear weather.
72+
/// </summary>
3373
public Gradient clearColor;
74+
75+
/// <summary>
76+
/// Gradient for light color during rainy weather.
77+
/// </summary>
3478
public Gradient rainColor;
79+
80+
/// <summary>
81+
/// Gradient for light color during foggy weather.
82+
/// </summary>
3583
public Gradient fogColor;
3684

85+
/// <summary>
86+
/// Initializes the day-night cycle, setting up default gradients for moon and weather-based lighting.
87+
/// </summary>
3788
void Start()
3889
{
3990
// 设置默认月亮颜色渐变(夜晚蓝白色)
@@ -52,61 +103,64 @@ void Start()
52103
}
53104
);
54105

55-
// ?? Clear�����죩��ɫ����
106+
// 设置Clear(晴天)颜色渐变
56107
clearColor = new Gradient();
57108
clearColor.SetKeys(
58109
new GradientColorKey[]
59110
{
60-
new GradientColorKey(new Color(15f / 255f, 20f / 255f, 50f / 255f), 0.0f),
61-
new GradientColorKey(new Color(255f / 255f, 140f / 255f, 60f / 255f), 0.25f),
62-
new GradientColorKey(new Color(255f / 255f, 255f / 255f, 240f / 255f), 0.5f),
63-
new GradientColorKey(new Color(255f / 255f, 120f / 255f, 80f / 255f), 0.75f),
64-
new GradientColorKey(new Color(15f / 255f, 20f / 255f, 50f / 255f), 1.0f)
111+
new GradientColorKey(new Color(15f / 255f, 20f / 255f, 50f / 255f), 0.0f),
112+
new GradientColorKey(new Color(255f / 255f, 140f / 255f, 60f / 255f), 0.25f),
113+
new GradientColorKey(new Color(255f / 255f, 255f / 255f, 240f / 255f), 0.5f),
114+
new GradientColorKey(new Color(255f / 255f, 120f / 255f, 80f / 255f), 0.75f),
115+
new GradientColorKey(new Color(15f / 255f, 20f / 255f, 50f / 255f), 1.0f)
65116
},
66117
new GradientAlphaKey[]
67118
{
68-
new GradientAlphaKey(1.0f, 0.0f),
69-
new GradientAlphaKey(1.0f, 1.0f)
119+
new GradientAlphaKey(1.0f, 0.0f),
120+
new GradientAlphaKey(1.0f, 1.0f)
70121
}
71122
);
72123

73-
// ??? Rain�����죩��ɫ����
124+
// 设置Rain(雨天)颜色渐变
74125
rainColor = new Gradient();
75126
rainColor.SetKeys(
76127
new GradientColorKey[]
77128
{
78-
new GradientColorKey(new Color(115f / 255f, 120f / 255f, 133f / 255f), 0.0f),
79-
new GradientColorKey(new Color(107f / 255f, 112f / 255f, 128f / 255f), 0.25f),
80-
new GradientColorKey(new Color(102f / 255f, 107f / 255f, 125f / 255f), 0.5f),
81-
new GradientColorKey(new Color(110f / 255f, 115f / 255f, 130f / 255f), 0.75f),
82-
new GradientColorKey(new Color(120f / 255f, 122f / 255f, 135f / 255f), 1.0f)
129+
new GradientColorKey(new Color(115f / 255f, 120f / 255f, 133f / 255f), 0.0f),
130+
new GradientColorKey(new Color(107f / 255f, 112f / 255f, 128f / 255f), 0.25f),
131+
new GradientColorKey(new Color(102f / 255f, 107f / 255f, 125f / 255f), 0.5f),
132+
new GradientColorKey(new Color(110f / 255f, 115f / 255f, 130f / 255f), 0.75f),
133+
new GradientColorKey(new Color(120f / 255f, 122f / 255f, 135f / 255f), 1.0f)
83134
},
84135
new GradientAlphaKey[]
85136
{
86-
new GradientAlphaKey(1.0f, 0.0f),
87-
new GradientAlphaKey(1.0f, 1.0f)
137+
new GradientAlphaKey(1.0f, 0.0f),
138+
new GradientAlphaKey(1.0f, 1.0f)
88139
}
89140
);
90141

91-
// ??? Fog�����죩��ɫ����
142+
// 设置Fog(雾天)颜色渐变
92143
fogColor = new Gradient();
93144
fogColor.SetKeys(
94145
new GradientColorKey[]
95146
{
96-
new GradientColorKey(new Color(191f / 255f, 191f / 255f, 191f / 255f), 0.0f),
97-
new GradientColorKey(new Color(204f / 255f, 204f / 255f, 204f / 255f), 0.25f),
98-
new GradientColorKey(new Color(217f / 255f, 217f / 255f, 217f / 255f), 0.5f),
99-
new GradientColorKey(new Color(209f / 255f, 209f / 255f, 209f / 255f), 0.75f),
100-
new GradientColorKey(new Color(199f / 255f, 199f / 255f, 199f / 255f), 1.0f)
147+
new GradientColorKey(new Color(191f / 255f, 191f / 255f, 191f / 255f), 0.0f),
148+
new GradientColorKey(new Color(204f / 255f, 204f / 255f, 204f / 255f), 0.25f),
149+
new GradientColorKey(new Color(217f / 255f, 217f / 255f, 217f / 255f), 0.5f),
150+
new GradientColorKey(new Color(209f / 255f, 209f / 255f, 209f / 255f), 0.75f),
151+
new GradientColorKey(new Color(199f / 255f, 199f / 255f, 199f / 255f), 1.0f)
101152
},
102153
new GradientAlphaKey[]
103154
{
104-
new GradientAlphaKey(1.0f, 0.0f),
105-
new GradientAlphaKey(1.0f, 1.0f)
155+
new GradientAlphaKey(1.0f, 0.0f),
156+
new GradientAlphaKey(1.0f, 1.0f)
106157
}
107158
);
108159
}
109160

161+
/// <summary>
162+
/// Updates the day-night cycle, adjusting sun and moon positions, colors, and intensities based on time and weather.
163+
/// </summary>
110164
void Update()
111165
{
112166
// 更新时间
@@ -121,7 +175,7 @@ void Update()
121175
float moonAngle = sunAngle + 180f;
122176
moon.transform.rotation = Quaternion.Euler(moonAngle, -90f, 10f);
123177

124-
// ���ù�����ɫ
178+
// 设置光照颜色
125179
Gradient currentGradient = clearColor;
126180
if (weatherSystem != null)
127181
{
@@ -133,7 +187,7 @@ void Update()
133187
}
134188
sun.color = currentGradient.Evaluate(timeOfDay);
135189

136-
// ���ù���ǿ��
190+
// 设置光照强度
137191
float weatherMultiplier = 1f;
138192
if (weatherSystem != null)
139193
{
@@ -160,4 +214,4 @@ void Update()
160214
}
161215
moon.intensity = moonIntensity.Evaluate(timeOfDay) * moonMultiplier * 0.4f;
162216
}
163-
}
217+
}

team_project/Assets/CommonScripts/KeyboardUI.cs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,46 @@
11
using UnityEngine;
22
using UnityEngine.UI;
33

4+
/// <summary>
5+
/// Manages switching of RawImage textures based on keyboard input.
6+
/// </summary>
47
public class KeyImageSwitcher : MonoBehaviour
58
{
9+
/// <summary>
10+
/// Represents a pair of a key and its associated RawImage textures.
11+
/// </summary>
612
[System.Serializable]
713
public class KeyImagePair
814
{
9-
public KeyCode key; // 对应的按键
10-
public RawImage targetImage; // 目标Raw Image组件
11-
public Texture normalTexture; // 普通状态的贴图
12-
public Texture pressedTexture;// 按下状态的贴图
15+
/// <summary>
16+
/// The key associated with the image switch.
17+
/// </summary>
18+
public KeyCode key;
19+
20+
/// <summary>
21+
/// The target RawImage component to update.
22+
/// </summary>
23+
public RawImage targetImage;
24+
25+
/// <summary>
26+
/// The texture to display when the key is not pressed.
27+
/// </summary>
28+
public Texture normalTexture;
29+
30+
/// <summary>
31+
/// The texture to display when the key is pressed.
32+
/// </summary>
33+
public Texture pressedTexture;
1334
}
1435

15-
public KeyImagePair[] keyImagePairs; // 在Inspector中设置按键和图片的对应关系
36+
/// <summary>
37+
/// Array of key-image pairs configured in the Inspector.
38+
/// </summary>
39+
public KeyImagePair[] keyImagePairs;
1640

41+
/// <summary>
42+
/// Updates the texture of each RawImage based on the corresponding key's state, called once per frame.
43+
/// </summary>
1744
void Update()
1845
{
1946
foreach (var pair in keyImagePairs)

team_project/Assets/CommonScripts/SceneJumper.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22
using UnityEngine.UI;
33
using UnityEngine.SceneManagement;
44

5-
6-
75
/**
86
* AI-generated-content
97
* tool: grok
108
* version: 3.0
119
* usage: I used the prompt "我想要基于unity制作一个赛车小游戏,现在我要实现怎么让某个按钮被点击了之后跳转到某个场景?,你能帮我写一下控制脚本吗", and
1210
* directly copy the code from its response
1311
*/
12+
/// <summary>
13+
/// Handles button click events to load a specified scene in Unity.
14+
/// </summary>
1415
public class MyButtonHandler : MonoBehaviour
1516
{
16-
[Tooltip("跳转的场景名称(必须在 Build Settings 中注册)")]
17+
/// <summary>
18+
/// The name of the target scene to load (must be registered in Build Settings).
19+
/// </summary>
1720
public string targetSceneName = "GameScene";
1821

22+
/// <summary>
23+
/// Initializes the button click listener during the Awake phase.
24+
/// </summary>
1925
void Awake()
2026
{
2127
// 自动获取当前 GameObject 上的 Button 组件
@@ -31,4 +37,4 @@ void Awake()
3137
Debug.LogWarning("未在该物体上找到 Button 组件!");
3238
}
3339
}
34-
}
40+
}

0 commit comments

Comments
 (0)