恢复贪吃蛇和ARGame游戏脚本,之前远程仓库硬盘出问题导致版本回退了。
This commit is contained in:
parent
353e53d997
commit
f2d308aae4
8
EintooAR/Assets/AssetRaw/Scenes/ARGame.meta
Normal file
8
EintooAR/Assets/AssetRaw/Scenes/ARGame.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fa02d898f7e57d4f89aa30111b7b50f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,14 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
[EventInterface(EEventGroup.GroupUI)]
|
||||
public interface ARGameSnackInterface
|
||||
{
|
||||
public void IsStart(bool isStarted);
|
||||
|
||||
public void IsGrow(bool isGrowing);
|
||||
|
||||
public void ControlRotion(float angle);
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 879c707e916669849b13c71a20459f7e
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using TEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
@ -25,29 +26,29 @@ namespace GameLogic
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
|
||||
InvokeRepeating("Move", 0.0f, 1f);
|
||||
|
||||
SpawnFood();
|
||||
GameEvent.AddEventListener<bool>(ARGameSnackInterface_Event.IsStart,IsStart);
|
||||
|
||||
GameEvent.AddEventListener<float>(ARGameSnackInterface_Event.ControlRotion,ControlRotion);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
public void IsStart(bool isStarted)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
||||
if (isStarted)
|
||||
{
|
||||
RotationCube(90);
|
||||
InvokeRepeating("Move", 0.0f, 1f);
|
||||
|
||||
SpawnFood();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Alpha2))
|
||||
else
|
||||
{
|
||||
RotationCube(-90);
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Alpha3))
|
||||
{
|
||||
Grow();
|
||||
CancelInvoke("Move");
|
||||
|
||||
// 清空食物list
|
||||
FoodList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void RotationCube(float angle)
|
||||
public void ControlRotion(float angle)
|
||||
{
|
||||
transform.Rotate(Vector3.up, angle);
|
||||
|
||||
@ -87,6 +88,8 @@ namespace GameLogic
|
||||
}
|
||||
|
||||
BodyList.Add(body.transform);
|
||||
|
||||
GameEvent.Get<ARGameSnackInterface>().IsGrow(true);
|
||||
}
|
||||
|
||||
private void SpawnFood()
|
||||
|
@ -2,10 +2,7 @@ using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TEngine;
|
||||
using static PetResponseScriptableObject;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using VoxelBusters.CoreLibrary;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
@ -33,7 +30,7 @@ namespace GameLogic
|
||||
{
|
||||
await UniTask.Yield();
|
||||
|
||||
LoadGameScene(curgamename);
|
||||
LoadGameScene(this.curgamename);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -41,12 +38,7 @@ namespace GameLogic
|
||||
{
|
||||
base.RegisterEvent();
|
||||
|
||||
GameEvent.AddEventListener<string>(
|
||||
"UIARGameInterface",
|
||||
(gamename) =>
|
||||
{
|
||||
this.curgamename = gamename;
|
||||
});
|
||||
GameEvent.AddEventListener<string>(UIARGameInterface_Event.GetCurGameName, GetCurGameName);
|
||||
}
|
||||
|
||||
protected override void OnCreate()
|
||||
@ -58,6 +50,11 @@ namespace GameLogic
|
||||
RegisterEvent();
|
||||
}
|
||||
|
||||
public void GetCurGameName(string gameName)
|
||||
{
|
||||
this.curgamename = gameName;
|
||||
}
|
||||
|
||||
private async void LoadARGameData()
|
||||
{
|
||||
aRGame = GameModule.Resource.LoadAsset<ARGameScriptableObject>(GAME_DATA_PATH);
|
||||
@ -101,8 +98,12 @@ namespace GameLogic
|
||||
{
|
||||
case "贪吃蛇":
|
||||
GameModule.UI.ShowUI<UISnackWindow>();
|
||||
GameModule.Scene.LoadScene("Snack");
|
||||
GameModule.UI.CloseUI<UIARGameWindow>();
|
||||
break;
|
||||
default:
|
||||
Debug.Log("_curgamename为空");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@ using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TEngine;
|
||||
using VoxelBusters.CoreLibrary;
|
||||
using UnityEngine.SocialPlatforms.Impl;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
@ -40,7 +38,8 @@ namespace GameLogic
|
||||
|
||||
m_btnPlay.gameObject.SetActive(false);
|
||||
m_textPlay.gameObject.SetActive(false);
|
||||
Debug.Log("贪吃蛇游戏开始");
|
||||
|
||||
GameEvent.Get<ARGameSnackInterface>().IsStart(true);
|
||||
}
|
||||
private async UniTaskVoid OnClickLeftBtn()
|
||||
{
|
||||
@ -61,15 +60,34 @@ namespace GameLogic
|
||||
base.OnCreate();
|
||||
|
||||
score = 0;
|
||||
RegisterEvent();
|
||||
}
|
||||
|
||||
protected override void RegisterEvent()
|
||||
{
|
||||
base.RegisterEvent();
|
||||
|
||||
GameEvent.AddEventListener<bool>(ARGameSnackInterface_Event.IsGrow,IsGrow);
|
||||
}
|
||||
|
||||
public void IsGrow(bool isGrowing)
|
||||
{
|
||||
if (isGrowing)
|
||||
{
|
||||
CreateScoreWidget();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateScoreWidget()
|
||||
{
|
||||
if (score >= 10)
|
||||
if (score >= 9)
|
||||
{
|
||||
m_textWin.gameObject.SetActive(true);
|
||||
|
||||
GameEvent.Get<ARGameSnackInterface>().IsStart(false);
|
||||
return;
|
||||
}
|
||||
|
||||
CreateWidgetByPath<UISnackWidget>(m_goScoreICon.transform, "UISnackWidget");
|
||||
|
||||
score++;
|
||||
@ -77,11 +95,12 @@ namespace GameLogic
|
||||
|
||||
private void LeftFunc()
|
||||
{
|
||||
|
||||
GameEvent.Get<ARGameSnackInterface>().ControlRotion(-90);
|
||||
}
|
||||
|
||||
private void RightFunc()
|
||||
{
|
||||
GameEvent.Get<ARGameSnackInterface>().ControlRotion(90);
|
||||
}
|
||||
}
|
||||
}
|
8
EintooAR/Assets/Settings.meta
Normal file
8
EintooAR/Assets/Settings.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 250ed5a2e8769e140a102a11abade44d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
EintooAR/Assets/Settings/Build Profiles.meta
Normal file
8
EintooAR/Assets/Settings/Build Profiles.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 402b066996251f74faa5002a58a42935
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,52 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 15003, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: New Windows Profile
|
||||
m_EditorClassIdentifier:
|
||||
m_AssetVersion: 1
|
||||
m_BuildTarget: 19
|
||||
m_Subtarget: 2
|
||||
m_PlatformId: 4e3c793746204150860bf175a9a41a05
|
||||
m_PlatformBuildProfile:
|
||||
rid: 8495471767982702592
|
||||
m_OverrideGlobalSceneList: 0
|
||||
m_Scenes:
|
||||
- m_enabled: 1
|
||||
m_path: Assets/Scenes/main.unity
|
||||
- m_enabled: 1
|
||||
m_path: Assets/AssetRaw/Scenes/scene_arTest.unity
|
||||
m_ScriptingDefines: []
|
||||
m_PlayerSettingsYaml:
|
||||
m_Settings: []
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 8495471767982702592
|
||||
type: {class: WindowsPlatformSettings, ns: UnityEditor.WindowsStandalone, asm: UnityEditor.WindowsStandalone.Extensions}
|
||||
data:
|
||||
m_Development: 0
|
||||
m_ConnectProfiler: 0
|
||||
m_BuildWithDeepProfilingSupport: 0
|
||||
m_AllowDebugging: 0
|
||||
m_WaitForManagedDebugger: 0
|
||||
m_ManagedDebuggerFixedPort: 0
|
||||
m_ExplicitNullChecks: 0
|
||||
m_ExplicitDivideByZeroChecks: 0
|
||||
m_ExplicitArrayBoundsChecks: 0
|
||||
m_CompressionType: 0
|
||||
m_InstallInBuildFolder: 0
|
||||
m_WindowsBuildAndRunDeployTarget: 0
|
||||
m_Architecture: 0
|
||||
m_CreateSolution: 0
|
||||
m_CopyPDBFiles: 0
|
||||
m_WindowsDevicePortalAddress:
|
||||
m_WindowsDevicePortalUsername:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d686ef185f5cd2429fdfb84681d0713
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -11,6 +11,9 @@ EditorBuildSettings:
|
||||
- enabled: 1
|
||||
path: Assets/AssetRaw/Scenes/scene_arTest.unity
|
||||
guid: 666dbea7feb88644c8b8ae858ca278ae
|
||||
- enabled: 1
|
||||
path: Assets/AssetRaw/Scenes/ARGame/Snack.unity
|
||||
guid: 429eee27bf9fcd14d82b7b95f9668fb2
|
||||
m_configObjects:
|
||||
AR Foundation RemoteARFoundationRemoteLoaderSettings: {fileID: 11400000, guid: f14fc17ac2a466f4e96561ec973674db, type: 2}
|
||||
AR Foundation RemoteARFoundationRemoteSessionRecordsData: {fileID: 11400000, guid: 223d99c2357a28b47aae9876795f4641, type: 2}
|
||||
|
@ -21,20 +21,20 @@ EditorUserSettings:
|
||||
value: 0705000004570c59555b097112770d40144f41722f7d7e652f7c1f66e6b5646a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 57030d0300505b0c0f08552413270e44124f4a287b2a7f652b704b65bae6366a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 0606035f5c515b0d0e0a5a7213265d44414e1d2c2f782734782b4432b3e66d3b
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-6:
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 5604515e00500c0c5b5b582116765a44414f1e7c757025357b2d1b6bbab8373d
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-7:
|
||||
RecentlyUsedSceneGuid-6:
|
||||
value: 0003505352045a0855595b27122759444015487f2f7177327f2a4461b4b76469
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-8:
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 07045553540d0c025c590a2113250c44434e1b292d7971627e284b6be1b9616b
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-8:
|
||||
value: 57030d0300505b0c0f08552413270e44124f4a287b2a7f652b704b65bae6366a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-9:
|
||||
value: 02500105010d500359565b7616225a44474e4c7d7b2c27337b7f4d31b1b8666f
|
||||
flags: 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user