religion/Assets/Scripts/抽象/CreatABoard.cs
Roman 9f3ffbb94c 任务:编写留言系统、死亡记录系统、替换和实装美术素材
1.编写死亡记录系统
(1.当触发玩家死亡事件,传送一条记录前往服务器
(2.当触发玩家死亡事件,拉取云端死亡列表,挑选10条显示在场景
*.制作死亡玩家预制体

3.制作玩家UI

4.制作boss血条

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

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

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

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

下班
2021-12-25 18:27:29 +08:00

71 lines
2.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
/// <summary>
/// 创建一个留言板的时候由UI调用
/// </summary>
public class CreatABoard : MonoBehaviour
{
/// <summary>
/// 游戏内板子的预制体
/// </summary>
public GameObject board;
private MyPlayer player;
private PlayerInfo sql;
public InputField inputField;
void Awake(){
Init();
}
void Start(){
}
void Update(){
if(CheckComfirm()){
StartCoroutine(CreatALocalBoard());
}
}
public void Creat(){
//player.GetComponent<PlayerInput>().SwitchCurrentActionMap("NullMap");
//Time.timeScale = 0;
}
void Init(){
//找到必要的物体和组件
player = FindObjectOfType<MyPlayer>();
sql = FindObjectOfType<PlayerInfo>();
}
private IEnumerator CreatALocalBoard(){
//新建一个板子
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;
temp.text = inputField.text;
temp.postion = temp.transform.position;
//关闭UI
gameObject.SetActive(false);
inputField.text = null;
//恢复玩家操作地图
//player.GetComponent<PlayerInput>().SwitchCurrentActionMap("Normal");
player.inControl = true;
player.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
//将板子信息传向云端
sql.CreateBoard(SceneManager.GetActiveScene().buildIndex,temp.postion,temp.text);
}
private bool CheckComfirm(){
//如果按下此帧按下此二键中的一个
return (Gamepad.current!= null &&
Gamepad.current.buttonSouth.wasPressedThisFrame) ||
Input.GetKeyDown(KeyCode.Return);
}
}