This commit is contained in:
parent
aaf6de6eef
commit
4ca5a5346a
|
@ -67,8 +67,8 @@ GameObject:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1817104532282105278}
|
- component: {fileID: 1817104532282105278}
|
||||||
- component: {fileID: 1817104532282105277}
|
|
||||||
- component: {fileID: 7877983387822698289}
|
- component: {fileID: 7877983387822698289}
|
||||||
|
- component: {fileID: 1370926028621828158}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: 1002
|
m_Name: 1002
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -91,18 +91,6 @@ Transform:
|
||||||
m_Father: {fileID: 1817104532306234130}
|
m_Father: {fileID: 1817104532306234130}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &1817104532282105277
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1817104532282105279}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 00415bfa520d2dd43b89c50a93350199, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!114 &7877983387822698289
|
--- !u!114 &7877983387822698289
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -117,6 +105,18 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
systemId: 0
|
systemId: 0
|
||||||
schemeId: 0
|
schemeId: 0
|
||||||
|
--- !u!114 &1370926028621828158
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1817104532282105279}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8897a2609da37744e94a004f97f53e6a, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1817104532306234131
|
--- !u!1 &1817104532306234131
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a38e68328447cf144883eda220a17ea1
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -14,6 +14,11 @@ public class Device_Base : PermanentTriggerBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<string,bool,int> triggerAction;
|
public Func<string,bool,int> triggerAction;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打分事件
|
||||||
|
/// </summary>
|
||||||
|
public Action<string, object, int, int> scoreAction;
|
||||||
|
|
||||||
private Vector3 head_LocalPos;
|
private Vector3 head_LocalPos;
|
||||||
private Vector3 head_LocalEulerAnglesl;
|
private Vector3 head_LocalEulerAnglesl;
|
||||||
|
|
||||||
|
@ -23,6 +28,7 @@ public class Device_Base : PermanentTriggerBase
|
||||||
{
|
{
|
||||||
base.OnStart();
|
base.OnStart();
|
||||||
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
||||||
|
AddScoreAction(ScoreManager.instance.Check);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +53,10 @@ public class Device_Base : PermanentTriggerBase
|
||||||
{
|
{
|
||||||
this.triggerAction = action;
|
this.triggerAction = action;
|
||||||
}
|
}
|
||||||
|
public void AddScoreAction(Action<string, object, int, int> back)
|
||||||
|
{
|
||||||
|
this.scoreAction = back;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置工具回到手中的位置
|
/// 设置工具回到手中的位置
|
||||||
|
|
|
@ -2,8 +2,17 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ScoreBase : MonoBehaviour
|
public abstract class ScoreBase : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统id
|
||||||
|
/// </summary>
|
||||||
|
public int systemId;
|
||||||
|
/// <summary>
|
||||||
|
/// 科目id
|
||||||
|
/// </summary>
|
||||||
|
public int schemeId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 科目满分
|
/// 科目满分
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -13,9 +22,21 @@ public class ScoreBase : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected float currentScore;
|
protected float currentScore;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ²½Öè
|
/// 此科目步骤
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Dictionary<int, ScoreSubjectStep> steps;
|
protected Dictionary<int, ScoreSubjectStep> steps;
|
||||||
|
|
||||||
//protected abstract void Init(ScoreSubjectStep step);
|
public virtual void Init()
|
||||||
|
{
|
||||||
|
systemId = int.Parse(transform.parent.name);
|
||||||
|
schemeId = int.Parse(transform.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判分
|
||||||
|
/// </summary>
|
||||||
|
public virtual void CheckScore()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,36 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ScoreManager : MonoBehaviour
|
public class ScoreManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static ScoreManager instance;
|
public static ScoreManager instance;
|
||||||
List<Score_1002> scoreSubjectList;
|
|
||||||
|
List<ScoreBase> scoreSubjectList;
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
|
scoreSubjectList = transform.GetComponentsInChildren<ScoreBase>(true).ToList();
|
||||||
|
scoreSubjectList.ForEach(a =>
|
||||||
|
{
|
||||||
|
a.Init();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ¼ì²â·ÖÊý
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="systemctlid"></param>
|
||||||
|
/// <param name="schemeid"></param>
|
||||||
|
/// <param name="subProcessid">²½Öè</param>
|
||||||
|
public void Check(string triggerName, object para, int systemctlid=0,int schemeid=0)
|
||||||
|
{
|
||||||
|
if (systemctlid == 0)
|
||||||
|
systemctlid = GameManager.Instance.systemId;
|
||||||
|
if (schemeid == 0)
|
||||||
|
schemeid = GameManager.RunModelMgr.schemeID;
|
||||||
|
|
||||||
|
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,14 @@ using UnityEngine;
|
||||||
|
|
||||||
public class Score_1002 : ScoreBase
|
public class Score_1002 : ScoreBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
private void Init()
|
/// 初始化,有配置用配置的分数,没有使用默认的分数
|
||||||
|
/// </summary>
|
||||||
|
public override void Init()
|
||||||
{
|
{
|
||||||
|
base.Init();
|
||||||
steps = new Dictionary<int, ScoreSubjectStep>();
|
steps = new Dictionary<int, ScoreSubjectStep>();
|
||||||
steps.Add(3001,new ScoreSubjectStep(0));
|
steps.Add(3001, new ScoreSubjectStep(0));
|
||||||
steps.Add(3002, new ScoreSubjectStep(0));
|
steps.Add(3002, new ScoreSubjectStep(0));
|
||||||
steps.Add(3003, new ScoreSubjectStep(5));
|
steps.Add(3003, new ScoreSubjectStep(5));
|
||||||
steps.Add(3004, new ScoreSubjectStep(5));
|
steps.Add(3004, new ScoreSubjectStep(5));
|
||||||
|
@ -28,11 +31,9 @@ public class Score_1002 : ScoreBase
|
||||||
steps.Add(3018, new ScoreSubjectStep(3));
|
steps.Add(3018, new ScoreSubjectStep(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public override void CheckScore()
|
||||||
/// 判分
|
|
||||||
/// </summary>
|
|
||||||
public void CheckScore()
|
|
||||||
{
|
{
|
||||||
|
base.CheckScore();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 步骤状态类
|
|
||||||
/// </summary>
|
|
||||||
public class StepStateBase : MonoBehaviour
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 配置的步骤状态初始参数
|
|
||||||
/// </summary>
|
|
||||||
public string initStatePara;
|
|
||||||
|
|
||||||
private Action<string> callback;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置状态初始化方法
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="callback"> 配置的初始化参数 </param>
|
|
||||||
public void AddResetFunction(Action<string> callback)
|
|
||||||
{
|
|
||||||
this.callback = callback;
|
|
||||||
Debug.Log("步骤状态注册成功:" + gameObject.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 执行步骤状态初始化
|
|
||||||
/// </summary>
|
|
||||||
public void InvokeInitStepStae()
|
|
||||||
{
|
|
||||||
if (callback != null)
|
|
||||||
{
|
|
||||||
Debug.Log("步骤初始化:" + gameObject.name);
|
|
||||||
callback(initStatePara);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 40734e2dbb26ba24eaced19c3fbc57ae
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -18,6 +18,10 @@ public class Tool_Base : PermanentTriggerBase
|
||||||
/// trigger触发事件
|
/// trigger触发事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<string, bool, int> triggerAction;
|
public Func<string, bool, int> triggerAction;
|
||||||
|
/// <summary>
|
||||||
|
/// ´ò·Öʼþ
|
||||||
|
/// </summary>
|
||||||
|
public Action<string, object, int, int> scoreAction;
|
||||||
|
|
||||||
private Vector3 head_LocalPos;
|
private Vector3 head_LocalPos;
|
||||||
private Vector3 head_LocalEulerAnglesl;
|
private Vector3 head_LocalEulerAnglesl;
|
||||||
|
@ -28,6 +32,7 @@ public class Tool_Base : PermanentTriggerBase
|
||||||
{
|
{
|
||||||
base.OnStart();
|
base.OnStart();
|
||||||
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
||||||
|
AddScoreAction(ScoreManager.instance.Check);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override void OnMEnter()
|
protected override void OnMEnter()
|
||||||
|
@ -52,6 +57,11 @@ public class Tool_Base : PermanentTriggerBase
|
||||||
{
|
{
|
||||||
this.triggerAction = action;
|
this.triggerAction = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddScoreAction(Action<string, object, int, int> back)
|
||||||
|
{
|
||||||
|
this.scoreAction = back;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置工具回到手中的位置
|
/// 设置工具回到手中的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -69,7 +79,11 @@ public class Tool_Base : PermanentTriggerBase
|
||||||
public void ReBackHead()
|
public void ReBackHead()
|
||||||
{
|
{
|
||||||
transform.parent=Camera.main.transform;
|
transform.parent=Camera.main.transform;
|
||||||
transform.DOLocalMove(head_LocalPos, 1);
|
transform.DOLocalRotate(head_LocalEulerAnglesl, 0.5f);
|
||||||
transform.DOLocalRotate(head_LocalEulerAnglesl, 1);
|
transform.DOLocalMove(head_LocalPos, 1).OnComplete(() =>
|
||||||
|
{
|
||||||
|
transform.localPosition = head_LocalPos;
|
||||||
|
transform.localEulerAngles = head_LocalEulerAnglesl;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class Tool_Screw : Tool_Base
|
||||||
isInstall = true;
|
isInstall = true;
|
||||||
isMoving = false;
|
isMoving = false;
|
||||||
installAction?.Invoke(true);
|
installAction?.Invoke(true);
|
||||||
ReBackHead();
|
screwdriver.ReBackHead();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class Tool_Screw : Tool_Base
|
||||||
isInstall = false;
|
isInstall = false;
|
||||||
isMoving = false;
|
isMoving = false;
|
||||||
installAction?.Invoke(false);
|
installAction?.Invoke(false);
|
||||||
ReBackHead();
|
screwdriver.ReBackHead();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue