19 Commits
Author SHA1 Message Date
ThomasCharester dfe5f7ce36 Merge remote-tracking branch 'origin/movement-dev' into dev 2025-11-12 19:12:25 +03:00
ThomasCharester 0f8a629e4b Перекинул энтерстейт 2025-11-08 18:06:12 +03:00
ThomasCharester d861e06caf Фикс утечки памяти. Первой наверное... 2025-11-03 12:54:45 +03:00
ThomasCharester f940cbffe0 Теперь Addressables и UniTask в InstantiateAsync и прочих процессах 2025-11-03 12:31:26 +03:00
ThomasCharester 6b1f24b72e Addressables in process 2025-11-02 23:29:29 +03:00
ThomasCharester 1ad87e7432 Unitask добавлен 2025-11-02 18:02:45 +03:00
ThomasCharester 09219d9091 Этот интерфейс... Добавил инструменты и заготовки 2025-11-02 17:31:45 +03:00
ThomasCharester 37f5d15410 Диспетчер в процессе 2025-11-01 11:34:34 +03:00
ThomasCharester 019da8cfd3 Экран смерти, смерть, бабки, Интерфейс, Шлюхи 2025-11-01 01:45:46 +03:00
ThomasCharester edf3821c0d Межинтерфейс 2025-11-01 00:54:24 +03:00
ThomasCharester 45fe19be24 Интерфейс в процессе 2025-10-31 23:19:16 +03:00
ThomasCharester bea109175b Допил интерфейса, здоровья, денег 2025-10-30 21:13:42 +03:00
MrTorex b214bb0f63 Инишиал механика наклона при залазании на стены
Нуждается в доработке (как минимум чтобы вращалось в правильную сторону), но вроде-как выглядит прикольно
2025-10-29 20:09:39 +03:00
ThomasCharester 0ac5ba1e1c Интерфейс прокачан 2025-10-29 20:06:37 +03:00
ThomasCharester ab9d444072 Система здоровья 2025-10-29 16:02:05 +03:00
ThomasCharester 2335908a90 Какие штуки 2025-10-29 16:01:46 +03:00
ThomasCharester ae76edb0d0 Сделан сервис UI и заготовки панелек 2025-10-29 16:01:18 +03:00
ThomasCharester 6f2b063700 Небольшой фикс инфраструктуры 2025-10-29 15:57:27 +03:00
ThomasCharester c6d1c3bffd Static camera state, Scene environments 2025-10-29 14:13:09 +03:00
317 changed files with 83416 additions and 148 deletions

No files matched your search

@@ -0,0 +1,16 @@
%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: 11500000, guid: dea69d41f90c6ea4fa55c27c1d60c145, type: 3}
m_Name: AddressableAssetGroupSortSettings
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.AddressableAssetGroupSortSettings
sortOrder:
- d447fc60305c17a17bf20948ab295a45
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 88c15d5f41d582974a9b7218c493e4a7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: d447fc60305c17a17bf20948ab295a45 m_DefaultGroup: d447fc60305c17a17bf20948ab295a45
m_currentHash: m_currentHash:
serializedVersion: 2 serializedVersion: 2
Hash: 44f191e9f235d5420c20a51f93ead7da Hash: 90c715b85c1e0904b3dc61a9ed460206
m_OptimizeCatalogSize: 0 m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 0 m_BuildRemoteCatalog: 0
m_CatalogRequestsTimeout: 0 m_CatalogRequestsTimeout: 0
@@ -54,7 +54,7 @@ MonoBehaviour:
m_Id: m_Id:
m_RemoteCatalogLoadPath: m_RemoteCatalogLoadPath:
m_Id: m_Id:
m_ContentStateBuildPathProfileVariableName: m_ContentStateBuildPathProfileVariableName: <default settings path>
m_CustomContentStateBuildPath: m_CustomContentStateBuildPath:
m_ContentStateBuildPath: m_ContentStateBuildPath:
m_BuildAddressablesWithPlayerBuild: 0 m_BuildAddressablesWithPlayerBuild: 0
@@ -14,7 +14,32 @@ MonoBehaviour:
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
m_GroupName: Default Local Group m_GroupName: Default Local Group
m_GUID: d447fc60305c17a17bf20948ab295a45 m_GUID: d447fc60305c17a17bf20948ab295a45
m_SerializeEntries: [] m_SerializeEntries:
- m_GUID: 23e11d2c8a4f12f4ea9a7a43d1118464
m_Address: Gameplay
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 48aebfe8826dc0df79d047b5afbf8f5b
m_Address: Canvas
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: b2e8dc2aeb0311cd8a826b51cf8e94dc
m_Address: GameOver
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: c566fc932edefbbee9e53271eac3c560
m_Address: MainMenu
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f23b9fce9594618e5b75845f1cae50de
m_Address: LoadingScreen
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0 m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2} m_Settings: {fileID: 11400000, guid: 2588e84eb64800d0781c574a37fa48d8, type: 2}
m_SchemaSet: m_SchemaSet:
@@ -0,0 +1,12 @@
using Code.App.StateMachine;
using Code.StateMachine;
namespace Code.App.AppStates
{
public class BootstrapState : BaseState<AppStateMachineContext>
{
public BootstrapState(AppStateMachineContext context) : base(context)
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0183e73a08c64332babded3df3d06b95
timeCreated: 1762122962
@@ -1,5 +1,8 @@
using Code.App.StateMachine; using Code.App.StateMachine;
using Code.Scenes;
using Code.StateMachine; using Code.StateMachine;
using Code.UI;
using UnityEngine;
namespace Code.App.AppStates namespace Code.App.AppStates
{ {
@@ -8,16 +11,31 @@ namespace Code.App.AppStates
public GameOverState(AppStateMachineContext context) : base(context) public GameOverState(AppStateMachineContext context) : base(context)
{ } { }
private float damnTimer = 3f; // TODO Удалить при первой возможности
public override void EnterState() public override void EnterState()
{ {
Context.UIService.SwitchPanelTo(UIPanel.GameOver);
base.EnterState(); base.EnterState();
} }
public override void Tick() private void ToMainMenu()
{ } {
Context.StateMachine.SwitchState(AppState.MainMenu)
.AllowStateTransition(AppState.Gameplay);
}
public override void Tick()
{
damnTimer -= Time.deltaTime;
if (damnTimer <= float.Epsilon) ToMainMenu();
}
public override void ExitState() public override void ExitState()
{ {
damnTimer = 5f;
Context.UIService.LoadingScreen.Show();
base.ExitState(); base.ExitState();
} }
} }
@@ -1,13 +1,20 @@
using Code.App.StateMachine; using Code.App.StateMachine;
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Player;
using Code.Input; using Code.Input;
using Code.Scenes; using Code.Scenes;
using Code.StateMachine; using Code.StateMachine;
using Code.UI;
using UnityEngine.InputSystem;
namespace Code.App.AppStates namespace Code.App.AppStates
{ {
public class GameplayState : BaseState<AppStateMachineContext> public class GameplayState : BaseState<AppStateMachineContext>
{ {
private PlayerHealth _playerHealth;
private PlayerMoney _playerMoney;
private bool _uiLoaded, _sceneLoaded;
public GameplayState(AppStateMachineContext context) : base(context) public GameplayState(AppStateMachineContext context) : base(context)
{ {
@@ -15,26 +22,94 @@ namespace Code.App.AppStates
public override void EnterState() public override void EnterState()
{ {
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded); _uiLoaded = _sceneLoaded = false;
Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson); Context.UIService.LoadingScreen.Show();
_playerMoney = Context.PlayerFactory.CreatePlayerMoney();
_playerHealth = Context.PlayerFactory.CreatePlayerHealth();
_playerHealth.OnDeath += EndGame;
Context.SceneLoaderService.LoadSceneAsync((int)SceneIds.MovementDev, callBack: OnSceneLoaded); // TODO Фабрика игрока Nada
Context.UIService.SwitchPanelTo(UIPanel.Gameplay, callback: PostUILoaded);
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.GiveHealth, GiveHealth);
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.GiveMoney, GiveMoney);
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseHealth, LooseHealth);
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.LooseMoney, LooseMoney);
} }
private void SceneLoaded() private void OnSceneLoaded()
{ {
_sceneLoaded = true;
CheckIfLoaded();
}
base.EnterState(); private void PostUILoaded()
{
((GameplayPanel)Context.UIService.CurrentPanel).Initialize(_playerMoney, _playerHealth);
_uiLoaded = true;
CheckIfLoaded();
}
private void CheckIfLoaded()
{
if(!_uiLoaded || !_sceneLoaded) return;
Context.UIService.LoadingScreen.Hide();
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
Context.InputService.EnableMap(ActionMappings.Gameplay);
}
// Debug
private void GiveHealth(InputAction.CallbackContext context)
{
_playerHealth.GetDamage(-1);
}
private void LooseHealth(InputAction.CallbackContext context)
{
_playerHealth.GetDamage(1);
}
private void GiveMoney(InputAction.CallbackContext context)
{
_playerMoney.GiveMoney(100);
((GameplayPanel)(Context.UIService.CurrentPanel)).SummonDispatcher();
}
private void LooseMoney(InputAction.CallbackContext context)
{
_playerMoney.LooseMoney(100);
((GameplayPanel)(Context.UIService.CurrentPanel)).CloseDispatcher();
} }
public override void Tick() public override void Tick()
{ {
} }
private void EndGame()
{
Context.StateMachine.SwitchState(AppState.GameOver)
.AllowStateTransition(AppState.MainMenu);
}
public override void ExitState() public override void ExitState()
{ {
_playerHealth = null;
_playerMoney = null;
Context.InputService.DisableMap(ActionMappings.Gameplay); Context.InputService.DisableMap(ActionMappings.Gameplay);
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.GiveHealth, GiveHealth);
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.GiveMoney, GiveHealth);
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.LooseHealth, LooseHealth);
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.LooseMoney, LooseMoney);
base.ExitState(); base.ExitState();
} }
} }
@@ -1,31 +1,88 @@
using Code.App.StateMachine; using Code.App.StateMachine;
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Camera.CameraStates;
using Code.Input; using Code.Input;
using Code.Scenes; using Code.Scenes;
using Code.Scenes.SceneEnvironments;
using Code.StateMachine; using Code.StateMachine;
using Code.UI;
using Reflex.Extensions;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Code.App.AppStates namespace Code.App.AppStates
{ {
public class MainMenuState : BaseState<AppStateMachineContext> public class MainMenuState : BaseState<AppStateMachineContext>
{ {
private bool _uiLoaded, _sceneLoaded;
public MainMenuState(AppStateMachineContext context) : base(context) public MainMenuState(AppStateMachineContext context) : base(context)
{ } {
}
public override void EnterState() public override void EnterState()
{ {
Context.SceneLoaderService.LoadScene((int)SceneIds.MainMenu, SceneLoaded); _uiLoaded = _sceneLoaded = false;
Context.InputService.EnableMap(ActionMappings.MainMenu);
Context.UIService.LoadingScreen.Show();
Context.SceneLoaderService.LoadSceneAsync((int)SceneIds.MainMenu, callBack: SceneLoaded);
Context.UIService.SwitchPanelTo(UIPanel.MainMenu, PostUILoaded);
Context.CameraStateMachine.SwitchState(CameraMode.Static); Context.CameraStateMachine.SwitchState(CameraMode.Static);
} }
private void PostUILoaded()
{
((MainMenuPanel)Context.UIService.CurrentPanel).startButton.onClick.AddListener(StartGame);
((MainMenuPanel)Context.UIService.CurrentPanel).exitButton.onClick.AddListener(ExitGame);
_uiLoaded = true;
CheckIfLoaded();
}
private void SceneLoaded() private void SceneLoaded()
{ {
var hui = ((MainMenuEnvironment)SceneManager.GetActiveScene()
.GetSceneContainer().Resolve<CurrentSceneEnvironment>());
((StaticState)Context.CameraStateMachine.CurrentBaseState).LookTarget =
hui.cameraTarget;
((BaseCameraState)Context.CameraStateMachine.CurrentBaseState).SetFollowTransform(hui.cameraPosition);
_sceneLoaded = true;
CheckIfLoaded();
}
private void CheckIfLoaded()
{
if(!_uiLoaded || !_sceneLoaded) return;
Context.UIService.LoadingScreen.Hide();
Context.InputService.EnableMap(ActionMappings.MainMenu);
base.EnterState(); base.EnterState();
} }
public override void Tick() public override void Tick()
{ } {
}
private void StartGame()
{
Context.StateMachine.SwitchState(AppState.Gameplay)
.AllowStateTransition(AppState.GameOver);
}
private void ExitGame()
{
Application.Quit();
}
public override void ExitState() public override void ExitState()
{ {
@@ -15,7 +15,7 @@ namespace Code.App.AppStates
public override void EnterState() public override void EnterState()
{ {
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded); // Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
Context.InputService.EnableMap(ActionMappings.Gameplay); Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson); Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
@@ -1,19 +1,25 @@
using System.Threading.Tasks;
using Code.App.StateMachine; using Code.App.StateMachine;
using Code.Configs; using Code.Configs;
using Code.Constants;
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Player;
using Code.Input; using Code.Input;
using Code.Scenes; using Code.Scenes;
using Code.StaticData; using Code.StaticData;
using Code.UI;
using Code.UI.Panels;
using Cysharp.Threading.Tasks;
using Reflex.Core; using Reflex.Core;
using Reflex.Injectors; using Reflex.Injectors;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
namespace Code.App namespace Code.App
{ {
public class BootstrapInstaller : MonoBehaviour, IInstaller public class BootstrapInstaller : MonoBehaviour, IInstaller
{ {
public void InstallBindings(ContainerBuilder containerBuilder) public void InstallBindings(ContainerBuilder containerBuilder)
{ {
InstallStaticData(containerBuilder, out IStaticDataService staticDataService); InstallStaticData(containerBuilder, out IStaticDataService staticDataService);
@@ -21,9 +27,11 @@ namespace Code.App
InstallInfrastructureUnit(containerBuilder, staticDataService); InstallInfrastructureUnit(containerBuilder, staticDataService);
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService)); containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
containerBuilder.AddSingleton(typeof(PlayerFactory), typeof(IPlayerFactory));
InitializeCamera(containerBuilder, staticDataService); InitializeCamera(containerBuilder, staticDataService);
containerBuilder.AddSingleton(typeof(UIFactory), typeof(IUIFactory));
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService)); containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
containerBuilder.OnContainerBuilt += Bootstrap; containerBuilder.OnContainerBuilt += Bootstrap;
@@ -31,11 +39,8 @@ namespace Code.App
private void InitializeCamera(ContainerBuilder containerBuilder, IStaticDataService staticDataService) private void InitializeCamera(ContainerBuilder containerBuilder, IStaticDataService staticDataService)
{ {
// CameraService cameraService = Instantiate(staticDataService.CameraConfig.cameraPrefab);
// containerBuilder.AddSingleton(cameraService);
// DontDestroyOnLoad(cameraService);
Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab); Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab);
DontDestroyOnLoad(camera); DontDestroyOnLoad(camera);
containerBuilder.AddSingleton(camera); containerBuilder.AddSingleton(camera);
} }
@@ -46,7 +51,7 @@ namespace Code.App
DontDestroyOnLoad(infrastructureUnit); DontDestroyOnLoad(infrastructureUnit);
containerBuilder.AddSingleton(infrastructureUnit); containerBuilder.AddSingleton(infrastructureUnit);
containerBuilder.AddSingleton(infrastructureUnit.GetComponent<ICoroutineRunner>(), containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CoroutineRunner>(),
typeof(ICoroutineRunner)); typeof(ICoroutineRunner));
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<AppStateMachine>()); containerBuilder.AddSingleton(infrastructureUnit.AddComponent<AppStateMachine>());
containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CameraStateMachine>()); containerBuilder.AddSingleton(infrastructureUnit.AddComponent<CameraStateMachine>());
@@ -59,25 +64,43 @@ namespace Code.App
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService)); containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset)); containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
containerBuilder.AddSingleton(staticDataService.InputConfig, typeof(InputConfig));
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig)); containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
containerBuilder.AddSingleton(staticDataService.PlayerConfig, typeof(PlayerConfig));
containerBuilder.AddSingleton(staticDataService.CharacterConfig, typeof(CharacterConfig)); containerBuilder.AddSingleton(staticDataService.CharacterConfig, typeof(CharacterConfig));
containerBuilder.AddSingleton(staticDataService.UIConfig, typeof(UIConfig));
// containerBuilder.AddSingleton(staticDataService.UIConfig.canvasPrefab, typeof(Canvas));
// containerBuilder.AddSingleton(staticDataService.UIConfig.uiElementsPrefabs, typeof(UIElement[]));
} }
private bool _onUiLoaded;
private AppStateMachine _appStateMachine;
private void Bootstrap(Container container) private void Bootstrap(Container container)
{ {
AppStateMachine appStateMachine = container.Resolve<AppStateMachine>(); _appStateMachine = container.Resolve<AppStateMachine>();
appStateMachine.Initialize(); _appStateMachine.Initialize();
AttributeInjector.Inject(_appStateMachine.StateMachineContext, container);
AttributeInjector.Inject(appStateMachine.StateMachineContext, container);
CameraStateMachine cameraStateMachine = container.Resolve<CameraStateMachine>(); CameraStateMachine cameraStateMachine = container.Resolve<CameraStateMachine>();
AttributeInjector.Inject(cameraStateMachine.StateMachineContext, container); AttributeInjector.Inject(cameraStateMachine.StateMachineContext, container);
cameraStateMachine.Initialize(); cameraStateMachine.Initialize();
var loadingScreen = GameObject.FindWithTag(Tags.LoadingScreen);
DontDestroyOnLoad(loadingScreen);
IUIService uiService = container.Resolve<IUIService>();
uiService.Initialize(loadingScreen.GetComponent<LoadingScreen>());
TryStartGame();
}
private void TryStartGame()
{
// TODO: поменяно для теста // TODO: поменяно для теста
appStateMachine _appStateMachine
.SwitchState(AppState.MovementDev); .SwitchState(AppState.MainMenu)
.AllowStateTransition(AppState.Gameplay);
} }
} }
} }
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c7a271c6319540abb78d561f392e1396
timeCreated: 1761743570
@@ -0,0 +1,26 @@
using Code.Scenes;
using Code.Scenes.SceneEnvironments;
using Reflex.Core;
using UnityEngine;
namespace Code.App.SceneInstallers
{
public class MainMenuSceneInstaller : MonoBehaviour, IInstaller
{
[SerializeField] private MainMenuEnvironment _mainMenuEnvironment;
public void InstallBindings(ContainerBuilder containerBuilder)
{
containerBuilder.AddScoped(typeof(MainMenuEnvironment), typeof(CurrentSceneEnvironment));
containerBuilder.OnContainerBuilt += Initialize;
}
private void Initialize(Container container)
{
MainMenuEnvironment env = (MainMenuEnvironment)container.Resolve<CurrentSceneEnvironment>();
env.TransitVariables(_mainMenuEnvironment);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 04145a046c584b66818ca25745652e66
timeCreated: 1761743587
@@ -7,6 +7,7 @@ namespace Code.App.StateMachine
{ {
public override void Initialize() public override void Initialize()
{ {
States.Add(AppState.Bootstrap, new BootstrapState(StateMachineContext));
States.Add(AppState.MainMenu, new MainMenuState(StateMachineContext)); States.Add(AppState.MainMenu, new MainMenuState(StateMachineContext));
States.Add(AppState.Gameplay, new GameplayState(StateMachineContext)); States.Add(AppState.Gameplay, new GameplayState(StateMachineContext));
States.Add(AppState.GameOver, new GameOverState(StateMachineContext)); States.Add(AppState.GameOver, new GameOverState(StateMachineContext));
@@ -16,6 +17,8 @@ namespace Code.App.StateMachine
AllowedStates |= AppState.MainMenu; AllowedStates |= AppState.MainMenu;
AllowedStates |= AppState.Gameplay; AllowedStates |= AppState.Gameplay;
AllowedStates |= AppState.MovementDev; AllowedStates |= AppState.MovementDev;
CurrentBaseState = States[AppState.Bootstrap];
} }
protected override bool CheckTransitionAllowed(AppState nextState) => AllowedStates.HasFlag(nextState); protected override bool CheckTransitionAllowed(AppState nextState) => AllowedStates.HasFlag(nextState);
@@ -1,15 +1,19 @@
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Player;
using Code.Input; using Code.Input;
using Code.Scenes; using Code.Scenes;
using Code.UI;
using Reflex.Attributes; using Reflex.Attributes;
namespace Code.App.StateMachine namespace Code.App.StateMachine
{ {
public class AppStateMachineContext public class AppStateMachineContext
{ {
[Inject] public ISceneLoaderService SceneLoaderService; [Inject] public ISceneLoaderService SceneLoaderService { get; private set; }
[Inject] public IInputService InputService; [Inject] public IInputService InputService { get; private set; }
[Inject] public AppStateMachine StateMachine; [Inject] public AppStateMachine StateMachine { get; private set; }
[Inject] public CameraStateMachine CameraStateMachine; [Inject] public CameraStateMachine CameraStateMachine { get; private set; }
[Inject] public IUIService UIService { get; private set; }
[Inject] public IPlayerFactory PlayerFactory { get; private set; }
} }
} }
@@ -2,7 +2,7 @@ using UnityEngine;
namespace Code.Configs namespace Code.Configs
{ {
[CreateAssetMenu(menuName = "Config/AppConfig", fileName = "AppConfig")] [CreateAssetMenu(menuName = "Config/App", fileName = "AppConfig")]
public class AppConfig : ScriptableObject public class AppConfig : ScriptableObject
{ {
public GameObject infrastructureUnitPrefab; public GameObject infrastructureUnitPrefab;
@@ -1,4 +1,5 @@
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Configs namespace Code.Configs
{ {
@@ -0,0 +1,10 @@
using UnityEngine;
namespace Code.Configs
{
[CreateAssetMenu(menuName = "Config/Player", fileName = "PlayerConfig")]
public class PlayerConfig : ScriptableObject
{
public int maxHealth;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 425c2ad28dbe4552acd1564f64372558
timeCreated: 1761591274
@@ -0,0 +1,12 @@
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Configs
{
[CreateAssetMenu(menuName = "Config/UI", fileName = "UIConfig")]
public class UIConfig : ScriptableObject
{
public AssetReference[] uiPanelsAssetReferences;
public AssetReference canvasAssetReference;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: feaa36c74e094e0aa24b3983957a6e4e
timeCreated: 1761591380
@@ -6,4 +6,8 @@ namespace Code.Constants
public const string ConfigMultiple = "Configs/{0}"; public const string ConfigMultiple = "Configs/{0}";
} }
public static class Tags
{
public const string LoadingScreen = "LoadingScreen";
}
} }
+6 -1
View File
@@ -1,3 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e4901b413afd4d7da914edf2a1e51f8f guid: e4901b413afd4d7da914edf2a1e51f8f
timeCreated: 1760627936 folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -12,6 +12,8 @@ namespace Code.Gameplay.Camera
States.Add(CameraMode.Static, new StaticState(StateMachineContext)); States.Add(CameraMode.Static, new StaticState(StateMachineContext));
States.Add(CameraMode.FirstPerson, new FirstPersonState(StateMachineContext)); States.Add(CameraMode.FirstPerson, new FirstPersonState(StateMachineContext));
States.Add(CameraMode.ThirdPerson, new ThirdPersonState(StateMachineContext)); States.Add(CameraMode.ThirdPerson, new ThirdPersonState(StateMachineContext));
CurrentBaseState = States[CameraMode.Static];
} }
@@ -113,7 +113,8 @@ namespace Code.Gameplay.Camera.CameraStates
protected abstract void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation); protected abstract void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation);
// Обработка вращения камеры на основе пользовательского ввода // Обработка вращения камеры на основе пользовательского ввода
protected void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation) // Теперь виртуальный, чтобы статический режим мог работать как хочет
protected virtual void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
{ {
// Вращение вокруг вертикальной оси (горизонтальный поворот) // Вращение вокруг вертикальной оси (горизонтальный поворот)
var rotationFromInput = Quaternion.Euler(FollowTransform.up * (rotationInput.x * RotationSpeed)); var rotationFromInput = Quaternion.Euler(FollowTransform.up * (rotationInput.x * RotationSpeed));
@@ -4,8 +4,7 @@ namespace Code.Gameplay.Camera.CameraStates
{ {
public class StaticState : BaseCameraState, ICameraState public class StaticState : BaseCameraState, ICameraState
{ {
private Transform _target; public Transform LookTarget;
private Transform _position;
public StaticState(CameraStateMachineContext context) : base(context) { } public StaticState(CameraStateMachineContext context) : base(context) { }
public override void EnterState() public override void EnterState()
@@ -16,12 +15,16 @@ namespace Code.Gameplay.Camera.CameraStates
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation) protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
{ {
throw new System.NotImplementedException(); Camera.transform.position = FollowTransform.position;
} }
public CameraMode GetCameraMode() public CameraMode GetCameraMode() => CameraMode.Static;
protected override void HandleRotationInput(float deltaTime, Vector3 rotationInput,
out Quaternion targetRotation)
{ {
return CameraMode.Static; if(LookTarget) Camera.transform.LookAt(LookTarget);
targetRotation = Camera.transform.rotation;
} }
} }
} }
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 58441fe5bc46071fab2546105689c70b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
namespace Code.Gameplay.Player
{
public interface IPlayerFactory
{
PlayerHealth CreatePlayerHealth(int count = -1);
PlayerMoney CreatePlayerMoney(int count = 0);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6d2689e8fb7e48a4a8a62a97d292e1e3
timeCreated: 1761761977
@@ -0,0 +1,19 @@
using UnityEngine;
using Code.Configs;
using Reflex.Attributes;
namespace Code.Gameplay.Player
{
public class PlayerFactory : IPlayerFactory
{
[Inject] PlayerConfig _playerConfig;
public PlayerHealth CreatePlayerHealth(int count = -1)
{
if (count < 0) count = _playerConfig.maxHealth;
return new(count);
}
public PlayerMoney CreatePlayerMoney(int count = 0) => new(count);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 77dd77e7e8714974a7c8bc83772e52fa
timeCreated: 1761060390
@@ -0,0 +1,32 @@
namespace Code.Gameplay.Player
{
public class PlayerHealth
{
public delegate void OnDeathDelegate();
public event OnDeathDelegate OnDeath;
public delegate void OnDamageDelegate(int damage, PlayerHealth health);
public event OnDamageDelegate OnDamage;
private int _healthPoints;
public int HealthPoints => _healthPoints;
public int MaxHealthPoints { get; private set; }
public void GetDamage(int count)
{
_healthPoints -= count;
OnDamage?.Invoke(count, this);
if (_healthPoints <= 0) OnDeath?.Invoke();
}
public PlayerHealth(int maxHealthPoints = 1)
{
_healthPoints = maxHealthPoints;
MaxHealthPoints = maxHealthPoints;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3873d746bf1595618802b853c6920616
@@ -0,0 +1,26 @@
namespace Code.Gameplay.Player
{
public class PlayerMoney
{
public delegate void OnMoneyGetDelegate(int count, int money);
public event OnMoneyGetDelegate OnMoneyGet;
public delegate void OnMoneyLooseDelegate(int count, int money);
public event OnMoneyLooseDelegate OnMoneyLoose;
private int _money;
public int Money => _money;
public void GiveMoney(int amount)
{
_money += amount;
OnMoneyGet?.Invoke(amount, _money);
}
public void LooseMoney(int amount)
{
_money -= amount;
OnMoneyLoose?.Invoke(amount, _money);
}
public PlayerMoney(int money) => _money = money;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 455b08dd38eb4f4f8ab62b9493cd5e12
timeCreated: 1761760097
@@ -4,6 +4,7 @@ namespace Code.Input
{ {
MainMenu, MainMenu,
UI, UI,
Gameplay Gameplay,
Debug
} }
} }
@@ -6,4 +6,11 @@ namespace Code.Input
Look, Look,
Zoom Zoom
} }
public enum DebugActions
{
GiveHealth,
LooseHealth,
GiveMoney,
LooseMoney
}
} }
@@ -1,4 +1,6 @@
using System;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
namespace Code.Input namespace Code.Input
{ {
@@ -19,5 +21,7 @@ namespace Code.Input
// Для переключения режима камеры // Для переключения режима камеры
bool ToggleCameraModePressed { get; } bool ToggleCameraModePressed { get; }
void DebugBindAction(int mapId, int actionId, Action<InputAction.CallbackContext> action);
void DebugUnbindAction(int mapId, int actionId, Action<InputAction.CallbackContext> action);
} }
} }
@@ -21,6 +21,8 @@ namespace Code.Input
{ {
_inputActionAsset = inputActionAsset; _inputActionAsset = inputActionAsset;
SetupInputCallbacks(); SetupInputCallbacks();
inputActionAsset.actionMaps[(int)ActionMappings.Debug].Enable();
} }
// Обработка всех карт ввода // Обработка всех карт ввода
@@ -165,10 +167,10 @@ namespace Code.Input
public void EnableMap(ActionMappings actionMap) => _inputActionAsset.actionMaps[(int)actionMap].Enable(); public void EnableMap(ActionMappings actionMap) => _inputActionAsset.actionMaps[(int)actionMap].Enable();
public void DisableMap(ActionMappings actionMap) => _inputActionAsset.actionMaps[(int)actionMap].Disable(); public void DisableMap(ActionMappings actionMap) => _inputActionAsset.actionMaps[(int)actionMap].Disable();
public void BindAction(int mapId, int actionId, Action<InputAction.CallbackContext> action) => _inputActionAsset public void DebugBindAction(int mapId, int actionId, Action<InputAction.CallbackContext> action) => _inputActionAsset
.actionMaps[mapId].actions[actionId].performed += action; .actionMaps[mapId].actions[actionId].performed += action;
public void UnbindAction(int mapId, int actionId, Action<InputAction.CallbackContext> action) => public void DebugUnbindAction(int mapId, int actionId, Action<InputAction.CallbackContext> action) =>
_inputActionAsset _inputActionAsset
.actionMaps[mapId].actions[actionId].performed -= action; .actionMaps[mapId].actions[actionId].performed -= action;
@@ -0,0 +1,9 @@
using UnityEngine;
namespace Code.Scenes
{
public abstract class CurrentSceneEnvironment
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e67772183eee40b0bd3ca806dae98f20
timeCreated: 1761736090
@@ -1,10 +1,11 @@
using System; using System;
using Cysharp.Threading.Tasks;
namespace Code.Scenes namespace Code.Scenes
{ {
public interface ISceneLoaderService public interface ISceneLoaderService
{ {
void LoadScene(string sceneName, Action callback = null, float waitFor = 0f); UniTaskVoid LoadSceneAsync(string sceneName, float waitFor = 0f, Action callBack = null);
void LoadScene(int sceneId, Action callback = null, float waitFor = 0f); UniTaskVoid LoadSceneAsync(int sceneId, float waitFor = 0f, Action callBack = null);
} }
} }
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a1364bdc4fb54b40843a614990de89ad
timeCreated: 1761736163
@@ -0,0 +1,18 @@
using UnityEngine;
using UnityEngine.Serialization;
namespace Code.Scenes.SceneEnvironments
{
[System.Serializable]
public class MainMenuEnvironment : CurrentSceneEnvironment
{
public Transform cameraTarget;
public Transform cameraPosition;
public void TransitVariables(MainMenuEnvironment env)
{
cameraTarget = env.cameraTarget;
cameraPosition = env.cameraPosition;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2e7be1a504f64b20ac431e6e231c1f70
timeCreated: 1761736177
@@ -6,6 +6,7 @@ namespace Code.Scenes
MainMenu, MainMenu,
Gameplay, Gameplay,
// TODO: поменяно для теста // TODO: поменяно для теста
MovementDev MovementDev,
DevGen
} }
} }
@@ -1,46 +1,33 @@
using System; using System;
using System.Collections; using Cysharp.Threading.Tasks;
using Code.App;
using Reflex.Attributes;
using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
namespace Code.Scenes namespace Code.Scenes
{ {
public class SceneLoaderService : ISceneLoaderService public class SceneLoaderService : ISceneLoaderService
{ {
[Inject] private ICoroutineRunner _coroutineRunner; public async UniTaskVoid LoadSceneAsync(string sceneName, float waitFor = 0f, Action callBack = null)
public void LoadScene(string sceneName, Action callback = null, float waitFor = 0f) =>
_coroutineRunner.StartCoroutine(LoadSceneAsync(sceneName, callback, waitFor));
public void LoadScene(int sceneId, Action callback = null, float waitFor = 0f) =>
_coroutineRunner.StartCoroutine(LoadSceneAsync(sceneId, callback, waitFor));
private IEnumerator LoadSceneAsync(string sceneName, Action callback = null, float waitFor = 0f)
{ {
if (waitFor > 0f) // if (waitFor > 0f)
yield return new WaitForSeconds(waitFor); // yield return new WaitForSeconds(waitFor);
AsyncOperation waitNextScene = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single); // AsyncOperation waitNextScene = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
while (!waitNextScene.isDone) // while (!waitNextScene.isDone)
yield return null; // yield return null;
callback?.Invoke(); // callback?.Invoke();
await UniTask.Delay(TimeSpan.FromSeconds(waitFor));
await SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single).ToUniTask();
callBack?.Invoke();
} }
private IEnumerator LoadSceneAsync(int sceneId, Action callback = null, float waitFor = 0f) public async UniTaskVoid LoadSceneAsync(int sceneId, float waitFor = 0f, Action callBack = null)
{ {
if (waitFor > 0f) await UniTask.WhenAll(
yield return new WaitForSeconds(waitFor); UniTask.Delay(TimeSpan.FromSeconds(waitFor)),
SceneManager.LoadSceneAsync(sceneId, LoadSceneMode.Single).ToUniTask());
AsyncOperation waitNextScene = SceneManager.LoadSceneAsync(sceneId, LoadSceneMode.Single); callBack?.Invoke();
while (!waitNextScene.isDone)
yield return null;
callback?.Invoke();
} }
} }
} }
@@ -8,8 +8,8 @@ namespace Code.StateMachine
: MonoBehaviour : MonoBehaviour
where TStateMachineContext : new() where TStateMachineContext : new()
{ {
public TStateEnum CurrentState { get; private set; } public TStateEnum CurrentState { get; protected set; }
public BaseState<TStateMachineContext> CurrentBaseState { get; private set; } public BaseState<TStateMachineContext> CurrentBaseState { get; protected set; }
private BaseState<TStateMachineContext> _previousBaseState; private BaseState<TStateMachineContext> _previousBaseState;
protected Dictionary<TStateEnum, BaseState<TStateMachineContext>> States = new(); protected Dictionary<TStateEnum, BaseState<TStateMachineContext>> States = new();
@@ -37,11 +37,9 @@ namespace Code.StateMachine
{ {
if (!CheckTransitionAllowed(nextState)) if (!CheckTransitionAllowed(nextState))
{ {
Debug.LogError("TransitionNotAllowed");
return null; return null;
} }
Debug.Log("Entered " + nextState);
ResetAllowedTransitions(); ResetAllowedTransitions();
_previousBaseState = CurrentBaseState; _previousBaseState = CurrentBaseState;
@@ -1,5 +1,10 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using Code.Configs; using Code.Configs;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.StaticData namespace Code.StaticData
{ {
@@ -10,5 +15,8 @@ namespace Code.StaticData
AppConfig AppConfig { get; } AppConfig AppConfig { get; }
CameraConfig CameraConfig { get; } CameraConfig CameraConfig { get; }
CharacterConfig CharacterConfig { get; } CharacterConfig CharacterConfig { get; }
UIConfig UIConfig { get; }
PlayerConfig PlayerConfig { get; }
Task<T> InstantiateAsset<T>(AssetReference assetReference) where T : Behaviour;
} }
} }
@@ -1,6 +1,9 @@
using System.Threading.Tasks;
using Code.Configs; using Code.Configs;
using Code.Constants; using Code.Constants;
using Cysharp.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.StaticData namespace Code.StaticData
{ {
@@ -10,6 +13,8 @@ namespace Code.StaticData
public InputConfig InputConfig { get; private set; } public InputConfig InputConfig { get; private set; }
public CameraConfig CameraConfig { get; private set; } public CameraConfig CameraConfig { get; private set; }
public CharacterConfig CharacterConfig { get; private set; } public CharacterConfig CharacterConfig { get; private set; }
public UIConfig UIConfig { get; private set; }
public PlayerConfig PlayerConfig { get; private set; }
public void Load() public void Load()
{ {
@@ -17,6 +22,13 @@ namespace Code.StaticData
AppConfig = Resources.Load<AppConfig>(string.Format(StringPaths.ConfigSingle, "App", "AppConfig")); AppConfig = Resources.Load<AppConfig>(string.Format(StringPaths.ConfigSingle, "App", "AppConfig"));
CameraConfig = Resources.Load<CameraConfig>(string.Format(StringPaths.ConfigSingle, "App", "CameraConfig")); CameraConfig = Resources.Load<CameraConfig>(string.Format(StringPaths.ConfigSingle, "App", "CameraConfig"));
CharacterConfig = Resources.Load<CharacterConfig>(string.Format(StringPaths.ConfigSingle, "App", "CharacterConfig")); CharacterConfig = Resources.Load<CharacterConfig>(string.Format(StringPaths.ConfigSingle, "App", "CharacterConfig"));
UIConfig = Resources.Load<UIConfig>(string.Format(StringPaths.ConfigSingle, "App", "UIConfig"));
PlayerConfig = Resources.Load<PlayerConfig>(string.Format(StringPaths.ConfigSingle, "App", "PlayerConfig"));
}
public async Task<T> InstantiateAsset<T>(AssetReference assetReference) where T : Behaviour
{
return (await Addressables.InstantiateAsync(assetReference).ToUniTask()).GetComponent<T>();
} }
} }
} }
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: aca6d2360b0a4b35b124f6d6ffa10039
timeCreated: 1761577505
@@ -0,0 +1,11 @@
using Cysharp.Threading.Tasks;
using UnityEngine;
namespace Code.UI
{
public interface IUIFactory
{
UniTask<Canvas> CreateCanvas();
UniTask<UIElement> CreatePanel(Canvas canvas, UIPanel uiPanel);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 61892c4ae3ab4b1498c3df219c5c75d6
timeCreated: 1761922548
@@ -0,0 +1,13 @@
using System;
using Code.UI.Panels;
namespace Code.UI
{
public interface IUIService
{
void SwitchPanelTo(UIPanel uiPanel, Action callback = null);
UIElement CurrentPanel { get; }
LoadingScreen LoadingScreen { get; }
void Initialize(LoadingScreen loadingScreen);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5d5cb971e8da41a5885f37d1334ab26a
timeCreated: 1761591248
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e8f289dfee4b4bd4988d217b988ae82d
timeCreated: 1761951389
@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEngine.UI;
namespace Code.UI
{
public class GameOverPanel : UIElement
{
[SerializeField] private Image _background;
public override void Hide()
{
_background.enabled = false;
}
public override void Show()
{
_background.enabled = true;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ecbe291069244405ac22e5470f3ba62b
timeCreated: 1761948692
@@ -0,0 +1,66 @@
using Code.Gameplay.Player;
using DG.Tweening;
using TMPro;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace Code.UI
{
public class GameplayPanel : UIElement
{
[Header("Dispatcher")]
[SerializeField] private Image dispatcher;
[SerializeField] private RectTransform dispatcherHiddenPosition;
[SerializeField] private RectTransform dispatcherShownPosition;
[SerializeField] private float dispatcherTransitionTime = 0.5f;
[Header("Timer")]
[SerializeField] private TMP_Text timer;
[Header("HealthBar")]
[SerializeField] private Image healthBar;
[Header("MoneyBar")]
[SerializeField] private TMP_Text moneyText;
private void MoneyUpdate(int count, int money)
{
// TODO Анимация получения\потери
moneyText.text = money.ToString();
}
private void HealthUpdate(int count, PlayerHealth health)
{
// TODO Анимация потери
float fillAmount = (float)health.HealthPoints / health.MaxHealthPoints;
healthBar.fillAmount = fillAmount;
}
public void Initialize(PlayerMoney money, PlayerHealth health)
{
money.OnMoneyGet += MoneyUpdate;
money.OnMoneyLoose += MoneyUpdate;
MoneyUpdate(0,money.Money);
health.OnDamage += HealthUpdate;
HealthUpdate(0,health);
}
private void Update()
{
timer.text = Time.deltaTime.ToString();
}
public void SummonDispatcher()
{
// TODO
dispatcher.transform.DOMoveX(dispatcherShownPosition.position.x, dispatcherTransitionTime);
}
public void CloseDispatcher()
{
dispatcher.transform.DOMoveX(dispatcherHiddenPosition.position.x, dispatcherTransitionTime);
// TODO
}
public override void Hide()
{
}
public override void Show()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d79893d2e9024719924dc5c15d582e33
timeCreated: 1761760839
@@ -0,0 +1,22 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Code.UI.Panels
{
public class LoadingScreen : UIElement
{
[SerializeField] private Image background;
[SerializeField] private TMP_Text loadingTitle;
public override void Hide()
{
background.enabled = false;
loadingTitle.enabled = false;
}
public override void Show()
{
background.enabled = true;
loadingTitle.enabled = true;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8b4a0cb6cea947c6b085269973968c12
timeCreated: 1761594685
@@ -0,0 +1,18 @@
using UnityEngine;
using UnityEngine.UI;
namespace Code.UI
{
public class MainMenuPanel : UIElement
{
public Button startButton;
public Button exitButton;
public override void Show()
{
}
public override void Hide()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3257edb60d20461a92f3e5dd2c4afee4
timeCreated: 1761596135
@@ -0,0 +1,10 @@
using UnityEngine;
namespace Code.UI
{
public abstract class UIElement : MonoBehaviour
{
public abstract void Show();
public abstract void Hide();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b9af80648f8048e397791a856c682cce
timeCreated: 1761590528
@@ -0,0 +1,36 @@
using Code.Configs;
using Cysharp.Threading.Tasks;
using Reflex.Attributes;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using Object = UnityEngine.Object;
namespace Code.UI
{
public class UIFactory : IUIFactory
{
private AssetReference _canvasAssetReference;
private AssetReference[] _uiPanelsAssetReferences;
public UIFactory(UIConfig uiConfig)
{
_canvasAssetReference = uiConfig.canvasAssetReference;
_uiPanelsAssetReferences = uiConfig.uiPanelsAssetReferences;
}
public async UniTask<Canvas> CreateCanvas()
{
// Canvas canvasPrefab = await Addressables.LoadAssetAsync<Canvas>(_canvasAssetReference);
Canvas canvas = (await Addressables.InstantiateAsync(_canvasAssetReference).ToUniTask()).GetComponent<Canvas>();
Object.DontDestroyOnLoad(canvas);
return canvas;
}
public async UniTask<UIElement> CreatePanel(Canvas canvas, UIPanel uiPanel)
{
return (await Addressables.InstantiateAsync(_uiPanelsAssetReferences[(int)uiPanel], canvas.transform).ToUniTask()).GetComponent<UIElement>();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2250767e26ad4e0aa313b80087696ea9
timeCreated: 1761922359
+10
View File
@@ -0,0 +1,10 @@
namespace Code.UI
{
public enum UIPanel
{
Loading,
MainMenu,
Gameplay,
GameOver
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d93383e80e824e0db25252a7863af280
timeCreated: 1761578163
@@ -0,0 +1,44 @@
using System;
using System.Threading;
using Code.UI.Panels;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using Object = UnityEngine.Object;
namespace Code.UI
{
public class UIService : IUIService
{
private Canvas _canvas;
private IUIFactory _factory;
public UIElement CurrentPanel { get; private set; }
public LoadingScreen LoadingScreen { get; private set; }
public UIService(IUIFactory factory)
{
_factory = factory;
}
public async void Initialize(LoadingScreen loadingScreen)
{
LoadingScreen = loadingScreen;
LoadingScreen.Show();
_canvas = await _factory.CreateCanvas();
}
public async void SwitchPanelTo(UIPanel uiPanel, Action callback = null)
{
if (!_canvas) await UniTask.WaitUntil(() => _canvas );
if(CurrentPanel) Addressables.ReleaseInstance(CurrentPanel.gameObject);//Object.Destroy(CurrentPanel.gameObject);
CurrentPanel = await _factory.CreatePanel(_canvas, uiPanel);
callback?.Invoke();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 060152e7a2a2400f85c372c0b9f138a8
timeCreated: 1761577528
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 818f68f6dbb84d44d80bc53754eb6352
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e07037ec18739b44fb4040e9a19a8b2a
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 26b8dbfe064a19e4eb85bf9f0f2cd2a1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e67b7301aadd4a946a3c815ca954708a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,144 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>DOTweenEditor</name>
</assembly>
<members>
<member name="T:DG.DOTweenEditor.EditorCompatibilityUtils">
<summary>
Contains compatibility methods taken from DemiEditor (for when DOTween is without it)
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectOfType``1(System.Boolean)">
<summary>
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectOfType(System.Type,System.Boolean)">
<summary>
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectsOfType``1(System.Boolean)">
<summary>
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorCompatibilityUtils.FindObjectsOfType(System.Type,System.Boolean)">
<summary>
Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account
</summary>
</member>
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Start(System.Action)">
<summary>
Starts the update loop of tween in the editor. Has no effect during playMode.
</summary>
<param name="onPreviewUpdated">Eventual callback to call after every update</param>
</member>
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.Stop(System.Boolean,System.Boolean)">
<summary>
Stops the update loop and clears the onPreviewUpdated callback.
</summary>
<param name="resetTweenTargets">If TRUE also resets the tweened objects to their original state.
Note that this works by calling Rewind on all tweens, so it will work correctly
only if you have a single tween type per object and it wasn't killed</param>
<param name="clearTweens">If TRUE also kills any cached tween</param>
</member>
<member name="M:DG.DOTweenEditor.DOTweenEditorPreview.PrepareTweenForPreview(DG.Tweening.Tween,System.Boolean,System.Boolean,System.Boolean)">
<summary>
Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings.
</summary>
<param name="t">The tween to ready</param>
<param name="clearCallbacks">If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc)</param>
<param name="preventAutoKill">If TRUE prevents the tween from being auto-killed at completion</param>
<param name="andPlay">If TRUE starts playing the tween immediately</param>
</member>
<member name="F:DG.DOTweenEditor.EditorVersion.Version">
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
</member>
<member name="F:DG.DOTweenEditor.EditorVersion.MajorVersion">
<summary>Major version</summary>
</member>
<member name="F:DG.DOTweenEditor.EditorVersion.MinorVersion">
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.SetEditorTexture(UnityEngine.Texture2D,UnityEngine.FilterMode,System.Int32)">
<summary>
Checks that the given editor texture use the correct import settings,
and applies them if they're incorrect.
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.DOTweenSetupRequired">
<summary>
Returns TRUE if setup is required
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.AssetExists(System.String)">
<summary>
Returns TRUE if the file/directory at the given path exists.
</summary>
<param name="adbPath">Path, relative to Unity's project folder</param>
<returns></returns>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.ADBPathToFullPath(System.String)">
<summary>
Converts the given project-relative path to a full path,
with backward (\) slashes).
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.FullPathToADBPath(System.String)">
<summary>
Converts the given full path to a path usable with AssetDatabase methods
(relative to Unity's project folder, and with the correct Unity forward (/) slashes).
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.ConnectToSourceAsset``1(System.String,System.Boolean)">
<summary>
Connects to a <see cref="T:UnityEngine.ScriptableObject"/> asset.
If the asset already exists at the given path, loads it and returns it.
Otherwise, either returns NULL or automatically creates it before loading and returning it
(depending on the given parameters).
</summary>
<typeparam name="T">Asset type</typeparam>
<param name="adbFilePath">File path (relative to Unity's project folder)</param>
<param name="createIfMissing">If TRUE and the requested asset doesn't exist, forces its creation</param>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.GetAssemblyFilePath(System.Reflection.Assembly)">
<summary>
Full path for the given loaded assembly, assembly file included
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.AddGlobalDefine(System.String)">
<summary>
Adds the given global define if it's not already present
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.RemoveGlobalDefine(System.String)">
<summary>
Removes the given global define if it's present
</summary>
</member>
<member name="M:DG.DOTweenEditor.EditorUtils.HasGlobalDefine(System.String,System.Nullable{UnityEditor.BuildTargetGroup})">
<summary>
Returns TRUE if the given global define is present in all the <see cref="T:UnityEditor.BuildTargetGroup"/>
or only in the given <see cref="T:UnityEditor.BuildTargetGroup"/>, depending on passed parameters.<para/>
</summary>
<param name="id"></param>
<param name="buildTargetGroup"><see cref="T:UnityEditor.BuildTargetGroup"/>to use. Leave NULL to check in all of them.</param>
</member>
<member name="T:DG.DOTweenEditor.DOTweenDefines">
<summary>
Not used as menu item anymore, but as a utility function
</summary>
</member>
<member name="F:DG.DOTweenEditor.UnityEditorVersion.Version">
<summary>Full major version + first minor version (ex: 2018.1f)</summary>
</member>
<member name="F:DG.DOTweenEditor.UnityEditorVersion.MajorVersion">
<summary>Major version</summary>
</member>
<member name="F:DG.DOTweenEditor.UnityEditorVersion.MinorVersion">
<summary>First minor version (ex: in 2018.1 it would be 1)</summary>
</member>
</members>
</doc>
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c3a0d4ea64302bb4991712323bb30d9e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 94b982fba6cf0aa45bcdf01c3482d100
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 95b29595c168b71499bad9d6478e8197
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: b902d1eb53417de449e5bca5240aa270
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 1db1e959b7dc07649ac59e1c7893d491
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: d248ad19bd4cd6441903457017e9a89e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 256
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 303132c0f3de1ad41a12da103de7e06d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 2b04f9c855a815247965dd166a078a2e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 687808f6960389c42be607a9d0c85db8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,198 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true // MODULE_MARKER
using System;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
using UnityEngine.Audio; // Required for AudioMixer
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModuleAudio
{
#region Shortcuts
#region Audio
/// <summary>Tweens an AudioSource's volume to the given value.
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOFade(this AudioSource target, float endValue, float duration)
{
if (endValue < 0) endValue = 0;
else if (endValue > 1) endValue = 1;
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens an AudioSource's pitch to the given value.
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOPitch(this AudioSource target, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration);
t.SetTarget(target);
return t;
}
#endregion
#region AudioMixer
/// <summary>Tweens an AudioMixer's exposed float to the given value.
/// Also stores the AudioMixer as the tween's target so it can be used for filtered operations.
/// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer.</summary>
/// <param name="floatName">Name given to the exposed float to set</param>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
float currVal;
target.GetFloat(floatName, out currVal);
return currVal;
}, x=> target.SetFloat(floatName, x), endValue, duration);
t.SetTarget(target);
return t;
}
#region Operation Shortcuts
/// <summary>
/// Completes all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens completed
/// (meaning the tweens that don't have infinite loops and were not already complete)
/// </summary>
/// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,
/// otherwise they will be ignored</param>
public static int DOComplete(this AudioMixer target, bool withCallbacks = false)
{
return DOTween.Complete(target, withCallbacks);
}
/// <summary>
/// Kills all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens killed.
/// </summary>
/// <param name="complete">If TRUE completes the tween before killing it</param>
public static int DOKill(this AudioMixer target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
/// <summary>
/// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens flipped.
/// </summary>
public static int DOFlip(this AudioMixer target)
{
return DOTween.Flip(target);
}
/// <summary>
/// Sends to the given position all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
/// <param name="to">Time position to reach
/// (if higher than the whole tween duration the tween will simply reach its end)</param>
/// <param name="andPlay">If TRUE will play the tween after reaching the given position, otherwise it will pause it</param>
public static int DOGoto(this AudioMixer target, float to, bool andPlay = false)
{
return DOTween.Goto(target, to, andPlay);
}
/// <summary>
/// Pauses all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens paused.
/// </summary>
public static int DOPause(this AudioMixer target)
{
return DOTween.Pause(target);
}
/// <summary>
/// Plays all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlay(this AudioMixer target)
{
return DOTween.Play(target);
}
/// <summary>
/// Plays backwards all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayBackwards(this AudioMixer target)
{
return DOTween.PlayBackwards(target);
}
/// <summary>
/// Plays forward all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayForward(this AudioMixer target)
{
return DOTween.PlayForward(target);
}
/// <summary>
/// Restarts all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens restarted.
/// </summary>
public static int DORestart(this AudioMixer target)
{
return DOTween.Restart(target);
}
/// <summary>
/// Rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DORewind(this AudioMixer target)
{
return DOTween.Rewind(target);
}
/// <summary>
/// Smoothly rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DOSmoothRewind(this AudioMixer target)
{
return DOTween.SmoothRewind(target);
}
/// <summary>
/// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
public static int DOTogglePause(this AudioMixer target)
{
return DOTween.TogglePause(target);
}
#endregion
#endregion
#endregion
}
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1147dbe38997e96479427367869dcf4c
@@ -0,0 +1,146 @@
using UnityEngine;
#if false || EPO_DOTWEEN // MODULE_MARKER
using EPOOutline;
using DG.Tweening.Plugins.Options;
using DG.Tweening;
using DG.Tweening.Core;
namespace DG.Tweening
{
public static class DOTweenModuleEPOOutline
{
public static int DOKill(this SerializedPass target, bool complete)
{
return DOTween.Kill(target, complete);
}
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, string propertyName, float endValue, float duration)
{
var tweener = DOTween.To(() => target.GetFloat(propertyName), x => target.SetFloat(propertyName, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, string propertyName, float endValue, float duration)
{
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, string propertyName, Color endValue, float duration)
{
var tweener = DOTween.To(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, string propertyName, Vector4 endValue, float duration)
{
var tweener = DOTween.To(() => target.GetVector(propertyName), x => target.SetVector(propertyName, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<float, float, FloatOptions> DOFloat(this SerializedPass target, int propertyId, float endValue, float duration)
{
var tweener = DOTween.To(() => target.GetFloat(propertyId), x => target.SetFloat(propertyId, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOFade(this SerializedPass target, int propertyId, float endValue, float duration)
{
var tweener = DOTween.ToAlpha(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
public static TweenerCore<Color, Color, ColorOptions> DOColor(this SerializedPass target, int propertyId, Color endValue, float duration)
{
var tweener = DOTween.To(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static TweenerCore<Vector4, Vector4, VectorOptions> DOVector(this SerializedPass target, int propertyId, Vector4 endValue, float duration)
{
var tweener = DOTween.To(() => target.GetVector(propertyId), x => target.SetVector(propertyId, x), endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
public static int DOKill(this Outlinable.OutlineProperties target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
public static int DOKill(this Outliner target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
/// <summary>
/// Controls the alpha (transparency) of the outline
/// </summary>
public static TweenerCore<Color, Color, ColorOptions> DOFade(this Outlinable.OutlineProperties target, float endValue, float duration)
{
var tweener = DOTween.ToAlpha(() => target.Color, x => target.Color = x, endValue, duration);
tweener.SetOptions(true).SetTarget(target);
return tweener;
}
/// <summary>
/// Controls the color of the outline
/// </summary>
public static TweenerCore<Color, Color, ColorOptions> DOColor(this Outlinable.OutlineProperties target, Color endValue, float duration)
{
var tweener = DOTween.To(() => target.Color, x => target.Color = x, endValue, duration);
tweener.SetOptions(false).SetTarget(target);
return tweener;
}
/// <summary>
/// Controls the amount of blur applied to the outline
/// </summary>
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
/// <summary>
/// Controls the amount of blur applied to the outline
/// </summary>
public static TweenerCore<float, float, FloatOptions> DOBlurShift(this Outliner target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
/// <summary>
/// Controls the amount of dilation applied to the outline
/// </summary>
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
/// <summary>
/// Controls the amount of dilation applied to the outline
/// </summary>
public static TweenerCore<float, float, FloatOptions> DODilateShift(this Outliner target, float endValue, float duration, bool snapping = false)
{
var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration);
tweener.SetOptions(snapping).SetTarget(target);
return tweener;
}
}
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2cdcb9f1cd5d3f34d880e4d6cc33f685
@@ -0,0 +1,216 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
#if true // MODULE_MARKER
using System;
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins;
using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1591
namespace DG.Tweening
{
public static class DOTweenModulePhysics
{
#region Shortcuts
#region Rigidbody
/// <summary>Tweens a Rigidbody's position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
t.SetOptions(snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's X position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration);
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's Y position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration);
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's Z position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration);
t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
return t;
}
/// <summary>Tweens a Rigidbody's rotation to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>Tweens a Rigidbody's rotation so that it will look towards the given position.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
/// <param name="axisConstraint">Eventual axis constraint for the rotation</param>
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
{
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
t.plugOptions.axisConstraint = axisConstraint;
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
return t;
}
#region Special
/// <summary>Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = 0;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
Tween yTween = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
.OnStart(() => startPosY = target.position.y);
s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(yTween)
.SetTarget(target).SetEase(DOTween.defaultEaseType);
yTween.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
target.MovePosition(pos);
});
return s;
}
/// <summary>Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
/// If you plan to publish there you should use a regular transform.DOPath.</para></summary>
/// <param name="path">The waypoints to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, new Path(pathType, path, resolution, gizmoColor), duration)
.SetTarget(target).SetUpdate(UpdateType.Fixed);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
return t;
}
/// <summary>Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations
/// <para>NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened.</para>
/// <para>BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug).
/// If you plan to publish there you should use a regular transform.DOLocalPath.</para></summary>
/// <param name="path">The waypoint to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
Transform trans = target.transform;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path, resolution, gizmoColor), duration)
.SetTarget(target).SetUpdate(UpdateType.Fixed);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, path, duration)
.SetTarget(target);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
return t;
}
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
Transform trans = target.transform;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration)
.SetTarget(target);
t.plugOptions.isRigidbody = true;
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
#endregion
#endregion
#endregion
}
}
#endif
Loaded 100 of 317 files, more files were not shown because too many files have changed in this diff. Show more