任务:编写留言系统、死亡记录系统、替换和实装美术素材

1.编写死亡记录系统
(1.当触发玩家死亡事件,传送一条记录前往服务器
(2.当触发玩家死亡事件,拉取云端死亡列表,挑选10条显示在场景
*.制作死亡玩家预制体

3.制作玩家UI

4.制作boss血条

*.替换和实装美术素材,增加部分动画

*优化和修复
1.调整了留言板的建立偏移,修复了留言板浮空的问题
2.修复了建板系统的操控性问题
3.解决了落在留言板上会导致动画异常的问题

建议:
1.给击中添加一些效果,目前还是打击感太弱
2.目前木马死后,灰尘不会消失

*.至此,死亡标记系统基本完成

下班
This commit is contained in:
Roman 2021-12-25 18:27:29 +08:00
parent ca1cc0162d
commit 9f3ffbb94c
17 changed files with 1336 additions and 38 deletions

View File

@ -24,7 +24,7 @@ public class @Player : IInputActionCollection, IDisposable
""id"": ""4e75a7bf-f61d-4467-b879-29135d8cd3d0"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
""interactions"": ""Press(behavior=2)""
},
{
""name"": ""Jump"",
@ -56,7 +56,7 @@ public class @Player : IInputActionCollection, IDisposable
""id"": ""7cf0a787-dc2d-42b1-9ed9-c840ccfa3ce9"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": ""Hold(duration=2,pressPoint=0.5),Press(behavior=2)""
""interactions"": ""Hold""
}
],
""bindings"": [

View File

@ -11,7 +11,7 @@
"id": "4e75a7bf-f61d-4467-b879-29135d8cd3d0",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
"interactions": "Press(behavior=2)"
},
{
"name": "Jump",
@ -43,7 +43,7 @@
"id": "7cf0a787-dc2d-42b1-9ed9-c840ccfa3ce9",
"expectedControlType": "Button",
"processors": "",
"interactions": "Hold(duration=2,pressPoint=0.5),Press(behavior=2)"
"interactions": "Hold"
}
],
"bindings": [

View File

@ -24,6 +24,6 @@ MonoBehaviour:
m_DefaultButtonPressPoint: 0.5
m_DefaultTapTime: 0.2
m_DefaultSlowTapTime: 0.5
m_DefaultHoldTime: 0.4
m_DefaultHoldTime: 2
m_TapRadius: 5
m_MultiTapDelayTime: 0.75

View File

@ -232,6 +232,7 @@ public class PlayerInfo : MonoBehaviour
Destroy(gameObject);
DontDestroyOnLoad(gameObject);
BoardInfos = new List<BoardInfo>();
DeadInfos = new List<DeadInfo>();
//
LinkInfo = "server="+dataScriptableObject.IP+";" +
"port="+dataScriptableObject.Port+";" +

View File

@ -310,7 +310,7 @@ BoxCollider2D:
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_Size: {x: 0.59, y: 0.93}
m_EdgeRadius: 0
--- !u!95 &674563372791047601
Animator:

View File

@ -0,0 +1,84 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3396943634017253128
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9117904385277670331}
- component: {fileID: 4696060030220556717}
m_Layer: 0
m_Name: "\u6B7B\u4EA1\u73A9\u5BB6"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9117904385277670331
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3396943634017253128}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -13.817685, y: -0.740498, z: -0.65380067}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &4696060030220556717
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3396943634017253128}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: bcb018ee6b241104bb739e08529e965b, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.368, y: 2.016}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bc20d04da26ff184885ecb4437cb0739
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -75,7 +75,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -698741025
m_SortingLayer: 1
m_SortingLayer: 5
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 4b64b4c73bfa00a4a9552c672359f9fc, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
@ -112,7 +112,7 @@ BoxCollider2D:
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.768, y: 0.74}
m_Size: {x: 0.44, y: 0.74}
m_EdgeRadius: 0
--- !u!61 &7746389308535175435
BoxCollider2D:
@ -306,6 +306,8 @@ MonoBehaviour:
hitToflyParameter: {x: 3, y: 3}
deadRotationRangeMax: 500
deadRotationRangeMin: 500
needWalk: 0
isInFoStage: 0
inPath: 1
catchOffset: {x: -0.1, y: 0.4, z: 0}
breakFreeCount: 5

View File

@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 8058067845890521741}
m_Layer: 0
m_Name: "\u7559\u8A00\u677F"
m_TagString: Untagged
m_TagString: "\u5730\u9762"
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -3471,6 +3471,22 @@ MonoBehaviour:
m_Calls: []
m_ActionId: 268f2409-b46a-4eed-abf4-ff0db96e8d46
m_ActionName: NullMap/New action
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 979777884}
m_TargetAssemblyTypeName: MyPlayer, Assembly-CSharp
m_MethodName: OnInteractive
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: 2a6b3f1f-3ff5-4838-bb2c-e876543f27c5
m_ActionName: Normal/Interactive1[/Keyboard/f]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme: Play
m_DefaultActionMap: Normal

View File

@ -18,15 +18,23 @@ public class CreatABoard : MonoBehaviour
private PlayerInfo sql;
public InputField inputField;
void Start(){
void Awake(){
Init();
}
void Start(){
}
void Update(){
if(CheckComfirm()){
StartCoroutine(CreatALocalBoard());
}
}
public void Creat(){
//player.GetComponent<PlayerInput>().SwitchCurrentActionMap("NullMap");
//Time.timeScale = 0;
}
void Init(){
//找到必要的物体和组件
@ -35,9 +43,8 @@ public class CreatABoard : MonoBehaviour
}
private IEnumerator CreatALocalBoard(){
Debug.Log("执行了新建");
//新建一个板子
Board temp = Instantiate(board,player.transform.position + new Vector3(0,0.4f,0),Quaternion.identity).GetComponent<Board>();
Board temp = Instantiate(board,player.transform.position + new Vector3(0,0.3f,0),Quaternion.identity).GetComponent<Board>();
yield return new WaitForEndOfFrame();
//初始化板子
temp.uid = sql.uid;
@ -47,7 +54,9 @@ public class CreatABoard : MonoBehaviour
gameObject.SetActive(false);
inputField.text = null;
//恢复玩家操作地图
player.GetComponent<PlayerInput>().SwitchCurrentActionMap("Normal");
//player.GetComponent<PlayerInput>().SwitchCurrentActionMap("Normal");
player.inControl = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
//将板子信息传向云端
sql.CreateBoard(SceneManager.GetActiveScene().buildIndex,temp.postion,temp.text);
}

View File

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using DG.Tweening;
/// <summary>
/// 获取死亡列表的时候用这个
/// </summary>
public class GetDateBaseDead : MonoBehaviour
{
public GameObject deadPlayer;
public List<DeadInfo> deadInfos;
public void Get(){
//将所有死亡信息拉到本地
deadInfos = GetComponent<PlayerInfo>().GetDeadInfo(SceneManager.GetActiveScene().buildIndex);
//筛选出10条
while(deadInfos.Count > 10){
deadInfos.RemoveAt(Random.Range(0,deadInfos.Count));
}
}
public void Show(){
//初始化所有死亡玩家
foreach(DeadInfo info in deadInfos){
//创建一个死亡玩家
GameObject temp = Instantiate(deadPlayer,info.postion,Quaternion.identity);
//根据信息初始化这个玩家
temp.transform.position = info.postion;
//淡入显示死亡玩家
temp.GetComponent<SpriteRenderer>().DOFade(
0.6f,
0.5f
);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 001bc6c6fd9d2324b8eb091df8a616d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,6 +13,7 @@ public class FoOpeningStage : Stage
private NormalEnemy left;
private NormalEnemy right;
private bool isConversationComplete = false;
private PlayerInfo sql;
protected override void Init(){
//找到必要的游戏物体和组件
@ -21,6 +22,7 @@ public class FoOpeningStage : Stage
m_Camera = FindObjectOfType<CinemachineVirtualCamera>();
left = GameObject.Find("普通小怪(左").GetComponent<NormalEnemy>();
right = GameObject.Find("普通小怪(右").GetComponent<NormalEnemy>();
sql = FindObjectOfType<PlayerInfo>();
}
protected override IEnumerator Main(){
@ -28,6 +30,10 @@ public class FoOpeningStage : Stage
player.transform.position = new Vector3(
-22.0799999f,-1.89999998f,0
);
//拉取留言板
sql.GetComponent<GetDateBaseBoard>().Get();
//拉取死亡列表
sql.GetComponent<GetDateBaseDead>().Get();
//关闭空气墙
airWall.SetActive(false);
//修改玩家inputDir使玩家从屏幕外冲进到屏幕内部

View File

@ -110,7 +110,7 @@ public class MyPlayer : MonoBehaviour, Boomer.I_CanBeBoomedObj
private Transform sickleClearerL;//左边的镰刀清除触发器
private Transform sickleClearerR;//右边的镰刀清除触发器
[FoldoutGroup("状态",false,1)][Header("玩家现在是否处于控制状态下(物理)")][SerializeField][ReadOnly]
private bool inControl = true;
public bool inControl = true;
[SerializeField][ReadOnly][ProgressBar(0,10,0.15f,0.47f,0.74f)][FoldoutGroup("状态")]
private float HPLeft;
/// <summary>
@ -143,8 +143,9 @@ public class MyPlayer : MonoBehaviour, Boomer.I_CanBeBoomedObj
/// </summary>
[Header("此时自己是否正在与物体交互")][ReadOnly][SerializeField][FoldoutGroup("状态")]
private bool isInteractive = false;
public bool isDead;
private PlayerInfo sql;
private
@ -196,6 +197,7 @@ public class MyPlayer : MonoBehaviour, Boomer.I_CanBeBoomedObj
m_Animator = GetComponent<Animator>();
vibrationManager = FindObjectOfType<VibrationManager>();
counterScout = gameObject.AddComponent<CounterScout>();
sql = FindObjectOfType<PlayerInfo>();
//初始化生命值
HPLeft = HP;
//初始化攻击倍率字典
@ -445,9 +447,8 @@ public class MyPlayer : MonoBehaviour, Boomer.I_CanBeBoomedObj
}
public void OnInteractive(InputAction.CallbackContext context){
Debug.Log("触发交互监听");
//当按下交互键
if(context.performed && catching != null){
if(context.started && catching != null){
//根据所捕获物体的不同,区分一下操作
switch(catching.itemName){
case Interactive.ItemName. :
@ -483,11 +484,12 @@ public class MyPlayer : MonoBehaviour, Boomer.I_CanBeBoomedObj
catching.OnCallCancel();
isInteractive = false;
}
//当抬起交互键,且长按了两秒
//当长按了两秒
if(context.performed && context.duration > 2f && inControl && !isInteractive && catching == null){
Debug.Log("创建一个留言板");
creatBoardUI.SetActive(true);
//GetComponent<PlayerInput>().SwitchCurrentActionMap("NullMap");
creatBoardUI.GetComponent<CreatABoard>().Creat();
inControl = false;
m_rigidbody.constraints = RigidbodyConstraints2D.FreezeAll;
}
}
@ -637,10 +639,19 @@ public class MyPlayer : MonoBehaviour, Boomer.I_CanBeBoomedObj
GetComponent<PlayerInput>().SwitchCurrentActionMap("NullMap");
//播放死亡动画
isDead = true;
//显示死亡列表并将他们显示在地图上
sql.GetComponent<GetDateBaseDead>().Show();
//记录死亡位置
Vector3 deadPos = transform.position;
//等待一段时间
yield return new WaitForSeconds(3f);
//使用转场块
FindObjectOfType<Transfer>().transType = Blcak.Type.;
FindObjectOfType<Transfer>().OnCall();
//等待一段时间
yield return new WaitForSeconds(0.8f);
//传输死亡记录
sql.CreateDead(SceneManager.GetActiveScene().buildIndex,deadPos);
//重新加载本场景(在转场块执行)
//SceneManager.LoadScene(SceneManager.GetActiveScene().name);
//停止木马

View File

@ -15,25 +15,25 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c7b192c16162d1f3c2737281d1820f6ae2136ebf32f
flags: 0
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c791f580216233831
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c6619580216233831
flags: 0
RecentlyUsedScenePath-5:
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c7519580216233831
flags: 0
RecentlyUsedScenePath-6:
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c661925162b3e2d2f2304283a097df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-7:
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c6b153a021713251b32312a2c2936f1f47a2decee22f0
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c7000131911242b66333e243d04
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c5c0518590d24253c3f
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7000131911242b66333e243d04
value: 22424703114646680e0b0227036c791f580216233831
flags: 0
UnityEditor.ShaderGraph.Blackboard:
value: 18135939215a0a5004000b0e15254b524c030a3f2964643d120d1230e9e93a3fd6e826abbd2e2d293c4ead313b08042de6030a0afa240c0d020be94c4ba75e435d8715fa32c70d15d11612dacc11fee5d3c5d1fe9ab1bf968e93e2ffcbc3e7e2f0b3ffe0e8b0be9af8ffaeffff8e85dd8390e3949c8899daa7