Commit df4cd1e4 authored by czy's avatar czy

配置管理1.0

parents 31b8f212 43be5c23
......@@ -435,7 +435,7 @@ Transform:
- {fileID: 1959561188}
- {fileID: 1392949506}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1338506704
GameObject:
......@@ -617,6 +617,53 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 594899301}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1960597216
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1960597218}
- component: {fileID: 1960597217}
m_Layer: 0
m_Name: ConfigurationFfile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1960597217
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1960597216}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 36730f682241d5c45a06bc01fc344b12, type: 3}
m_Name:
m_EditorClassIdentifier:
VSpeed: 52.53
SpeedLevel: 1
AddSpeed: 10
HSpeed: 10
--- !u!4 &1960597218
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1960597216}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.6968515, y: 4.3138065, z: -495.98093}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2347244091251205803 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6064464676810081129, guid: 919382978f5e2684ba83e6daf6491458,
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ConfigurationFile : MonoBehaviour
{
[Header("AI和主角")]
[Tooltip("控制向前的速度。")]
public float VSpeed = 20.0f;
public int SpeedLevel = 1;
[Tooltip("没升一级增加的速度")]
public float AddSpeed = 10.0f;
[Tooltip("控制左右移动的速度。")]
public float HSpeed = 10.0f;
public static ConfigurationFile instance;
private void Awake()
{
instance = this;
}
void Start()
{
}
void Update()
{
}
}
fileFormatVersion: 2
guid: 36730f682241d5c45a06bc01fc344b12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -13,13 +13,15 @@ public class PlayerMove : MonoBehaviour
{
[Header("控制移动")]
[Tooltip("控制向前的速度。")]
public float VSpeed = 40.0f;
public int SpeedLevel = 1;
private float VSpeed = 20.0f;
private int SpeedLevel = 1;
[Tooltip("没升一级增加的速度")]
public float AddSpeed = 10.0f;
private float AddSpeed = 10.0f;
[Tooltip("控制左右移动的速度。")]
public float HSpeed = 10.0f;
private float HSpeed = 10.0f;
[Tooltip("主角移动方式")]
public MoveType moveType= MoveType.MoveType3;
[Header("地面检测")]
......@@ -54,6 +56,10 @@ public class PlayerMove : MonoBehaviour
// Start is called before the first frame update
void Start()
{
//委托注册方法
BattleCtrl.instance.turnDir += TurnDir;
......@@ -160,7 +166,15 @@ public class PlayerMove : MonoBehaviour
{
//print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
//从配置文件ConfigurationFile中获取数据
VSpeed = ConfigurationFile.instance.VSpeed;
SpeedLevel = ConfigurationFile.instance.SpeedLevel;
AddSpeed = ConfigurationFile.instance.AddSpeed;
HSpeed = ConfigurationFile.instance.HSpeed;
if (!BattleCtrl.instance.isStartBattle)
{
isAddSpeed = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment