This commit is contained in:
陈向学 2024-08-28 14:33:05 +08:00
parent aaf6de6eef
commit 4ca5a5346a
11 changed files with 97 additions and 1694 deletions

View File

@ -67,8 +67,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1817104532282105278}
- component: {fileID: 1817104532282105277}
- component: {fileID: 7877983387822698289}
- component: {fileID: 1370926028621828158}
m_Layer: 0
m_Name: 1002
m_TagString: Untagged
@ -91,18 +91,6 @@ Transform:
m_Father: {fileID: 1817104532306234130}
m_RootOrder: 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
MonoBehaviour:
m_ObjectHideFlags: 0
@ -117,6 +105,18 @@ MonoBehaviour:
m_EditorClassIdentifier:
systemId: 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
GameObject:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: a38e68328447cf144883eda220a17ea1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -14,6 +14,11 @@ public class Device_Base : PermanentTriggerBase
/// </summary>
public Func<string,bool,int> triggerAction;
/// <summary>
/// 打分事件
/// </summary>
public Action<string, object, int, int> scoreAction;
private Vector3 head_LocalPos;
private Vector3 head_LocalEulerAnglesl;
@ -23,6 +28,7 @@ public class Device_Base : PermanentTriggerBase
{
base.OnStart();
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
AddScoreAction(ScoreManager.instance.Check);
}
}
@ -47,6 +53,10 @@ public class Device_Base : PermanentTriggerBase
{
this.triggerAction = action;
}
public void AddScoreAction(Action<string, object, int, int> back)
{
this.scoreAction = back;
}
/// <summary>
/// 设置工具回到手中的位置

View File

@ -2,8 +2,17 @@ using System.Collections;
using System.Collections.Generic;
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>
@ -13,9 +22,21 @@ public class ScoreBase : MonoBehaviour
/// </summary>
protected float currentScore;
/// <summary>
/// ²½Öè
/// 此科目步骤
/// </summary>
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()
{
}
}

View File

@ -1,13 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class ScoreManager : MonoBehaviour
{
public static ScoreManager instance;
List<Score_1002> scoreSubjectList;
List<ScoreBase> scoreSubjectList;
private void Awake()
{
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();
}
}

View File

@ -4,9 +4,12 @@ using UnityEngine;
public class Score_1002 : ScoreBase
{
private void Init()
/// <summary>
/// 初始化,有配置用配置的分数,没有使用默认的分数
/// </summary>
public override void Init()
{
base.Init();
steps = new Dictionary<int, ScoreSubjectStep>();
steps.Add(3001, new ScoreSubjectStep(0));
steps.Add(3002, new ScoreSubjectStep(0));
@ -28,11 +31,9 @@ public class Score_1002 : ScoreBase
steps.Add(3018, new ScoreSubjectStep(3));
}
/// <summary>
/// 判分
/// </summary>
public void CheckScore()
public override void CheckScore()
{
base.CheckScore();
}
}

View File

@ -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);
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 40734e2dbb26ba24eaced19c3fbc57ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -18,6 +18,10 @@ public class Tool_Base : PermanentTriggerBase
/// trigger触发事件
/// </summary>
public Func<string, bool, int> triggerAction;
/// <summary>
/// ´ò·Öʼþ
/// </summary>
public Action<string, object, int, int> scoreAction;
private Vector3 head_LocalPos;
private Vector3 head_LocalEulerAnglesl;
@ -28,6 +32,7 @@ public class Tool_Base : PermanentTriggerBase
{
base.OnStart();
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
AddScoreAction(ScoreManager.instance.Check);
}
}
protected override void OnMEnter()
@ -52,6 +57,11 @@ public class Tool_Base : PermanentTriggerBase
{
this.triggerAction = action;
}
public void AddScoreAction(Action<string, object, int, int> back)
{
this.scoreAction = back;
}
/// <summary>
/// 设置工具回到手中的位置
/// </summary>
@ -69,7 +79,11 @@ public class Tool_Base : PermanentTriggerBase
public void ReBackHead()
{
transform.parent=Camera.main.transform;
transform.DOLocalMove(head_LocalPos, 1);
transform.DOLocalRotate(head_LocalEulerAnglesl, 1);
transform.DOLocalRotate(head_LocalEulerAnglesl, 0.5f);
transform.DOLocalMove(head_LocalPos, 1).OnComplete(() =>
{
transform.localPosition = head_LocalPos;
transform.localEulerAngles = head_LocalEulerAnglesl;
});
}
}

View File

@ -84,7 +84,7 @@ public class Tool_Screw : Tool_Base
isInstall = true;
isMoving = false;
installAction?.Invoke(true);
ReBackHead();
screwdriver.ReBackHead();
});
});
}
@ -119,7 +119,7 @@ public class Tool_Screw : Tool_Base
isInstall = false;
isMoving = false;
installAction?.Invoke(false);
ReBackHead();
screwdriver.ReBackHead();
});
});
}