suta-togamennwakarann
This commit is contained in:
@@ -1295,8 +1295,8 @@ MonoBehaviour:
|
||||
features:
|
||||
- {fileID: 7011443450567333355}
|
||||
- {fileID: -671281728444007487}
|
||||
- {fileID: -901939997048047619}
|
||||
- {fileID: 5091991234558418143}
|
||||
- {fileID: 7055518550748799546}
|
||||
- {fileID: -4559034614451708685}
|
||||
- {fileID: 8980318060753866109}
|
||||
- {fileID: -6559185765804338520}
|
||||
- {fileID: -4756202077021157709}
|
||||
|
||||
108
Assets/_Objects/Square.prefab
Normal file
108
Assets/_Objects/Square.prefab
Normal file
@@ -0,0 +1,108 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3075638675573572061
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7648975059361283901}
|
||||
- component: {fileID: 114577864133115123}
|
||||
- component: {fileID: 2191905308100053176}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7648975059361283901
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3075638675573572061}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -43.88, y: 27.01, z: 15.25}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &114577864133115123
|
||||
SpriteRenderer:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3075638675573572061}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &2191905308100053176
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3075638675573572061}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d1dad518e6deb304387fd1c1435a67b2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::FadeOutSprite
|
||||
fadeDuration: 1
|
||||
startDelay: 0.5
|
||||
7
Assets/_Objects/Square.prefab.meta
Normal file
7
Assets/_Objects/Square.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59334a8a54b4cbc48996b04618ef137c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
55
Assets/_Scripts/FadeOut.cs
Normal file
55
Assets/_Scripts/FadeOut.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
// アタッチしたSprite Rendererの色を操作してフェードアウトさせるスクリプト
|
||||
[RequireComponent(typeof(SpriteRenderer))]
|
||||
public class FadeOutSprite : MonoBehaviour
|
||||
{
|
||||
private SpriteRenderer spriteRenderer;
|
||||
public float fadeDuration = 1.0f; // 消えるまでの時間(秒)
|
||||
public float startDelay = 0.5f; // 表示してからフェードを開始するまでの待ち時間(秒)
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// オブジェクトが有効になったときにフェードアニメーションを開始
|
||||
StartCoroutine(FadeOutCoroutine());
|
||||
}
|
||||
|
||||
private IEnumerator FadeOutCoroutine()
|
||||
{
|
||||
// 1. 最初は完全に表示
|
||||
SetAlpha(1f);
|
||||
|
||||
// 2. 指定時間待機(画像がはっきり見える時間)
|
||||
yield return new WaitForSeconds(startDelay);
|
||||
|
||||
// 3. アルファ値を徐々に減らすフェードアウト
|
||||
float timer = 0f;
|
||||
Color initialColor = spriteRenderer.color;
|
||||
|
||||
while (timer < fadeDuration)
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
// 経過時間に基づいてアルファ値を計算(1 -> 0)
|
||||
float alpha = Mathf.Lerp(1f, 0f, timer / fadeDuration);
|
||||
SetAlpha(alpha);
|
||||
yield return null; // 次のフレームまで待機
|
||||
}
|
||||
|
||||
// 4. 完全に消えたら自身を破棄(再利用しない場合)
|
||||
SetAlpha(0f);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void SetAlpha(float alpha)
|
||||
{
|
||||
Color current = spriteRenderer.color;
|
||||
current.a = alpha; // Alpha値を更新
|
||||
spriteRenderer.color = current;
|
||||
}
|
||||
}
|
||||
2
Assets/_Scripts/FadeOut.cs.meta
Normal file
2
Assets/_Scripts/FadeOut.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1dad518e6deb304387fd1c1435a67b2
|
||||
74
Assets/_Scripts/NewMonoBehaviourScript.cs
Normal file
74
Assets/_Scripts/NewMonoBehaviourScript.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// XR UIが反応しない原因を自動判定する超安全な診断スクリプト
|
||||
/// </summary>
|
||||
public class XRUIDiagnoser : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
Debug.Log("============== 🔍 XR UI 自動診断スタート ==============");
|
||||
|
||||
// 1. EventSystem の重複・存在チェック
|
||||
var eventSystems = FindObjectsByType<EventSystem>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
if (eventSystems.Length == 0)
|
||||
{
|
||||
Debug.LogError("🚨【原因】シーンに EventSystem が存在しません!");
|
||||
}
|
||||
else if (eventSystems.Length > 1)
|
||||
{
|
||||
Debug.LogError($"🚨【原因】EventSystem がシーンに {eventSystems.Length} 個あります!これが最大の原因になりやすいです。不要な方を削除してください。");
|
||||
foreach (var es in eventSystems) Debug.Log($" ・配置場所: {es.gameObject.name}", es.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
var module = eventSystems[0].GetComponent<BaseInputModule>();
|
||||
Debug.Log($"⭕ EventSystem: OK [{eventSystems[0].name}] | Module: {(module != null ? module.GetType().Name : "なし")}");
|
||||
}
|
||||
|
||||
// 2. Ray Interactor (ビーム発射体) の存在チェック (名前で動的探索するためバージョンエラーになりません)
|
||||
var allComponents = FindObjectsByType<Component>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
int rayCount = 0;
|
||||
foreach (var c in allComponents)
|
||||
{
|
||||
if (c != null && c.GetType().Name.Contains("RayInteractor"))
|
||||
{
|
||||
rayCount++;
|
||||
bool active = c.gameObject.activeInHierarchy;
|
||||
if (!active)
|
||||
Debug.LogError($"🚨【原因】[{c.gameObject.name}] の RayInteractor オブジェクトが非アクティブ(OFF)になっています!", c.gameObject);
|
||||
else
|
||||
Debug.Log($"⭕ Ray Interactor 発見: [{c.gameObject.name}] ({c.GetType().Name}) | Active: OK");
|
||||
}
|
||||
}
|
||||
|
||||
if (rayCount == 0)
|
||||
{
|
||||
Debug.LogError("🚨【原因】コントローラーの手のオブジェクトに RayInteractor コンポーネントが見つかりません!");
|
||||
}
|
||||
|
||||
// 3. Canvas の設定チェック
|
||||
var canvases = FindObjectsByType<Canvas>(FindObjectsInactive.Exclude, FindObjectsSortMode.None);
|
||||
if (canvases.Length == 0)
|
||||
{
|
||||
Debug.LogError("🚨【原因】アクティブな Canvas がシーン内に存在しません!");
|
||||
}
|
||||
|
||||
foreach (var canvas in canvases)
|
||||
{
|
||||
var raycaster = canvas.GetComponent<GraphicRaycaster>();
|
||||
if (raycaster == null)
|
||||
{
|
||||
Debug.LogError($"🚨【原因】Canvas [{canvas.name}] に Raycaster コンポーネントが付いていません!", canvas.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"⭕ Canvas: OK [{canvas.name}] | RenderMode: {canvas.renderMode} | Raycaster: {raycaster.GetType().Name}");
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("========================================================");
|
||||
}
|
||||
}
|
||||
2
Assets/_Scripts/NewMonoBehaviourScript.cs.meta
Normal file
2
Assets/_Scripts/NewMonoBehaviourScript.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bca5237dce7df3543ba5a9c686d545d6
|
||||
@@ -43,6 +43,10 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
private float defenseBuffTimer = 0f;
|
||||
private bool isCodingMode = false;
|
||||
|
||||
public GameObject successEffectPrefab;
|
||||
// エフェクトを出す位置(合体したブロックの少し上など)
|
||||
public Transform effectSpawnPoint;
|
||||
|
||||
private List<Animator> pausedAnimators = new List<Animator>();
|
||||
private List<NavMeshAgent> pausedAgents = new List<NavMeshAgent>();
|
||||
|
||||
@@ -178,6 +182,7 @@ public class PlayerStatusManager : MonoBehaviour
|
||||
|
||||
public void ApplyBuffsAndResume(string buff1, string buff2)
|
||||
{
|
||||
Instantiate(successEffectPrefab, effectSpawnPoint.position, effectSpawnPoint.rotation);
|
||||
ActivateBuffByName(buff1);
|
||||
ActivateBuffByName(buff2);
|
||||
ResumeWorldState(consumeGauge: true);
|
||||
|
||||
45
Assets/_Scripts/TitleManager.cs
Normal file
45
Assets/_Scripts/TitleManager.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SimpleTitleManager : MonoBehaviour
|
||||
{
|
||||
[Header("UI Buttons")]
|
||||
[SerializeField] private Button startButton;
|
||||
[SerializeField] private Button exitButton;
|
||||
|
||||
[Header("Scene Settings")]
|
||||
[SerializeField] private string mainGameSceneName = "MainGameScene";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// テンプレートの手でボタンを押した時に実行される処理
|
||||
startButton.onClick.AddListener(OnStartButtonClicked);
|
||||
exitButton.onClick.AddListener(OnExitButtonClicked);
|
||||
}
|
||||
|
||||
private void OnStartButtonClicked()
|
||||
{
|
||||
startButton.interactable = false; // 二重押し防止
|
||||
StartCoroutine(LoadSceneRoutine());
|
||||
}
|
||||
|
||||
private void OnExitButtonClicked()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
}
|
||||
|
||||
private IEnumerator LoadSceneRoutine()
|
||||
{
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(mainGameSceneName);
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/_Scripts/TitleManager.cs.meta
Normal file
2
Assets/_Scripts/TitleManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63f333cd2936fbf439d4433a50178080
|
||||
92
Assets/_Scripts/VRLaserPointer.cs
Normal file
92
Assets/_Scripts/VRLaserPointer.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace VRTitle.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// VRコントローラーからのポインター入力とUI操作を仲介するコンポーネント
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(LineRenderer))]
|
||||
public class VRLaserPointer : MonoBehaviour
|
||||
{
|
||||
[Header("Ray Settings")]
|
||||
[SerializeField] private float maxDistance = 10f;
|
||||
[SerializeField] private LayerMask uiLayerMask = ~0;
|
||||
|
||||
[Header("Visual")]
|
||||
[SerializeField] private LineRenderer lineRenderer;
|
||||
|
||||
private GameObject currentHoveredObject;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
lineRenderer = GetComponent<LineRenderer>();
|
||||
lineRenderer.positionCount = 2;
|
||||
lineRenderer.startWidth = 0.005f;
|
||||
lineRenderer.endWidth = 0.001f;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
ProcessPointer();
|
||||
}
|
||||
|
||||
private void ProcessPointer()
|
||||
{
|
||||
Ray ray = new Ray(transform.position, transform.forward);
|
||||
PointerEventData pointerData = new PointerEventData(EventSystem.current)
|
||||
{
|
||||
position = new Vector2(Screen.width / 2f, Screen.height / 2f)
|
||||
};
|
||||
|
||||
List<RaycastResult> results = new List<RaycastResult>();
|
||||
EventSystem.current?.RaycastAll(pointerData, results);
|
||||
|
||||
Vector3 targetPosition = transform.position + transform.forward * maxDistance;
|
||||
|
||||
if (results.Count > 0)
|
||||
{
|
||||
RaycastResult hit = results[0];
|
||||
targetPosition = hit.worldPosition;
|
||||
UpdateHoverState(hit.gameObject, pointerData);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateHoverState(null, pointerData);
|
||||
}
|
||||
|
||||
// ポインター描画の更新
|
||||
lineRenderer.SetPosition(0, transform.position);
|
||||
lineRenderer.SetPosition(1, targetPosition);
|
||||
}
|
||||
|
||||
private void UpdateHoverState(GameObject newHover, PointerEventData pointerData)
|
||||
{
|
||||
if (currentHoveredObject == newHover) return;
|
||||
|
||||
if (currentHoveredObject != null)
|
||||
{
|
||||
ExecuteEvents.Execute(currentHoveredObject, pointerData, ExecuteEvents.pointerExitHandler);
|
||||
}
|
||||
|
||||
currentHoveredObject = newHover;
|
||||
|
||||
if (currentHoveredObject != null)
|
||||
{
|
||||
ExecuteEvents.Execute(currentHoveredObject, pointerData, ExecuteEvents.pointerEnterHandler);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// トリガーボタンが押された時に呼び出す(Input System側から呼び出し可能)
|
||||
/// </summary>
|
||||
public void OnPrimaryTriggerDown()
|
||||
{
|
||||
if (currentHoveredObject == null) return;
|
||||
|
||||
PointerEventData pointerData = new PointerEventData(EventSystem.current);
|
||||
ExecuteEvents.Execute(currentHoveredObject, pointerData, ExecuteEvents.pointerClickHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/_Scripts/VRLaserPointer.cs.meta
Normal file
2
Assets/_Scripts/VRLaserPointer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6159a60476d605c4494622c0790e9b02
|
||||
@@ -5,6 +5,9 @@ EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/_Scenes/Test.unity
|
||||
guid: ef443f0333a244a26b06718135d3c98f
|
||||
- enabled: 1
|
||||
path: Assets/_Scenes/GameScene.unity
|
||||
guid: c224a272a4be6c6428cb5ed452dca7c5
|
||||
|
||||
Reference in New Issue
Block a user