将原在ItemBase的按键判断移至CameraInteract类中
This commit is contained in:
@@ -620,6 +620,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
rb: {fileID: 944706251}
|
||||
animator: {fileID: 0}
|
||||
maxVelocity: 6
|
||||
--- !u!54 &944706251
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -645,7 +646,7 @@ Rigidbody:
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 80
|
||||
m_Constraints: 112
|
||||
m_CollisionDetection: 1
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
@@ -878,6 +879,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1644802856}
|
||||
- {fileID: 1157830469}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -885,6 +887,56 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1 &1157830468
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1157830469}
|
||||
- component: {fileID: 1157830470}
|
||||
m_Layer: 5
|
||||
m_Name: Dialog
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1157830469
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1157830468}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1107264578}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1157830470
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1157830468}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 166525e51f1d41a2addfb1df626096fc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
dialogsPath:
|
||||
dialogJson:
|
||||
--- !u!1 &1306517519
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Event;
|
||||
using Keyboard;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Camera
|
||||
@@ -12,7 +13,7 @@ namespace Camera
|
||||
private void Update()
|
||||
{
|
||||
Physics.Raycast(transform.position, transform.forward, out var raycastHit, maxInterActDistance);
|
||||
if (raycastHit.collider)
|
||||
if (raycastHit.collider && Input.GetKeyDown(KeySettingManager.Instance.GetKey("InterAct")))
|
||||
EventManager.Instance.OnCameraInterAct(raycastHit.collider.gameObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Event;
|
||||
using Event.EventArgs;
|
||||
using Keyboard;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Items.Abstract
|
||||
@@ -15,10 +14,10 @@ namespace Items.Abstract
|
||||
protected virtual void ReceiveEvent(CameraInterActArgs item)
|
||||
{
|
||||
if (item.Item != gameObject) return;
|
||||
|
||||
ActivateItem();
|
||||
}
|
||||
|
||||
protected void ActivateItem()
|
||||
protected virtual void ActivateItem()
|
||||
{
|
||||
Debug.Log("Item is activated");
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
using Event.EventArgs;
|
||||
using Event;
|
||||
using Items.Abstract;
|
||||
using Items.Interface;
|
||||
using Keyboard;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Items
|
||||
{
|
||||
public class TestItem : ItemBase , IItem
|
||||
{
|
||||
protected override void ReceiveEvent(CameraInterActArgs item)
|
||||
protected override void ActivateItem()
|
||||
{
|
||||
if(Input.GetKeyDown(KeySettingManager.Instance.GetKey("InterAct")))
|
||||
ActivateItem();
|
||||
base.ActivateItem();
|
||||
EventManager.Instance.OnDialogPop(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user