Accept Merge Request #9: (RomanVersion -> master)
Merge Request: 给👴合 Created By: @Roman Accepted By: @Roman URL: https://gensokyogroup.coding.net/p/RedGame/d/Warcorrespondents/git/merge/9
This commit is contained in:
commit
6caebb96f2
@ -1,5 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
<<<<<<< HEAD
|
||||
guid: 1077cbc74ab0dc44eb42f9a1f2b90a2a
|
||||
=======
|
||||
guid: 5b0ac5f58f6660143aa0c32c9a8b5cd6
|
||||
>>>>>>> a793f4050f8fdc97ae8cf50a86f7455459abab35
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
2024
Assets/Scenes/序章-回忆.unity
Normal file
2024
Assets/Scenes/序章-回忆.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/序章-回忆.unity.meta
Normal file
7
Assets/Scenes/序章-回忆.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60aa172413259f44a9e890e438ff7769
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
Assets/Scripts/AllLinesInfo.cs
Normal file
20
Assets/Scripts/AllLinesInfo.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AllLinesInfo : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
public int needCount;
|
||||
public int OKCount = 0;
|
||||
void Start()
|
||||
{
|
||||
needCount = transform.childCount;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/AllLinesInfo.cs.meta
Normal file
11
Assets/Scripts/AllLinesInfo.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfd0089d5e6e3ce48bc97545a484b539
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -12,6 +12,7 @@ public class IndexRecoder : MonoBehaviour
|
||||
|
||||
public float dotRoLineTime;//判定输入为点还是横线的界限时间
|
||||
public Dictionary<string, string> codeBook = new Dictionary<string, string>();
|
||||
public float TelephoneNeedTime;
|
||||
void Start()
|
||||
{
|
||||
GameObject.DontDestroyOnLoad(gameObject);
|
||||
|
@ -6,19 +6,10 @@ using UnityEngine.UI;
|
||||
public class Interactive : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
public GameObject m_interface;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
//这是所有可交互物体的基类
|
||||
public GameObject m_interface;//可交互物体一般都和一个UI界面挂钩,这就是那个UI界面
|
||||
|
||||
//这是一对碰撞检测代码。当玩家进入,将自身传给玩家。当玩家退出,把玩家的catch清空
|
||||
void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if(other.tag == "Player")
|
||||
@ -26,7 +17,6 @@ public class Interactive : MonoBehaviour
|
||||
other.GetComponent<M_Player>().catched = this;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if(other.tag == "Player")
|
||||
@ -34,11 +24,14 @@ public class Interactive : MonoBehaviour
|
||||
other.GetComponent<M_Player>().catched = null;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
public void ShowInfo()
|
||||
{
|
||||
m_interface.SetActive(true);
|
||||
}
|
||||
//当这个可交互物体被玩家交互。一般需要重写这个函数。
|
||||
public virtual void OnCall(){}
|
||||
//
|
||||
|
||||
//以下为针对各具体可交互对象的虚拟函数,在具体物体中重写
|
||||
public virtual void Coding(string temp){}
|
||||
public virtual void StopRepareTheTelephoneLine(){}
|
||||
//
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using UnityEngine.UI;
|
||||
|
||||
public class M_Player : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
//玩家类,主要用来控制玩家
|
||||
private IndexRecoder indexRecoder;//记录组件,内存方便修改的参数
|
||||
private Vector2 velocity;//逻辑速度,通过计算获得,最后加在理论速度上
|
||||
private Rigidbody2D m_rigidbody;//自身刚体组件
|
||||
@ -15,7 +15,6 @@ public class M_Player : MonoBehaviour
|
||||
//public GameObject bullet;//子弹预制体
|
||||
private int faceDir;//面部朝向,-1、1
|
||||
private float runSpeedMultiple = 1f;//速度倍率,在按下和释放跑步后被修改
|
||||
|
||||
public Interactive catched;//所捕捉到的可交互对象
|
||||
void Start()
|
||||
{
|
||||
@ -101,9 +100,19 @@ public class M_Player : MonoBehaviour
|
||||
{
|
||||
if(context.started)
|
||||
{
|
||||
//可交互对象都有UI界面。当按下交互键后,显示交互界面
|
||||
if(catched != null)
|
||||
{
|
||||
catched.ShowInfo();
|
||||
catched.OnCall();
|
||||
}
|
||||
}
|
||||
|
||||
if(context.canceled)
|
||||
{
|
||||
//可交互对象电话线比较特殊,需要额外检测按钮松开的瞬间
|
||||
if(catched != null)
|
||||
{
|
||||
catched.StopRepareTheTelephoneLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,13 @@ public class Machine : Interactive
|
||||
|
||||
private Text codeTextView;
|
||||
private IndexRecoder indexRecoder;
|
||||
private AllLinesInfo linesChecker;
|
||||
void Start()
|
||||
{
|
||||
//m_interface = GameObject.Find("MachinePanel");
|
||||
codeTextView = m_interface.GetComponentInChildren<Text>();
|
||||
indexRecoder = FindObjectOfType<IndexRecoder>();
|
||||
linesChecker = FindObjectOfType<AllLinesInfo>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@ -23,6 +25,24 @@ public class Machine : Interactive
|
||||
|
||||
}
|
||||
|
||||
public override void OnCall()
|
||||
{
|
||||
if(LinesCheck())//如果线路全通
|
||||
{
|
||||
m_interface.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("还有线路没通");
|
||||
}
|
||||
}
|
||||
|
||||
private bool LinesCheck()
|
||||
{
|
||||
if(linesChecker.needCount == linesChecker.OKCount) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
//从Player类发消息来调用这个函数,temp为接受到的字符,可能是. || -。
|
||||
public override void Coding(string temp)
|
||||
|
70
Assets/Scripts/TelephoneLine.cs
Normal file
70
Assets/Scripts/TelephoneLine.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TelephoneLine : Interactive
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
private float allNeedTime;
|
||||
private float hasReparedTime = 0f;
|
||||
private bool isReparing = false;
|
||||
private bool isRepared = false;
|
||||
IndexRecoder indexRecoder;
|
||||
private float process = 0f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
indexRecoder = FindObjectOfType<IndexRecoder>();
|
||||
allNeedTime = indexRecoder.TelephoneNeedTime;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(!isRepared&&isReparing)//如果没有修复并且正在修复
|
||||
{
|
||||
//在修复的话,每帧累计时间,并更新进度
|
||||
hasReparedTime += Time.deltaTime;
|
||||
process = hasReparedTime/allNeedTime;
|
||||
//检查是否满了
|
||||
if(process >= 1f)
|
||||
{
|
||||
isRepared = true;
|
||||
FindObjectOfType<AllLinesInfo>().OKCount++;
|
||||
Debug.Log("满了,这个修好了");
|
||||
OnStopReparing();
|
||||
}
|
||||
//还要更新UI上的进度条
|
||||
for(int i = 0; i < m_interface.transform.childCount; i++)
|
||||
if(m_interface.transform.GetChild(i).tag == "进度条")
|
||||
m_interface.transform.GetChild(i).GetComponent<Image>().fillAmount = process;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCall()
|
||||
{
|
||||
//象征着按下交互键了,如果这个还没被修改,即刻开始修复电话线
|
||||
if(!isRepared)
|
||||
{
|
||||
m_interface.SetActive(true);
|
||||
StartRepareTheTelephoneLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void StartRepareTheTelephoneLine()
|
||||
{
|
||||
isReparing = true;
|
||||
}
|
||||
|
||||
public override void StopRepareTheTelephoneLine()
|
||||
{
|
||||
isReparing = false;
|
||||
OnStopReparing();
|
||||
}
|
||||
|
||||
private void OnStopReparing()
|
||||
{
|
||||
m_interface.SetActive(false);
|
||||
}
|
||||
}
|
11
Assets/Scripts/TelephoneLine.cs.meta
Normal file
11
Assets/Scripts/TelephoneLine.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3aac6ccb22f7aa3428b69462001463ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -6,7 +6,7 @@ EditorBuildSettings:
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/SampleScene.unity
|
||||
path: "Assets/Scenes/\u5E8F\u7AE0-\u5BB6\u4E2D.unity"
|
||||
guid: 2cda990e2423bbf4892e6590ba056729
|
||||
m_configObjects:
|
||||
com.unity.input.settings: {fileID: 11400000, guid: 5b0ac5f58f6660143aa0c32c9a8b5cd6, type: 2}
|
||||
|
@ -3,7 +3,8 @@
|
||||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- "\u8FDB\u5EA6\u6761"
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
@ -18,10 +18,21 @@ EditorUserSettings:
|
||||
value: 22424703114646680c031c2e1530103918070d3e6c1b3f23392c107cb3ae6476b0a805e0ea2a33397926ea310b713236ff1a050ed20e07042e3bee071ff8201f10dc1dd733c60f09df5709c0c409c8
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c721f04041d09232c2304283a097df7ee3d2cfb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||
flags: 0
|
||||
<<<<<<< HEAD
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036cdacaf990d3ea61ade8e6a9f1d07df7ee3d2cfb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036cdacaf990d3ea61adddcea8f6fb7df7ee3d2cfb
|
||||
=======
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c721f04041d09232c2304283a097df7ee3d2cfb
|
||||
>>>>>>> a793f4050f8fdc97ae8cf50a86f7455459abab35
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
Loading…
x
Reference in New Issue
Block a user