Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
软件工程实践2022年春W班
FZUniTeam
Project_Team13
提交
fd320181
P
Project_Team13
项目概览
软件工程实践2022年春W班
/
FZUniTeam
/
Project_Team13
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Project_Team13
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fd320181
编写于
6月 18, 2022
作者:
秃头给你一拳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Beta
上级
572b6915
变更
29
显示空白变更内容
内联
并排
Showing
29 changed file
with
545 addition
and
74 deletion
+545
-74
00.Scripts/Characters/FootStepTrigger.cs
00.Scripts/Characters/FootStepTrigger.cs
+65
-0
00.Scripts/Characters/FootStepTrigger.cs.meta
00.Scripts/Characters/FootStepTrigger.cs.meta
+11
-0
00.Scripts/Characters/Player/CameraTestController.cs
00.Scripts/Characters/Player/CameraTestController.cs
+8
-7
00.Scripts/Characters/Player/PlayerManager.cs
00.Scripts/Characters/Player/PlayerManager.cs
+8
-7
00.Scripts/Characters/Player/PlayerMove.cs
00.Scripts/Characters/Player/PlayerMove.cs
+26
-6
00.Scripts/Environment/Day_Follows_Night.cs
00.Scripts/Environment/Day_Follows_Night.cs
+47
-0
00.Scripts/Environment/Day_Follows_Night.cs.meta
00.Scripts/Environment/Day_Follows_Night.cs.meta
+11
-0
00.Scripts/ImpactEffect/IImpactEffect.cs
00.Scripts/ImpactEffect/IImpactEffect.cs
+2
-2
00.Scripts/Interact/InteractableObj.cs
00.Scripts/Interact/InteractableObj.cs
+6
-0
00.Scripts/Interact/NpcInteract.cs
00.Scripts/Interact/NpcInteract.cs
+15
-7
00.Scripts/Manager/AudioManager.cs
00.Scripts/Manager/AudioManager.cs
+21
-0
00.Scripts/Manager/AudioManager.cs.meta
00.Scripts/Manager/AudioManager.cs.meta
+11
-0
00.Scripts/Manager/GameDataManager.cs
00.Scripts/Manager/GameDataManager.cs
+18
-0
00.Scripts/Manager/LoadManager.cs
00.Scripts/Manager/LoadManager.cs
+5
-5
00.Scripts/Manager/NpcGenerateManager.cs
00.Scripts/Manager/NpcGenerateManager.cs
+5
-4
00.Scripts/Manager/QuestManager.cs
00.Scripts/Manager/QuestManager.cs
+5
-4
00.Scripts/ScriptableObject/Dialog_SO.cs
00.Scripts/ScriptableObject/Dialog_SO.cs
+3
-2
00.Scripts/ScriptableObject/PlayerSaveData_SO.cs
00.Scripts/ScriptableObject/PlayerSaveData_SO.cs
+3
-0
00.Scripts/ScriptableObject/Quest_SO.cs
00.Scripts/ScriptableObject/Quest_SO.cs
+30
-6
00.Scripts/UI/DialogPanel.cs
00.Scripts/UI/DialogPanel.cs
+24
-1
00.Scripts/UI/LoadPanel.cs
00.Scripts/UI/LoadPanel.cs
+78
-21
00.Scripts/UI/MainMenu.cs
00.Scripts/UI/MainMenu.cs
+4
-2
00.Scripts/UI/Panel.cs
00.Scripts/UI/Panel.cs
+65
-0
00.Scripts/UI/Panel.cs.meta
00.Scripts/UI/Panel.cs.meta
+11
-0
00.Scripts/UI/Phone/App_Modifier.cs
00.Scripts/UI/Phone/App_Modifier.cs
+45
-0
00.Scripts/UI/Phone/App_Modifier.cs.meta
00.Scripts/UI/Phone/App_Modifier.cs.meta
+11
-0
00.Scripts/UI/Phone/App_PlayerInfo.cs
00.Scripts/UI/Phone/App_PlayerInfo.cs
+5
-0
00.Scripts/UI/Phone/PhonePanel.cs
00.Scripts/UI/Phone/PhonePanel.cs
+2
-0
《福大模拟器》——用户调查报告.docx
《福大模拟器》——用户调查报告.docx
+0
-0
未找到文件。
00.Scripts/Characters/FootStepTrigger.cs
0 → 100644
浏览文件 @
fd320181
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
FootStepTrigger
:
MonoBehaviour
{
//成员_触发器
protected
Collider
_trigger
;
public
Collider
Trigger
{
get
{
if
(
_trigger
==
null
)
_trigger
=
GetComponent
<
Collider
>();
return
_trigger
;
}
}
//成员_音源
protected
AudioSource
_audioSource
;
public
AudioSource
AudioSource
{
get
{
if
(
_audioSource
==
null
)
_audioSource
=
GetComponent
<
AudioSource
>();
return
_audioSource
;
}
}
//冷却时间
protected
float
coolTime
=.
45f
;
protected
bool
canUse
=
true
;
//debug绘制
void
OnDrawGizmos
()
{
if
(!
Trigger
)
return
;
Color
color
=
Color
.
green
;
color
.
a
=
0.5f
;
Gizmos
.
color
=
color
;
if
(
Trigger
is
SphereCollider
)
{
Gizmos
.
DrawSphere
((
Trigger
.
bounds
.
center
),
(
Trigger
as
SphereCollider
).
radius
);
}
}
private
void
OnTriggerEnter
(
Collider
other
)
{
if
(
other
.
GetComponent
<
InteractableObj
>())
return
;
if
(!
canUse
)
return
;
var
stepAudioList
=
AudioManager
.
GetInstance
().
FootStepAudios
;
AudioClip
audioTemp
=
stepAudioList
[
Random
.
Range
(
0
,
stepAudioList
.
Length
)];
AudioSource
.
PlayOneShot
(
audioTemp
);
canUse
=
false
;
StartCoroutine
(
SetCanUse
());
}
IEnumerator
SetCanUse
()
{
yield
return
new
WaitForSeconds
(
coolTime
);
canUse
=
true
;
}
}
00.Scripts/Characters/FootStepTrigger.cs.meta
0 → 100644
浏览文件 @
fd320181
fileFormatVersion: 2
guid: 14342d96177d6de46b0bca90c7823d0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
00.Scripts/Characters/Player/CameraTestController.cs
浏览文件 @
fd320181
...
...
@@ -79,19 +79,19 @@ namespace FunTools
Vector3
GetInputTranslationDirection
()
{
Vector3
direction
=
new
Vector3
();
if
(
Input
.
GetKey
(
KeyCode
.
W
))
if
(
Input
.
GetKey
(
KeyCode
.
UpArrow
))
{
direction
+=
Vector3
.
forward
;
}
if
(
Input
.
GetKey
(
KeyCode
.
S
))
if
(
Input
.
GetKey
(
KeyCode
.
DownArrow
))
{
direction
+=
Vector3
.
back
;
}
if
(
Input
.
GetKey
(
KeyCode
.
A
))
if
(
Input
.
GetKey
(
KeyCode
.
LeftArrow
))
{
direction
+=
Vector3
.
left
;
}
if
(
Input
.
GetKey
(
KeyCode
.
D
))
if
(
Input
.
GetKey
(
KeyCode
.
RightArrow
))
{
direction
+=
Vector3
.
right
;
}
...
...
@@ -108,14 +108,15 @@ namespace FunTools
void
Update
()
{
// Exit Sample
if
(
Input
.
GetKey
(
KeyCode
.
Escape
))
// Exit Sample 傻逼,这边之前是直接退出游戏,复用别人代码之前还是得看看
// 相机还是直接通过PlayerManager关闭吧,这边关闭逻辑有点混乱,输入都在PlayerInput当中处理
/*if (Input.GetKey(KeyCode.Escape))
{
Application.Quit();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
}
*/
// Hide and lock cursor when right mouse button pressed
if
(
Input
.
GetMouseButtonDown
(
1
))
...
...
00.Scripts/Characters/Player/PlayerManager.cs
浏览文件 @
fd320181
...
...
@@ -52,9 +52,10 @@ public class PlayerManager : MonoBehaviour
cameraSjw
.
SetActive
(
egleFlag
);
//将摄像机的状态设为启用或者不启用
}
// 如果开启鹰眼的话,就不处理玩家的其他输入,, 加一个如何开启了事件面板就不处理玩家输入
if
(!
egleFlag
)
{
// 如果开启鹰眼的话,就不处理玩家的其他输入,, 加一个如果开启了事件面板就不处理玩家输入
//暂时注释掉了,可以同时操控相机和玩家
//if (!egleFlag)
//{
playerInput
.
HandleInput
();
if
(
cameraHandler
!=
null
)
...
...
@@ -62,7 +63,7 @@ public class PlayerManager : MonoBehaviour
cameraHandler
.
FollowTarget
(
delta
);
cameraHandler
.
HandleCameraRotation
(
delta
,
playerInput
.
mouseX
,
playerInput
.
mouseY
);
}
}
//
}
}
private
void
FixedUpdate
()
...
...
@@ -71,8 +72,8 @@ public class PlayerManager : MonoBehaviour
// 如果开启鹰眼的话,就不处理玩家的其他输入,, 加一个如何开启了事件面板就不处理玩家输入 && !UIManager.GetInstance().accidentPanel.isActiveAndEnabled
if
(!
egleFlag
)
{
//
if (!egleFlag)
//
{
//操作刚体
playerMove
.
UpdateMoveDirection
(
Camera
.
main
.
transform
);
playerMove
.
HandleMovement
();
...
...
@@ -81,6 +82,6 @@ public class PlayerManager : MonoBehaviour
playerMove
.
ControlJumpBehaviour
();
playerMove
.
AirControl
();
playerMove
.
UpdateAnimatorParameters
();
}
//
}
}
}
00.Scripts/Characters/Player/PlayerMove.cs
浏览文件 @
fd320181
...
...
@@ -86,6 +86,8 @@ public class PlayerMove : MonoBehaviour
if
(!
isGround
)
return
;
//处于特殊动画时,不让动(交由动画控制)
if
(
playerAnimation
.
GetBoolParameter
(
"isInteracting"
))
return
;
//不让动时,不让动(废话)(对话时不让动)(临时屎代码)
if
(!
CanControlMove
())
return
;
//设置人物的速度(实际),动画混合数的速度(动画)
SetControllerMoveSpeed
();
...
...
@@ -99,11 +101,12 @@ public class PlayerMove : MonoBehaviour
//设置预定的控制器速度(moveSpeed)
protected
virtual
void
SetControllerMoveSpeed
()
{
var
targetSpringSpeed
=
GameDataManager
.
GetInstance
().
saveData
.
isFastRun
?
sprintSpeed
*
10
:
sprintSpeed
;
if
(
GetMoveAmout
()
==
0
)
//TODO:无法顺滑停止。以后再说
{
moveSpeed
=
Mathf
.
Lerp
(
moveSpeed
,
0
,
6
*
Time
.
deltaTime
);
//6是平滑过渡值
}
else
moveSpeed
=
Mathf
.
Lerp
(
moveSpeed
,
isSprinting
?
sprint
Speed
:
normalSpeed
,
6
*
Time
.
deltaTime
);
//6是平滑过渡值
else
moveSpeed
=
Mathf
.
Lerp
(
moveSpeed
,
isSprinting
?
targetSpring
Speed
:
normalSpeed
,
6
*
Time
.
deltaTime
);
//6是平滑过渡值
}
...
...
@@ -188,7 +191,6 @@ public class PlayerMove : MonoBehaviour
#
endregion
#
region
处理旋转
public
void
HandleRotation
()
{
...
...
@@ -215,9 +217,15 @@ public class PlayerMove : MonoBehaviour
/// </summary>
public
void
TryDoJump
()
{
//TODO:感觉这里和处理移动那里挺像的。但又不像。
if
(!
isGround
)
Debug
.
Log
(
"可以禁止无限跳,但没必要"
);
//不在地上时,检查无限跳
if
(!
isGround
)
{
if
(!
GameDataManager
.
GetInstance
().
saveData
.
isUnlimitJump
)
return
;
}
if
(
playerAnimation
.
GetBoolParameter
(
"isInteracting"
))
return
;
//不让动时,不让动(废话)(对话时不让动)(临时屎代码)
if
(!
CanControlMove
())
return
;
//跳!
jumpCounter
=
jumpTimer
;
...
...
@@ -256,15 +264,18 @@ public class PlayerMove : MonoBehaviour
/// </summary>
public
virtual
void
AirControl
()
{
//Debug.Log(isGround);
//目前属实没啥内容很单薄。单薄到想移到别的地方去。不过还是先放着吧
if
(
isGround
)
return
;
//TODO:重要bug,有时候不知道为啥检测的isground是错的,来不及了不管了,直接暴力if
//猜测是地面检测的射线还是什么东西检测到了紧贴的非地面的其他物体上导致误判,来不及了不管了
if
(!
CanControlMove
())
return
;
MoveUnit
(
moveDirection
,
true
);
}
#
endregion
#
region
地面检测
public
virtual
void
CheckGround
()
...
...
@@ -341,6 +352,15 @@ public class PlayerMove : MonoBehaviour
#
endregion
//对话时,不让移动和跳跃,目前写的比较粗暴
public
bool
CanControlMove
()
{
if
(
UIManager
.
GetInstance
().
dialogPanel
.
gameObject
.
activeInHierarchy
)
{
StopCharacterWithLerp
();
return
false
;
}
return
true
;
}
}
00.Scripts/Environment/Day_Follows_Night.cs
0 → 100644
浏览文件 @
fd320181
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
Day_Follows_Night
:
MonoBehaviour
{
public
Material
[]
mats
;
private
int
index
=
0
;
// Start is called before the first frame update
void
Start
()
{
//判断是否是夜晚,是则进行切换 默认加载白天
if
((
int
)
GameDataManager
.
GetInstance
().
saveData
.
dayTimeEnum
==
2
)
{
Debug
.
Log
(
GameDataManager
.
GetInstance
().
saveData
.
dayTimeEnum
);
ChangeBox
();
Change_Light
();
}
}
/// <summary>
/// 改变天空盒
/// </summary>
private
void
ChangeBox
()
{
RenderSettings
.
skybox
=
mats
[
index
];
index
++;
index
%=
mats
.
Length
;
}
/// <summary>
/// 根据场景的不同对灯光进行不同的处理
/// </summary>
private
void
Change_Light
()
{
if
(
LoadManager
.
LoadSceneName
==
null
)
return
;
if
(
LoadManager
.
LoadSceneName
.
Equals
(
"05_PlayGroundScene"
))
{
GameObject
sun
=
GameObject
.
Find
(
"Directional Light B"
);
if
(
sun
!=
null
)
sun
.
SetActive
(
false
);
}
}
}
00.Scripts/Environment/Day_Follows_Night.cs.meta
0 → 100644
浏览文件 @
fd320181
fileFormatVersion: 2
guid: e6a564421404bf346a75a69b9e82623a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
00.Scripts/ImpactEffect/IImpactEffect.cs
浏览文件 @
fd320181
...
...
@@ -60,7 +60,6 @@ public class IImpactEffect : MonoBehaviour
case
ImpactType
.
降低体力
:
//暂定:以后是否新写一个消耗类或条件类。加上前置判断。
GameDataManager
.
GetInstance
().
saveData
.
currentAP
-=
impact
.
value
;
UIManager
.
GetInstance
().
tipsInfoPanel
.
AddTipsInfo
(
"你的体力消耗了"
+
impact
.
value
+
"点"
);
break
;
...
...
@@ -88,7 +87,7 @@ public class IImpactEffect : MonoBehaviour
break
;
case
ImpactType
.
完成任务
:
EventManager
.
GetInstance
().
EventTrigger
(
impact
.
quest_SO
.
questNeed
.
NeedToString
());
EventManager
.
GetInstance
().
EventTrigger
(
impact
.
quest_SO
.
NeedToString
());
break
;
case
ImpactType
.
场景跳转到
:
...
...
@@ -100,6 +99,7 @@ public class IImpactEffect : MonoBehaviour
UIManager
.
GetInstance
().
accidentPanel
.
SetAccident_SO
();
break
;
default
:
Debug
.
Log
(
impact
.
value
);
break
;
...
...
00.Scripts/Interact/InteractableObj.cs
浏览文件 @
fd320181
...
...
@@ -16,6 +16,9 @@ public class InteractableObj : MonoBehaviour , IInteraction
protected
void
OnTriggerEnter
(
Collider
other
)
{
//给屎山加点料
if
(
other
.
GetComponent
<
FootStepTrigger
>())
return
;
//PlayerManager player=other.GetComponent<PlayerManager>();
PlayerManager
player
=
other
.
GetComponentInParent
<
PlayerManager
>();
//现在是检测UnitBlockerCollider了
if
(
player
!=
null
)
//检测到玩家进入交互范围
...
...
@@ -26,6 +29,9 @@ public class InteractableObj : MonoBehaviour , IInteraction
protected
void
OnTriggerExit
(
Collider
other
)
{
//给屎山加点料
if
(
other
.
GetComponent
<
FootStepTrigger
>())
return
;
PlayerManager
player
=
other
.
GetComponentInParent
<
PlayerManager
>();
if
(
player
!=
null
)
//检测到玩家离开交互范围
{
...
...
00.Scripts/Interact/NpcInteract.cs
浏览文件 @
fd320181
...
...
@@ -24,22 +24,31 @@ public class NpcInteract : InteractableObj
public
void
Awake
()
{
if
(
npc_SO
==
null
)
{
Destroy
(
gameObject
);
return
;
}
//读取SO。设置Npc实体的各项属性
dialog_SO
=
npc_SO
.
dialog_SO
;
//播放指定动画
anim
=
GetComponentInChildren
<
Animator
>();
if
(
anim
)
anim
.
CrossFade
(
npc_SO
.
PlayAnimName
,
.
2f
);
if
(
pivotTrans
!=
null
)
{
Text
textUI
=
GetComponentInChildren
<
Text
>();
if
(
textUI
!=
null
)
textUI
.
text
=
npc_SO
.
NpcName
;
}
}
private
void
OnEnable
()
{
if
(
anim
)
anim
.
CrossFade
(
npc_SO
.
PlayAnimName
,.
2f
);
}
...
...
@@ -58,10 +67,9 @@ public class NpcInteract : InteractableObj
UIManager
.
GetInstance
().
dialogPanel
.
StartADialog
(
dialog_SO
,
0
);
//事件中心:交互NPC
var
need
=
new
QuestNeed
();
need
.
questNeedType
=
QuestNeedType
.
交互
;
need
.
stringValue
=
npc_SO
.
NpcName
;
EventManager
.
GetInstance
().
EventTrigger
(
need
.
NeedToString
());
//TODO: 比较临时工的行为
EventManager
.
GetInstance
().
EventTrigger
(
"交互_"
+
npc_SO
.
NpcName
);
}
else
{
...
...
00.Scripts/Manager/AudioManager.cs
0 → 100644
浏览文件 @
fd320181
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
AudioManager
:
MonoSingleTon
<
AudioManager
>
{
public
AudioClip
[]
FootStepAudios
;
public
AudioClip
bgm
;
protected
AudioSource
bgmAudioSource
;
private
void
Awake
()
{
bgmAudioSource
=
GetComponent
<
AudioSource
>();
bgmAudioSource
.
clip
=
bgm
;
bgmAudioSource
.
Play
();
}
}
00.Scripts/Manager/AudioManager.cs.meta
0 → 100644
浏览文件 @
fd320181
fileFormatVersion: 2
guid: c13b7e6532a778f42b90fde655fc109e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
00.Scripts/Manager/GameDataManager.cs
浏览文件 @
fd320181
...
...
@@ -6,9 +6,27 @@ public class GameDataManager : MonoSingleTon<GameDataManager>
{
//玩家存档数据。一般是开始游戏后会读取或新建一个默认的。手动拖拽赋值只用于测试。
public
PlayerSaveData_SO
saveData
;
//新存档。开始游戏时用,不过实际上应该时可以选皮肤改名字选初始职业(卷王 土豪 一无所有者)
public
PlayerSaveData_SO
newSaveData
;
public
void
Awake
()
{
QuestManager
.
GetInstance
().
Init
();
}
public
void
TempSetSaveDataToNew
()
{
saveData
.
Strength
=
newSaveData
.
Strength
;
saveData
.
Intelligence
=
newSaveData
.
Intelligence
;
saveData
.
Communication
=
newSaveData
.
Communication
;
saveData
.
money
=
newSaveData
.
money
;
saveData
.
mood
=
newSaveData
.
mood
;
saveData
.
GradeNum
=
1
;
saveData
.
dayTimeEnum
=
0
;
saveData
.
currentQuest
.
Clear
();
saveData
.
finishedQuest
.
Clear
();
}
}
00.Scripts/Manager/LoadManager.cs
浏览文件 @
fd320181
...
...
@@ -5,7 +5,7 @@ using UnityEngine.SceneManagement;
public
class
LoadManager
:
MonoSingleTon
<
LoadManager
>
{
public
string
LoadSceneName
;
public
st
atic
st
ring
LoadSceneName
;
protected
AsyncOperation
operation
;
...
...
@@ -20,12 +20,11 @@ public class LoadManager : MonoSingleTon<LoadManager>
LoadSceneName
=
sceneName
;
UIManager
.
GetInstance
().
tryCloseCurrentUIObj
();
StartCoroutine
(
LoadLevel
());
}
IEnumerator
LoadLevel
()
{
UIManager
.
GetInstance
().
loadPanel
.
gameObject
.
SetActive
(
true
);
UIManager
.
GetInstance
().
loadPanel
.
RunEnable
(
);
yield
return
new
WaitForSeconds
(
1
);
...
...
@@ -34,7 +33,7 @@ public class LoadManager : MonoSingleTon<LoadManager>
while
(!
operation
.
isDone
)
{
UIManager
.
GetInstance
().
loadPanel
.
loadProgressText
.
text
=
operation
.
progress
.
ToString
();
UIManager
.
GetInstance
().
loadPanel
.
slider
.
value
=
operation
.
progress
;
if
(
operation
.
progress
>=
0.9f
)
{
...
...
@@ -50,4 +49,5 @@ public class LoadManager : MonoSingleTon<LoadManager>
}
#
endregion
}
00.Scripts/Manager/NpcGenerateManager.cs
浏览文件 @
fd320181
...
...
@@ -5,7 +5,7 @@ using UnityEngine;
//不用放进场景
public
class
NpcGenerateManager
:
MonoSingleTon
<
NpcGenerateManager
>
{
private
float
generateRate
=
0.
4
f
;
//每个npc随机生成的概率(也可以理解为可随机npc池子里,最终会刷出的npc的占比)
private
float
generateRate
=
0.
6
f
;
//每个npc随机生成的概率(也可以理解为可随机npc池子里,最终会刷出的npc的占比)
//包含场景内所有Npc
[
SerializeField
]
private
List
<
NpcInteract
>
npcList
=
new
List
<
NpcInteract
>();
...
...
@@ -50,12 +50,13 @@ public class NpcGenerateManager : MonoSingleTon<NpcGenerateManager>
//筛选出满足条件的Npc
foreach
(
var
item
in
npcList
)
{
if
(
item
.
Npc_SO
==
null
)
continue
;
item
.
gameObject
.
SetActive
(
false
);
if
(
item
.
Npc_SO
.
requirement
.
getRequireBool
())
{
if
(
item
.
Npc_SO
.
requirement
==
null
||
item
.
Npc_SO
.
requirement
.
getRequireBool
())
npcCanGenList
.
Add
(
item
);
}
}
//选取出将要生成的Npc
bool
tempB
=
true
;
...
...
00.Scripts/Manager/QuestManager.cs
浏览文件 @
fd320181
...
...
@@ -11,6 +11,7 @@ public class QuestManager : MonoSingleTon<QuestManager>
//初始化进行中任务的监听
foreach
(
var
item
in
GameDataManager
.
GetInstance
().
saveData
.
currentQuest
)
{
QuestRemoveListener
(
item
);
QuestAddListener
(
item
);
}
}
...
...
@@ -37,15 +38,15 @@ public class QuestManager : MonoSingleTon<QuestManager>
protected
void
QuestAddListener
(
Quest_SO
quest_SO
)
{
//增加监听。当听到达成某条件时,将对应任务"完成"。
EventManager
.
GetInstance
().
AddEventListener
(
quest_SO
.
questNeed
.
NeedToString
(),
quest_SO
.
QuestFinish
);
Debug
.
Log
(
"添加事件监听:"
+
quest_SO
.
questNeed
.
NeedToString
());
EventManager
.
GetInstance
().
AddEventListener
(
quest_SO
.
NeedToString
(),
quest_SO
.
QuestFinish
);
Debug
.
Log
(
"添加事件监听:"
+
quest_SO
.
NeedToString
());
}
//为某任务移除监听
public
void
QuestRemoveListener
(
Quest_SO
quest_SO
)
{
EventManager
.
GetInstance
().
RemoveEventListener
(
quest_SO
.
questNeed
.
NeedToString
(),
quest_SO
.
QuestFinish
);
Debug
.
Log
(
"移除事件监听:"
+
quest_SO
.
questNeed
.
NeedToString
());
EventManager
.
GetInstance
().
RemoveEventListener
(
quest_SO
.
NeedToString
(),
quest_SO
.
QuestFinish
);
Debug
.
Log
(
"移除事件监听:"
+
quest_SO
.
NeedToString
());
}
/// <summary>
...
...
00.Scripts/ScriptableObject/Dialog_SO.cs
浏览文件 @
fd320181
...
...
@@ -47,6 +47,8 @@ public class SingleDialogSelection : IInteraction
//重要!
public
void
DoInteract
(
PlayerManager
playerManager
)
{
//交给那边的方法去判断处理
UIManager
.
GetInstance
().
dialogPanel
.
HandleNextDialog
(
nextDialogIndexes
);
//实现效果
foreach
(
var
item
in
impacts
)
{
...
...
@@ -61,8 +63,7 @@ public class SingleDialogSelection : IInteraction
{
UIManager.GetInstance().dialogPanel.EndDialog();
}*/
//交给那边的方法去判断处理
UIManager
.
GetInstance
().
dialogPanel
.
HandleNextDialog
(
nextDialogIndexes
);
}
...
...
00.Scripts/ScriptableObject/PlayerSaveData_SO.cs
浏览文件 @
fd320181
...
...
@@ -31,6 +31,9 @@ public class PlayerSaveData_SO : ScriptableObject
public
List
<
Quest_SO
>
currentQuest
;
//进行中任务
public
List
<
Quest_SO
>
finishedQuest
;
//已完成任务
[
Header
(
"修改器设置"
)]
public
bool
isUnlimitJump
=
true
;
//是否能无限跳
public
bool
isFastRun
=
false
;
//是否超级速度
}
public
enum
DayTimeEnum
{
早晨
,
中午
,
晚上
};
00.Scripts/ScriptableObject/Quest_SO.cs
浏览文件 @
fd320181
...
...
@@ -13,7 +13,7 @@ public enum QuestFinishType {
public
enum
QuestNeedType
{
交互
交互
,
只能
ImpactEffect
}
[
System
.
Serializable
]
...
...
@@ -28,10 +28,19 @@ public class QuestNeed
[
Tooltip
(
"对应的int值(没有就不填)"
)]
public
int
intValue
=
1
;
public
string
NeedToString
()
{
return
questNeedType
+
"_"
+
stringValue
;
}
//public string NeedToString()
//{
// switch (questNeedType)
// {
// case QuestNeedType.交互:
// return questNeedType + "_" + stringValue;
// case QuestNeedType.只能ImpactEffect:
// return questNeedType + "_" + ;
// break;
// default:
// break;
// }
//}
}
#endregion
...
...
@@ -50,6 +59,8 @@ public class Quest_SO : ScriptableObject
[
TextArea
]
public
string
QuestNeedDescription
;
//任务达成条件描述(偏正式)
[
Tooltip
(
"是否只能领取一次"
)]
public
bool
onlyOnce
=
false
;
[
Tooltip
(
"完成后直接移除"
)]
public
bool
deleteFinish
=
false
;
[
Tooltip
(
"达成条件"
)]
public
QuestNeed
questNeed
;
...
...
@@ -58,6 +69,18 @@ public class Quest_SO : ScriptableObject
public
ImpactValue
[]
QuestReward
;
//任务报酬
public
string
NeedToString
()
{
switch
(
questNeed
.
questNeedType
)
{
case
QuestNeedType
.
交互
:
return
questNeed
.
questNeedType
+
"_"
+
questNeed
.
stringValue
;
}
return
questNeed
+
"_"
+
QuestName
+
"_"
+
name
;
}
//任务完成时的效果
public
void
QuestFinish
()
{
...
...
@@ -66,7 +89,7 @@ public class Quest_SO : ScriptableObject
QuestManager
.
GetInstance
().
QuestRemoveListener
(
this
);
//列表添加删除
GameDataManager
.
GetInstance
().
saveData
.
currentQuest
.
Remove
(
this
);
GameDataManager
.
GetInstance
().
saveData
.
finishedQuest
.
Add
(
this
);
if
(!
deleteFinish
)
GameDataManager
.
GetInstance
().
saveData
.
finishedQuest
.
Add
(
this
);
//提示
UIManager
.
GetInstance
().
tipsInfoPanel
.
AddTipsInfo
(
"【"
+
QuestName
+
"】已完成!"
);
//实现效果
...
...
@@ -76,6 +99,7 @@ public class Quest_SO : ScriptableObject
}
}
//任务给予者
//完成条件
}
...
...
00.Scripts/UI/DialogPanel.cs
浏览文件 @
fd320181
...
...
@@ -7,6 +7,7 @@ public class DialogPanel : MonoBehaviour
{
protected
Text
dialogTextUI
;
protected
Dialog_SO
currentDialogSO
;
string
allText
;
// 给屎山代码加点料,因为需要鼠标点击的时候全部输出需要的变量
private
void
Awake
()
{
...
...
@@ -68,6 +69,28 @@ public class DialogPanel : MonoBehaviour
protected
void
SetDialogText
(
string
text
)
{
dialogTextUI
.
text
=
text
;
allText
=
text
;
StopAllCoroutines
();
StartCoroutine
(
TypeText
(
text
,
0.05f
));
}
// 协程逐字打印文本的效果,用协程产生延时的效果
IEnumerator
TypeText
(
string
str
,
float
interval
)
{
int
i
=
0
;
while
(
i
<=
str
.
Length
)
{
dialogTextUI
.
text
=
str
.
Substring
(
0
,
i
++);
yield
return
new
WaitForSeconds
(
interval
);
}
}
private
void
Update
()
{
if
(
Input
.
GetMouseButtonDown
(
0
))
{
StopAllCoroutines
();
dialogTextUI
.
text
=
allText
;
}
}
}
00.Scripts/UI/LoadPanel.cs
浏览文件 @
fd320181
...
...
@@ -9,7 +9,10 @@ using UnityEngine.UI;
public
class
LoadPanel
:
MonoBehaviour
{
//加载文字。目前对这玩意儿的改动都暂时在GameDataManager里。
[
HideInInspector
]
public
Text
loadProgressText
;
public
Text
loadProgressText
;
public
Slider
slider
;
//加载的进度条
public
Image
sliderImage
;
// 进度条上的图片,为了实现进度条的滚动
[
Tooltip
(
"显示的百分比"
)]
public
Text
text
;
//显示的百分比
protected
Image
backGroundImg
;
public
Sprite
[]
imgArrays
;
...
...
@@ -21,38 +24,92 @@ public class LoadPanel : MonoBehaviour
backGroundImg
=
GetComponentInChildren
<
Image
>();
}
private
void
OnEnable
()
//临时用,不管了
public
void
RunEnable
()
{
StartCoroutine
(
ChangeBackgroundImg
());
//持续切换背景图片
gameObject
.
SetActive
(
true
);
//StartCoroutine(ChangeBackgroundImg());//持续切换背景图片
ChangeBackgroundImg
();
StartCoroutine
(
RunSlider
());
}
IEnumerator
ChangeBackgroundImg
()
{
while
(
gameObject
.
activeInHierarchy
)
private
void
OnEnable
()
{
SetBackgroundImg
();
yield
return
new
WaitForSeconds
(
4
);
}
//全放到上面的RunEnable里了
}
pr
otected
void
SetBackgroundImg
()
pr
ivate
void
OnDisable
()
{
Sprite
nextImg
=
null
;
if
(
backGroundImg
==
null
)
return
;
if
(
imgArrays
.
Length
==
1
)
StopAllCoroutines
();
}
// 两个update都试了一下,滚动的校徽看起来都挺卡的,聊胜于无吧
/*private void FixedUpdate()
{
nextImg
=
imgArrays
[
0
]
;
sliderImage.transform.localEulerAngles = new Vector3(0, 0, sliderImage.transform.rotation.z + 100f)
;
}
else
private void Update()
{
while
(
nextImg
!=
backGroundImg
.
sprite
)
sliderImage.transform.localEulerAngles = new Vector3(0, 0, sliderImage.transform.rotation.z + 100f);
}*/
/// <summary>
/// 协程实现进度条上的图片的滚动
/// </summary>
IEnumerator
RunSlider
()
{
int
i
=
0
;
while
(
i
<
250
)
{
nextImg
=
imgArrays
[
Random
.
Range
(
0
,
imgArrays
.
Length
)];
sliderImage
.
transform
.
localEulerAngles
=
new
Vector3
(
0
,
0
,
sliderImage
.
transform
.
rotation
.
z
+
100f
);
yield
return
new
WaitForSeconds
(
0.04f
);
}
StopAllCoroutines
();
}
backGroundImg
.
sprite
=
nextImg
;
/// <summary>
/// 实现随机选择一张图片进行加载
/// </summary>
private
void
ChangeBackgroundImg
()
{
backGroundImg
.
sprite
=
imgArrays
[
Random
.
Range
(
0
,
imgArrays
.
Length
)];
}
//IEnumerator ChangeBackgroundImg()
//{
// while(gameObject.activeInHierarchy)
// {
// SetBackgroundImg();
// yield return new WaitForSeconds(4);
// }
//}
protected
void
SetBackgroundImg
()
{
//Sprite nextImg = null;
//if (backGroundImg == null) return;
//if (imgArrays.Length == 1)
//{
// nextImg = imgArrays[0];
//}
//else
//{
// //TODO:沈建伟来写一下开始时随机选一张图
//这边while代码最好不要了,会有死循环
// //while (nextImg != backGroundImg.sprite)
// //{
// // //
// // //nextImg = imgArrays[Random.Range(0, imgArrays.Length)];
// //}
//}
//backGroundImg.sprite = nextImg;
}
}
00.Scripts/UI/MainMenu.cs
浏览文件 @
fd320181
...
...
@@ -47,9 +47,10 @@ public class MainMenu : MonoBehaviour
/// <param name="obj"></param>
void
NewGame
(
PlayableDirector
obj
)
{
//设置SO
GameDataManager
.
GetInstance
().
TempSetSaveDataToNew
();
// 转换场景
LoadManager
.
GetInstance
().
LoadSceneByName
(
"03_dormitory02"
);
//LoadManager.GetInstance().LoadSceneByName("03_dormitory02");
Debug
.
Log
(
"开始新游戏"
);
...
...
@@ -57,8 +58,9 @@ public class MainMenu : MonoBehaviour
void
ContinueGame
()
{
Debug
.
Log
(
"读取存档"
);
//转换场景,读取进度
LoadManager
.
GetInstance
().
LoadSceneByName
(
"03_dormitory02"
);
Debug
.
Log
(
"读取存档"
);
}
void
SettingsGame
()
...
...
00.Scripts/UI/Panel.cs
0 → 100644
浏览文件 @
fd320181
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
Panel
:
MonoBehaviour
{
public
Image
panelImage
;
public
AnimationCurve
showCurve
;
public
AnimationCurve
hideCurve
;
public
float
animationSpeed
=
2
;
public
float
transparency
=
0.5f
;
// 使用协程来进行面板的渐入渐出效果
IEnumerator
ShowPanel
()
{
float
timer
=
0
;
while
(
panelImage
.
color
.
a
<
1
)
{
panelImage
.
color
=
new
Vector4
(
1
,
1
,
1
,
showCurve
.
Evaluate
(
timer
));
timer
+=
Time
.
deltaTime
*
animationSpeed
;
yield
return
null
;
}
}
IEnumerator
HidePanel
()
{
float
timer
=
0
;
while
(
panelImage
.
color
.
a
>
0
)
{
panelImage
.
color
=
new
Vector4
(
1
,
1
,
1
,
hideCurve
.
Evaluate
(
timer
));
timer
+=
Time
.
deltaTime
*
animationSpeed
;
yield
return
null
;
}
}
// 打开面板,渐入效果
public
void
OpenPanel
()
{
StopAllCoroutines
();
StartCoroutine
(
ShowPanel
());
}
// 关闭面板,渐出效果
public
void
ClosePanel
()
{
StopAllCoroutines
();
StartCoroutine
(
HidePanel
());
}
// 这是测试,要删掉,左键打开,右键关闭
public
void
Update
()
{
if
(
Input
.
GetMouseButtonDown
(
0
))
{
StopAllCoroutines
();
StartCoroutine
(
ShowPanel
());
}
if
(
Input
.
GetMouseButtonDown
(
1
))
{
StopAllCoroutines
();
StartCoroutine
(
HidePanel
());
}
}
}
00.Scripts/UI/Panel.cs.meta
0 → 100644
浏览文件 @
fd320181
fileFormatVersion: 2
guid: f28d31d667701cd4ba784ce6cf9a312a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
00.Scripts/UI/Phone/App_Modifier.cs
0 → 100644
浏览文件 @
fd320181
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
App_Modifier
:
MonoBehaviour
{
public
Text
playerInfoText
;
//目前暂时使用手动拖拽赋值
//激活时自动调用
private
void
OnEnable
()
{
SetInfoText
();
}
public
void
SwitchUnlimitJump
()
{
var
saveData
=
GameDataManager
.
GetInstance
().
saveData
;
saveData
.
isUnlimitJump
=
!
saveData
.
isUnlimitJump
;
SetInfoText
();
}
public
void
SwitchFastRun
()
{
var
saveData
=
GameDataManager
.
GetInstance
().
saveData
;
saveData
.
isFastRun
=
!
saveData
.
isFastRun
;
SetInfoText
();
}
protected
void
SetInfoText
()
{
//读取目前玩家游戏数据
var
saveData
=
GameDataManager
.
GetInstance
().
saveData
;
string
s
=
""
;
//设置字符串
s
+=
"无限跳:"
+
BoolToRichText
(
saveData
.
isUnlimitJump
)
+
"\n"
;
s
+=
"兔符咒:"
+
BoolToRichText
(
saveData
.
isFastRun
)
+
"\n"
;
playerInfoText
.
text
=
s
;
}
protected
string
BoolToRichText
(
bool
value
)
{
return
value
?
"<color=yellow> 启用 </color>"
:
"<color=red> 关闭 </color>"
;
}
}
00.Scripts/UI/Phone/App_Modifier.cs.meta
0 → 100644
浏览文件 @
fd320181
fileFormatVersion: 2
guid: 84ffaa8a55751fc41bcf13e08c439c03
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
00.Scripts/UI/Phone/App_PlayerInfo.cs
浏览文件 @
fd320181
...
...
@@ -24,6 +24,11 @@ public class App_PlayerInfo : MonoBehaviour
s
+=
"气力:"
+
saveData
.
Strength
+
"\n"
;
s
+=
"学识:"
+
saveData
.
Intelligence
+
"\n"
;
s
+=
"社交:"
+
saveData
.
Communication
+
"\n"
;
s
+=
"\n"
;
s
+=
"金钱: "
+
saveData
.
money
+
"\n"
;
s
+=
"心情: "
+
saveData
.
money
+
"\n"
;
s
+=
"年级: "
+
saveData
.
GradeNum
+
"\n"
;
s
+=
"时间段: "
+
saveData
.
dayTimeEnum
.
ToString
()
+
"\n"
;
playerInfoText
.
text
=
s
;
}
...
...
00.Scripts/UI/Phone/PhonePanel.cs
浏览文件 @
fd320181
...
...
@@ -37,6 +37,8 @@ public class PhonePanel : MonoBehaviour
/// <param name="add"></param>
public
void
PointApp
(
int
add
)
{
if
(
gameObject
.
activeSelf
==
false
)
return
;
currentAppIndex
+=
add
;
currentAppIndex
=
(
currentAppIndex
+
appList
.
Count
)
%
appList
.
Count
;
//循环
...
...
《福大模拟器》——用户调查报告.docx
0 → 100644
浏览文件 @
fd320181
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录