1.添加了新场景序章-回忆
2.添加了电话线框架 3.添加了电话线进度条框架 4.完成了电报机线路检查系统
This commit is contained in:
parent
beffb4acd1
commit
8fc1bff703
26
Assets/InputSystem.inputsettings.asset
Normal file
26
Assets/InputSystem.inputsettings.asset
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
|
||||||
|
m_Name: InputSystem.inputsettings
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_SupportedDevices: []
|
||||||
|
m_UpdateMode: 1
|
||||||
|
m_CompensateForScreenOrientation: 1
|
||||||
|
m_FilterNoiseOnCurrent: 0
|
||||||
|
m_DefaultDeadzoneMin: 0.125
|
||||||
|
m_DefaultDeadzoneMax: 0.925
|
||||||
|
m_DefaultButtonPressPoint: 0.5
|
||||||
|
m_DefaultTapTime: 0.2
|
||||||
|
m_DefaultSlowTapTime: 0.5
|
||||||
|
m_DefaultHoldTime: 0.4
|
||||||
|
m_TapRadius: 5
|
||||||
|
m_MultiTapDelayTime: 0.75
|
8
Assets/InputSystem.inputsettings.asset.meta
Normal file
8
Assets/InputSystem.inputsettings.asset.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1077cbc74ab0dc44eb42f9a1f2b90a2a
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
208
Assets/Scenes/MorseCodeTest.unity
Normal file
208
Assets/Scenes/MorseCodeTest.unity
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 3
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 12
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 0
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_LightingSettings: {fileID: 0}
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
maxJobWorkers: 0
|
||||||
|
preserveTilesOutsideBounds: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &1850732595
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1850732598}
|
||||||
|
- component: {fileID: 1850732597}
|
||||||
|
- component: {fileID: 1850732596}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Main Camera
|
||||||
|
m_TagString: MainCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!81 &1850732596
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1850732595}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!20 &1850732597
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1850732595}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 1
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: -1
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!4 &1850732598
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1850732595}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||||
|
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}
|
7
Assets/Scenes/MorseCodeTest.unity.meta
Normal file
7
Assets/Scenes/MorseCodeTest.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e3b1874f9da48ef4e8f178d791968276
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
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 float dotRoLineTime;//判定输入为点还是横线的界限时间
|
||||||
public Dictionary<string, string> codeBook = new Dictionary<string, string>();
|
public Dictionary<string, string> codeBook = new Dictionary<string, string>();
|
||||||
|
public float TelephoneNeedTime;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
GameObject.DontDestroyOnLoad(gameObject);
|
GameObject.DontDestroyOnLoad(gameObject);
|
||||||
|
@ -6,19 +6,10 @@ using UnityEngine.UI;
|
|||||||
public class Interactive : MonoBehaviour
|
public class Interactive : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
public GameObject m_interface;
|
//这是所有可交互物体的基类
|
||||||
|
public GameObject m_interface;//可交互物体一般都和一个UI界面挂钩,这就是那个UI界面
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//这是一对碰撞检测代码。当玩家进入,将自身传给玩家。当玩家退出,把玩家的catch清空
|
||||||
void OnTriggerEnter2D(Collider2D other)
|
void OnTriggerEnter2D(Collider2D other)
|
||||||
{
|
{
|
||||||
if(other.tag == "Player")
|
if(other.tag == "Player")
|
||||||
@ -26,7 +17,6 @@ public class Interactive : MonoBehaviour
|
|||||||
other.GetComponent<M_Player>().catched = this;
|
other.GetComponent<M_Player>().catched = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTriggerExit2D(Collider2D other)
|
void OnTriggerExit2D(Collider2D other)
|
||||||
{
|
{
|
||||||
if(other.tag == "Player")
|
if(other.tag == "Player")
|
||||||
@ -34,11 +24,14 @@ public class Interactive : MonoBehaviour
|
|||||||
other.GetComponent<M_Player>().catched = null;
|
other.GetComponent<M_Player>().catched = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
public void ShowInfo()
|
//当这个可交互物体被玩家交互。一般需要重写这个函数。
|
||||||
{
|
public virtual void OnCall(){}
|
||||||
m_interface.SetActive(true);
|
//
|
||||||
}
|
|
||||||
|
|
||||||
|
//以下为针对各具体可交互对象的虚拟函数,在具体物体中重写
|
||||||
public virtual void Coding(string temp){}
|
public virtual void Coding(string temp){}
|
||||||
|
public virtual void StopRepareTheTelephoneLine(){}
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class M_Player : MonoBehaviour
|
public class M_Player : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
//玩家类,主要用来控制玩家
|
||||||
private IndexRecoder indexRecoder;//记录组件,内存方便修改的参数
|
private IndexRecoder indexRecoder;//记录组件,内存方便修改的参数
|
||||||
private Vector2 velocity;//逻辑速度,通过计算获得,最后加在理论速度上
|
private Vector2 velocity;//逻辑速度,通过计算获得,最后加在理论速度上
|
||||||
private Rigidbody2D m_rigidbody;//自身刚体组件
|
private Rigidbody2D m_rigidbody;//自身刚体组件
|
||||||
@ -15,7 +15,6 @@ public class M_Player : MonoBehaviour
|
|||||||
//public GameObject bullet;//子弹预制体
|
//public GameObject bullet;//子弹预制体
|
||||||
private int faceDir;//面部朝向,-1、1
|
private int faceDir;//面部朝向,-1、1
|
||||||
private float runSpeedMultiple = 1f;//速度倍率,在按下和释放跑步后被修改
|
private float runSpeedMultiple = 1f;//速度倍率,在按下和释放跑步后被修改
|
||||||
|
|
||||||
public Interactive catched;//所捕捉到的可交互对象
|
public Interactive catched;//所捕捉到的可交互对象
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@ -101,9 +100,19 @@ public class M_Player : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if(context.started)
|
if(context.started)
|
||||||
{
|
{
|
||||||
|
//可交互对象都有UI界面。当按下交互键后,显示交互界面
|
||||||
if(catched != null)
|
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 Text codeTextView;
|
||||||
private IndexRecoder indexRecoder;
|
private IndexRecoder indexRecoder;
|
||||||
|
private AllLinesInfo linesChecker;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
//m_interface = GameObject.Find("MachinePanel");
|
//m_interface = GameObject.Find("MachinePanel");
|
||||||
codeTextView = m_interface.GetComponentInChildren<Text>();
|
codeTextView = m_interface.GetComponentInChildren<Text>();
|
||||||
indexRecoder = FindObjectOfType<IndexRecoder>();
|
indexRecoder = FindObjectOfType<IndexRecoder>();
|
||||||
|
linesChecker = FindObjectOfType<AllLinesInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// 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为接受到的字符,可能是. || -。
|
//从Player类发消息来调用这个函数,temp为接受到的字符,可能是. || -。
|
||||||
public override void Coding(string 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
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/SampleScene.unity
|
path: "Assets/Scenes/\u5E8F\u7AE0-\u5BB6\u4E2D.unity"
|
||||||
guid: 2cda990e2423bbf4892e6590ba056729
|
guid: 2cda990e2423bbf4892e6590ba056729
|
||||||
m_configObjects:
|
m_configObjects:
|
||||||
com.unity.input.settings: {fileID: 11400000, guid: 5b0ac5f58f6660143aa0c32c9a8b5cd6, type: 2}
|
com.unity.input.settings: {fileID: 11400000, guid: 5b0ac5f58f6660143aa0c32c9a8b5cd6, type: 2}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
--- !u!78 &1
|
--- !u!78 &1
|
||||||
TagManager:
|
TagManager:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
tags: []
|
tags:
|
||||||
|
- "\u8FDB\u5EA6\u6761"
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
@ -18,8 +18,17 @@ EditorUserSettings:
|
|||||||
value: 22424703114646680c031c2e1530103918070d3e6c1b3f23392c107cb3ae6476b0a805e0ea2a33397926ea310b713236ff1a050ed20e07042e3bee071ff8201f10dc1dd733c60f09df5709c0c409c8
|
value: 22424703114646680c031c2e1530103918070d3e6c1b3f23392c107cb3ae6476b0a805e0ea2a33397926ea310b713236ff1a050ed20e07042e3bee071ff8201f10dc1dd733c60f09df5709c0c409c8
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedScenePath-4:
|
RecentlyUsedScenePath-4:
|
||||||
|
value: 22424703114646680e0b0227036c721f04041d09232c2304283a097df7ee3d2cfb
|
||||||
|
flags: 0
|
||||||
|
RecentlyUsedScenePath-5:
|
||||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||||
flags: 0
|
flags: 0
|
||||||
|
RecentlyUsedScenePath-6:
|
||||||
|
value: 22424703114646680e0b0227036cdacaf990d3ea61ade8e6a9f1d07df7ee3d2cfb
|
||||||
|
flags: 0
|
||||||
|
RecentlyUsedScenePath-7:
|
||||||
|
value: 22424703114646680e0b0227036cdacaf990d3ea61adddcea8f6fb7df7ee3d2cfb
|
||||||
|
flags: 0
|
||||||
vcSharedLogLevel:
|
vcSharedLogLevel:
|
||||||
value: 0d5e400f0650
|
value: 0d5e400f0650
|
||||||
flags: 0
|
flags: 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user