init
This commit is contained in:
3
Assets/SzafaKit/Runtime.meta
Normal file
3
Assets/SzafaKit/Runtime.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bee7c50ad9834de5a8bc3b9e155b3e60
|
||||
timeCreated: 1740878541
|
||||
3
Assets/SzafaKit/Runtime/Console.meta
Normal file
3
Assets/SzafaKit/Runtime/Console.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d059b7f04b524c6fbd39c7b14af4a299
|
||||
timeCreated: 1740779746
|
||||
105
Assets/SzafaKit/Runtime/Console/CVar.cs
Normal file
105
Assets/SzafaKit/Runtime/Console/CVar.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using SzafaKit.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Console {
|
||||
public enum CVarKind {
|
||||
Int,
|
||||
Float,
|
||||
Vector2,
|
||||
Vector3,
|
||||
Vector4,
|
||||
String
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class CVar {
|
||||
[field: SerializeField]
|
||||
public CVarKind Kind { get; private set; }
|
||||
|
||||
[field: SerializeField]
|
||||
public string Name { get; private set; }
|
||||
|
||||
[field: SerializeField]
|
||||
public string Description { get; private set; }
|
||||
|
||||
public int IntValue;
|
||||
public float FloatValue;
|
||||
public Vector2 Vector2Value;
|
||||
public Vector3 Vector3Value;
|
||||
public Vector4 Vector4Value;
|
||||
public string StringValue;
|
||||
|
||||
public event Action OnChanged = delegate { };
|
||||
|
||||
public CVar(string name, string description) {
|
||||
Kind = CVarKind.Int;
|
||||
Name = name;
|
||||
Description = description;
|
||||
IntValue = 0;
|
||||
}
|
||||
|
||||
public void Set(int value) {
|
||||
Kind = CVarKind.Int;
|
||||
IntValue = value;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(float value) {
|
||||
Kind = CVarKind.Float;
|
||||
FloatValue = value;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(Vector2 value) {
|
||||
Kind = CVarKind.Vector2;
|
||||
Vector2Value = value;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(Vector3 value) {
|
||||
Kind = CVarKind.Vector3;
|
||||
Vector3Value = value;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(Vector4 value) {
|
||||
Kind = CVarKind.Vector4;
|
||||
Vector4Value = value;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Set(string value) {
|
||||
Kind = CVarKind.String;
|
||||
StringValue = value;
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void ParseFromString(string str) {
|
||||
if (float.TryParse(str, out float f)) {
|
||||
Set(f);
|
||||
} else if (int.TryParse(str, out int i)) {
|
||||
Set(i);
|
||||
} else {
|
||||
Set(str);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return Kind switch {
|
||||
CVarKind.Int => IntValue.ToString(),
|
||||
CVarKind.Float => FloatValue.ToString(CultureInfo.InvariantCulture),
|
||||
CVarKind.Vector2 => Vector2Value.ToString(),
|
||||
CVarKind.Vector3 => Vector3Value.ToString(),
|
||||
CVarKind.Vector4 => Vector4Value.ToString(),
|
||||
CVarKind.String => $"\"{StringValue}\"",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
}
|
||||
|
||||
public static CVar Create(string name, string description = "") {
|
||||
return SzafaEngine.Shared.GetService<ConsoleService>().CreateCVar(name, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Console/CVar.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Console/CVar.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f560b25a893456c90fac62ad278c02b
|
||||
timeCreated: 1740779755
|
||||
69
Assets/SzafaKit/Runtime/Console/ConsoleUI.cs
Normal file
69
Assets/SzafaKit/Runtime/Console/ConsoleUI.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System.Text;
|
||||
using SzafaKit.Foundation;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SzafaKit.Console
|
||||
{
|
||||
public class ConsoleUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private RectTransform _root;
|
||||
|
||||
[SerializeField]
|
||||
private ScrollRect _scrollRect;
|
||||
|
||||
[SerializeField]
|
||||
private TMP_InputField _input;
|
||||
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _messages;
|
||||
|
||||
private StringBuilder _content = new();
|
||||
|
||||
public bool IsVisible => _root.gameObject.activeSelf;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_input.onSubmit.AddListener(OnSubmit);
|
||||
}
|
||||
|
||||
private void OnSubmit(string input)
|
||||
{
|
||||
_input.text = "";
|
||||
SzafaEngine.Shared.GetService<ConsoleService>().Execute(input);
|
||||
|
||||
_input.Select();
|
||||
}
|
||||
|
||||
public void SetVisibility(bool visible)
|
||||
{
|
||||
_root.gameObject.SetActive(visible);
|
||||
|
||||
if (visible)
|
||||
{
|
||||
_input.Select();
|
||||
}
|
||||
}
|
||||
|
||||
public void Write(string message)
|
||||
{
|
||||
bool scrollDown = _scrollRect.verticalNormalizedPosition >= 0.01f;
|
||||
|
||||
_content.Append(message);
|
||||
_messages.text = _content.ToString();
|
||||
|
||||
if (scrollDown)
|
||||
{
|
||||
_scrollRect.verticalNormalizedPosition = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_content.Clear();
|
||||
_messages.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Console/ConsoleUI.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Console/ConsoleUI.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca844a0157054677b2f129fdbf6ddc45
|
||||
timeCreated: 1740780314
|
||||
200
Assets/SzafaKit/Runtime/Console/ScriptableConsoleService.cs
Normal file
200
Assets/SzafaKit/Runtime/Console/ScriptableConsoleService.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SzafaKit.Foundation;
|
||||
using SzafaKit.Input;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace SzafaKit.Console {
|
||||
public interface IConsoleCommand {
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
void Execute(string[] args);
|
||||
}
|
||||
|
||||
public class HelpCommand : IConsoleCommand {
|
||||
public string Name { get; } = "help";
|
||||
public string Description { get; } = "Prints available commands/cvars and their descriptions.";
|
||||
|
||||
public void Execute(string[] args) {
|
||||
SzafaEngine.Shared.GetService<ConsoleService>().PrintHelp();
|
||||
}
|
||||
}
|
||||
|
||||
public class ConsoleService : IEngineService {
|
||||
private struct Command {
|
||||
public string Name;
|
||||
public string Description;
|
||||
public IConsoleCommand Executor;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Config {
|
||||
public ConsoleUI ConsoleUIPrefab;
|
||||
public ScriptableInputAction ToggleAction;
|
||||
}
|
||||
|
||||
private ConsoleUI _ui;
|
||||
private Config _config;
|
||||
|
||||
private List<IConsoleCommand> _commands = new();
|
||||
private List<CVar> _cvars = new();
|
||||
|
||||
public bool IsVisible => _ui.IsVisible;
|
||||
|
||||
public ConsoleService(Config config) {
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async UniTask OnStart(CancellationToken cancellationToken) {
|
||||
_ui = Object.Instantiate(_config.ConsoleUIPrefab);
|
||||
await UniTask.Yield();
|
||||
|
||||
_config.ToggleAction.Action.Enable();
|
||||
_config.ToggleAction.Action.performed += OnToggleAction;
|
||||
|
||||
RegisterCommand(new HelpCommand());
|
||||
|
||||
_ui.SetVisibility(false);
|
||||
_ui.Clear();
|
||||
_ui.Write("Hello shelf\n");
|
||||
}
|
||||
|
||||
public void OnStop() {
|
||||
_config.ToggleAction.Action.performed -= OnToggleAction;
|
||||
}
|
||||
|
||||
public CVar GetCVar(string name) {
|
||||
foreach (CVar cvar in _cvars) {
|
||||
if (cvar.Name.Equals(name)) {
|
||||
return cvar;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CVar CreateCVar(string name, string description = "") {
|
||||
CVar cvar = GetCVar(name);
|
||||
if (cvar != null) {
|
||||
return cvar;
|
||||
}
|
||||
|
||||
Debug.Log($"Creating new cvar: {name}");
|
||||
|
||||
cvar = new(name, description);
|
||||
_cvars.Add(cvar);
|
||||
return cvar;
|
||||
}
|
||||
|
||||
private string[] ParseCommandInputArguments(string text) {
|
||||
if (text.Length == 0) {
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
return new string[] {text};
|
||||
}
|
||||
|
||||
public void Execute(string input) {
|
||||
if (input.Length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
string commandName = input;
|
||||
if (input.IndexOf(' ') != -1) {
|
||||
commandName = input.Substring(0, input.IndexOf(' '));
|
||||
}
|
||||
|
||||
string[] arguments = ParseCommandInputArguments(input.Substring(commandName.Length));
|
||||
|
||||
foreach (IConsoleCommand command in _commands) {
|
||||
if (command.Name.Equals(commandName)) {
|
||||
command.Execute(arguments);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CVar cvar in _cvars) {
|
||||
if (cvar.Name.Equals(commandName)) {
|
||||
if (arguments.Length == 1) {
|
||||
cvar.ParseFromString(arguments[0]);
|
||||
}
|
||||
|
||||
_ui.Write($"<b>{cvar.Name}</b> - {cvar.ToString()}\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ui.Write($"ERROR: Command/CVar `{commandName}` not found.");
|
||||
}
|
||||
|
||||
public void ToggleVisibility() {
|
||||
_ui.SetVisibility(!_ui.IsVisible);
|
||||
|
||||
if (_ui.IsVisible) {
|
||||
SzafaEngine.Shared.GetService<InputService>().DisableControls();
|
||||
} else {
|
||||
SzafaEngine.Shared.GetService<InputService>().EnableControls();
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterCommand(IConsoleCommand command) {
|
||||
if (_commands.Any(t => t.Name.Equals(command.Name))) {
|
||||
Debug.LogError($"`{command.Name}` command is already registered");
|
||||
return;
|
||||
}
|
||||
|
||||
_commands.Add(command);
|
||||
}
|
||||
|
||||
public void PrintHelp() {
|
||||
StringBuilder message = new();
|
||||
|
||||
message.AppendLine("Available commands:");
|
||||
foreach (IConsoleCommand command in _commands) {
|
||||
message.Append(" ");
|
||||
message.Append(command.Name);
|
||||
message.Append(" - ");
|
||||
message.Append(command.Description);
|
||||
message.AppendLine();
|
||||
}
|
||||
|
||||
message.AppendLine("Available cvars:");
|
||||
foreach (CVar cvar in _cvars) {
|
||||
message.Append(" ");
|
||||
message.Append(cvar.Name);
|
||||
message.Append(" - ");
|
||||
message.Append(cvar.Description);
|
||||
message.AppendLine();
|
||||
}
|
||||
|
||||
_ui.Write(message.ToString());
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
if (_ui != null) {
|
||||
Object.Destroy(_ui);
|
||||
_ui = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToggleAction(InputAction.CallbackContext obj) {
|
||||
ToggleVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
[CreateAssetMenu(menuName = SzafaConsts.AssetMenu + "Services/Console Service")]
|
||||
public class ScriptableConsoleService : ScriptableEngineService {
|
||||
[SerializeField]
|
||||
private ConsoleService.Config _config;
|
||||
|
||||
public override IEngineService Create() {
|
||||
return new ConsoleService(_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24d9df785eea4ff2bc324f2f3e0cf095
|
||||
timeCreated: 1740779958
|
||||
3
Assets/SzafaKit/Runtime/Defaults.meta
Normal file
3
Assets/SzafaKit/Runtime/Defaults.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 886ff8ce6ef34f66a5add38db25477a4
|
||||
timeCreated: 1740756085
|
||||
8
Assets/SzafaKit/Runtime/Defaults/Assets.meta
Normal file
8
Assets/SzafaKit/Runtime/Defaults/Assets.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a10ba1a8217970041a01edfdce5abde8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
%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: 24d9df785eea4ff2bc324f2f3e0cf095, type: 3}
|
||||
m_Name: Console Service
|
||||
m_EditorClassIdentifier:
|
||||
_config:
|
||||
ConsoleUIPrefab: {fileID: 1375678557884231458, guid: f83916a033d3c4b45b40ee51f7f62a5c,
|
||||
type: 3}
|
||||
ToggleAction: {fileID: 11400000, guid: 1c5aabf95d7e5d949af83d0a4c686e95, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e5151b700607a64ab4bd379fe585868
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1417
Assets/SzafaKit/Runtime/Defaults/Assets/ConsoleUI.prefab
Normal file
1417
Assets/SzafaKit/Runtime/Defaults/Assets/ConsoleUI.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f83916a033d3c4b45b40ee51f7f62a5c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
%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: 27f56e8918e649f9b6b9c75d3270f6aa, type: 3}
|
||||
m_Name: Default Game Mode
|
||||
m_EditorClassIdentifier:
|
||||
<GameModeConfig>k__BackingField:
|
||||
Controllers:
|
||||
- {fileID: 11400000, guid: da1edb9f39668504c93c80d733fa29b2, type: 2}
|
||||
_config:
|
||||
value: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd0a0373004116246aa996f6fc5a4dbb
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Drag
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 1
|
||||
m_ExpectedControlType: Button
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: 2303dff6-c323-48b3-8d8e-2067dee8e841
|
||||
m_Path: <Keyboard>/f
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed71246d15e0b49489a7b30565fe399a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Jump
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 1
|
||||
m_ExpectedControlType: Button
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: e43ab0d0-5280-4e4b-b31b-94568c4fe405
|
||||
m_Path: <Keyboard>/space
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db965d9bb6987ed4bb50f6d6b01bf4c1
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Look
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 0
|
||||
m_ExpectedControlType: Vector2
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: 7d426dac-259c-4568-ae0c-57c76dfb1638
|
||||
m_Path: <Mouse>/delta
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0c347aa474ce1f42b6f03fa43abffbc
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Move
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 0
|
||||
m_ExpectedControlType: Vector2
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name: WASD
|
||||
m_Id: 9f90ce35-0638-4ddf-aebe-45e007c2b26b
|
||||
m_Path: 2DVector
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 4
|
||||
- m_Name: up
|
||||
m_Id: b50d4356-4c22-47aa-b3eb-7937af8631c1
|
||||
m_Path: <Keyboard>/w
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 8
|
||||
- m_Name: down
|
||||
m_Id: 63c5365d-9b54-4b40-afcd-ffa791e62199
|
||||
m_Path: <Keyboard>/s
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 8
|
||||
- m_Name: left
|
||||
m_Id: c02d8ee9-38e9-472a-a4fa-4702956bd963
|
||||
m_Path: <Keyboard>/a
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 8
|
||||
- m_Name: right
|
||||
m_Id: 80a9f6b2-8d99-47cf-b301-6b45f2a9b452
|
||||
m_Path: <Keyboard>/d
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 8
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e94b037d61f84840aa8be2a17c57b92
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Primary
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 1
|
||||
m_ExpectedControlType: Button
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: 8195e9d6-52a1-473e-9294-52401e109f50
|
||||
m_Path: <Mouse>/leftButton
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d488277da3b6bcd4b9141ef4df213113
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Secondary
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 1
|
||||
m_ExpectedControlType: Button
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: 2303dff6-c323-48b3-8d8e-2067dee8e841
|
||||
m_Path: <Mouse>/rightButton
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a35e3eb2860ee924ea570e507c532bd5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
%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: e8d574cf0e024ec7bc4363a675dbb2c9, type: 3}
|
||||
m_Name: Default Input Action Toggle Console
|
||||
m_EditorClassIdentifier:
|
||||
<Action>k__BackingField:
|
||||
m_Name: Action
|
||||
m_Type: 1
|
||||
m_ExpectedControlType: Button
|
||||
m_Id: 0d0a8fd1-a016-4d24-af36-05ef6eacf0a5
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: 8195e9d6-52a1-473e-9294-52401e109f50
|
||||
m_Path: <Keyboard>/backquote
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: Action
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c5aabf95d7e5d949af83d0a4c686e95
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
%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: 39d504e1e5d74a5b936370449aa8b7bf, type: 3}
|
||||
m_Name: Default Player Controller
|
||||
m_EditorClassIdentifier:
|
||||
_config:
|
||||
PlayerPrefab: {fileID: 3281341945955459440, guid: c5a555fd0308dc546b2a31af07869f90,
|
||||
type: 3}
|
||||
MoveActionReference: {fileID: -2772844096359753972, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
LookActionReference: {fileID: -5746443703610909298, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
JumpActionReference: {fileID: 2789365106649255415, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
DragObjectActionReference: {fileID: 2331847964233633448, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
PrimaryActionReference: {fileID: 7005240712943983493, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
SecondaryActionReference: {fileID: -1076036341132388265, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da1edb9f39668504c93c80d733fa29b2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,258 @@
|
||||
{
|
||||
"name": "DefaultControls",
|
||||
"maps": [
|
||||
{
|
||||
"name": "FPP",
|
||||
"id": "b0bcb628-1df3-4a2c-b682-23bb146d08d6",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Move",
|
||||
"type": "Value",
|
||||
"id": "3c626577-80b8-479c-9f89-3de5215ff88e",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Look",
|
||||
"type": "Value",
|
||||
"id": "248f8f05-7290-4f55-aee3-cc25577f9bf8",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Jump",
|
||||
"type": "Button",
|
||||
"id": "8de4d981-bcae-4100-af76-05d381d961a6",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "PhysicsDrag",
|
||||
"type": "Button",
|
||||
"id": "bf3d1155-8050-482a-ae55-fa8d47c95e94",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Primary",
|
||||
"type": "Button",
|
||||
"id": "b00af1dd-1084-4763-8751-fdde9810b2eb",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Secondary",
|
||||
"type": "Button",
|
||||
"id": "982c57c9-6862-436b-9e85-41fcbd047312",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Use",
|
||||
"type": "Button",
|
||||
"id": "3284ff03-949a-4f12-913b-1b74b99a599e",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Menu0",
|
||||
"type": "Button",
|
||||
"id": "f861a8bc-4861-44ae-bb4f-e3bca9efae2c",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Menu1",
|
||||
"type": "Button",
|
||||
"id": "925a66f6-64a7-4bbf-9eee-a6138e6372c3",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Menu2",
|
||||
"type": "Button",
|
||||
"id": "c4f819fc-4f38-4782-b5dc-d3f59cbcafc7",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "7856b569-f241-4d9d-86ef-3f2f43c93730",
|
||||
"path": "<Mouse>/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "dd672a14-64ba-4cf6-a7b6-dbd4ac779d9f",
|
||||
"path": "<Keyboard>/space",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "095c0e94-6900-442e-8bad-a61430bfead1",
|
||||
"path": "<Keyboard>/f",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "PhysicsDrag",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d01e2a9b-4e4a-439f-892d-db8521ed0028",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Primary",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "0f8ae92e-c66e-4807-b95d-2fab59bd4e81",
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Secondary",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "WASD",
|
||||
"id": "3151504d-248f-47a2-b1c6-c62f5582beea",
|
||||
"path": "2DVector",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "7bb02b96-4858-48c7-b3f9-52975278ccfa",
|
||||
"path": "<Keyboard>/w",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "e2eda81d-db6a-4785-b6ea-adf41d23f1f4",
|
||||
"path": "<Keyboard>/s",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "784f8cb3-6b5c-4234-8fdd-d439d0a4353e",
|
||||
"path": "<Keyboard>/a",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "8c6bd391-705d-471d-a2d9-de82963f0c63",
|
||||
"path": "<Keyboard>/d",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "358c81fe-cbfe-455a-8828-a6d166426430",
|
||||
"path": "<Keyboard>/e",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Use",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "352a96ce-7752-40ca-8ee7-dcc84bbdebd2",
|
||||
"path": "<Keyboard>/i",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Menu0",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "956136b4-30ff-49d2-bd98-b42bd8944543",
|
||||
"path": "<Keyboard>/m",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Menu1",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ad048d87-67fa-434f-a0ed-cce955e68659",
|
||||
"path": "<Keyboard>/b",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Menu2",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": []
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f991e9abd9a53ee4b94b329a5ce96cb2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 0
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
426
Assets/SzafaKit/Runtime/Defaults/Assets/DefaultPlayer.prefab
Normal file
426
Assets/SzafaKit/Runtime/Defaults/Assets/DefaultPlayer.prefab
Normal file
@@ -0,0 +1,426 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1633378644400006462
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5635006187901299347}
|
||||
- component: {fileID: 8754676140351214484}
|
||||
m_Layer: 0
|
||||
m_Name: FPP Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5635006187901299347
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1633378644400006462}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.75, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 4109293979719759325}
|
||||
- {fileID: 5003790919823188963}
|
||||
m_Father: {fileID: 7761779135599839476}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &8754676140351214484
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1633378644400006462}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ExcludedPropertiesInInspector:
|
||||
- m_Script
|
||||
m_LockStageInInspector:
|
||||
m_StreamingVersion: 20170927
|
||||
m_Priority: 10
|
||||
m_StandbyUpdate: 2
|
||||
m_LookAt: {fileID: 0}
|
||||
m_Follow: {fileID: 0}
|
||||
m_Lens:
|
||||
FieldOfView: 80
|
||||
OrthographicSize: 5
|
||||
NearClipPlane: 0.3
|
||||
FarClipPlane: 1000
|
||||
Dutch: 0
|
||||
ModeOverride: 0
|
||||
LensShift: {x: 0, y: 0}
|
||||
GateFit: 2
|
||||
FocusDistance: 10
|
||||
m_SensorSize: {x: 1, y: 1}
|
||||
m_Transitions:
|
||||
m_BlendHint: 0
|
||||
m_InheritPosition: 0
|
||||
m_OnCameraLive:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_LegacyBlendHint: 0
|
||||
m_ComponentOwner: {fileID: 4109293979719759325}
|
||||
--- !u!1 &6086846679135428685
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7761779135599839476}
|
||||
- component: {fileID: 3281341945955459440}
|
||||
- component: {fileID: 8903325519720751579}
|
||||
- component: {fileID: 2870607051570670034}
|
||||
- component: {fileID: 8832222745457568443}
|
||||
- component: {fileID: 8481721317112206669}
|
||||
m_Layer: 0
|
||||
m_Name: DefaultPlayer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7761779135599839476
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6086846679135428685}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5635006187901299347}
|
||||
- {fileID: 5117685723249707591}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3281341945955459440
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6086846679135428685}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d1a5d6506c8347809103c23883d6bbfc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
<Locomotion>k__BackingField: {fileID: 2870607051570670034}
|
||||
<FPPCamera>k__BackingField: {fileID: 8832222745457568443}
|
||||
<Dragger>k__BackingField: {fileID: 8481721317112206669}
|
||||
<DragObjectForce>k__BackingField: 10
|
||||
--- !u!143 &8903325519720751579
|
||||
CharacterController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6086846679135428685}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Height: 2
|
||||
m_Radius: 0.5
|
||||
m_SlopeLimit: 45
|
||||
m_StepOffset: 0.3
|
||||
m_SkinWidth: 0.08
|
||||
m_MinMoveDistance: 0.001
|
||||
m_Center: {x: 0, y: 1, z: 0}
|
||||
--- !u!114 &2870607051570670034
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6086846679135428685}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6e909888e8f2465fb2f032b66bbd20a4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_characterController: {fileID: 8903325519720751579}
|
||||
_maxMovementSpeed: 4
|
||||
_maxSprintSpeed: 15
|
||||
_jumpHeight: 1
|
||||
_gravity: 10
|
||||
_maxFallSpeed: 20
|
||||
_damping: 20
|
||||
--- !u!114 &8832222745457568443
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6086846679135428685}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 36206ce4a4cc47beb4d9ec97b46280c4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_pickDistance: 5
|
||||
_pickLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1
|
||||
<Sensitivity>k__BackingField: 0.4
|
||||
_pitchMin: -80
|
||||
_pitchMax: 80
|
||||
<Camera>k__BackingField: {fileID: 8754676140351214484}
|
||||
--- !u!114 &8481721317112206669
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6086846679135428685}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e4259fd9e0d9418baf2f6c2d8aacb87e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
<MaxHoldMass>k__BackingField: 50
|
||||
<DampingFactor>k__BackingField: 1
|
||||
<AngularSlowdown>k__BackingField: 90
|
||||
<DragForce>k__BackingField: 100
|
||||
--- !u!1 &7286498852570965723
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5117685723249707591}
|
||||
- component: {fileID: 7327033897601353362}
|
||||
- component: {fileID: 1858263895917388134}
|
||||
m_Layer: 0
|
||||
m_Name: Capsule
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5117685723249707591
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7286498852570965723}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7761779135599839476}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &7327033897601353362
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7286498852570965723}
|
||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1858263895917388134
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7286498852570965723}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &8024233446654794244
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4109293979719759325}
|
||||
- component: {fileID: 8312648709817428832}
|
||||
m_Layer: 0
|
||||
m_Name: cm
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4109293979719759325
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8024233446654794244}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5635006187901299347}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &8312648709817428832
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8024233446654794244}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &4826645119771837448
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 5635006187901299347}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.35162827
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.35162827
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 0.35162827
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -0.134
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.70710653
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.70710707
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 919132149155446097, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Player_Arms
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 85f6fd2cdaf4a644d85dea4d14913b20, type: 3}
|
||||
--- !u!4 &5003790919823188963 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 85f6fd2cdaf4a644d85dea4d14913b20,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 4826645119771837448}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5a555fd0308dc546b2a31af07869f90
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/SzafaKit/Runtime/Defaults/Assets/Input Service.asset
Normal file
17
Assets/SzafaKit/Runtime/Defaults/Assets/Input Service.asset
Normal file
@@ -0,0 +1,17 @@
|
||||
%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: 4d8bf4c116af4e99947643c66bc227e5, type: 3}
|
||||
m_Name: Input Service
|
||||
m_EditorClassIdentifier:
|
||||
_config:
|
||||
InputAsset: {fileID: -944628639613478452, guid: f991e9abd9a53ee4b94b329a5ce96cb2,
|
||||
type: 3}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcb972cffd459e944a402140600e67e5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
49
Assets/SzafaKit/Runtime/Defaults/DefaultGameMode.cs
Normal file
49
Assets/SzafaKit/Runtime/Defaults/DefaultGameMode.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SzafaKit.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Defaults
|
||||
{
|
||||
public class DefaultGameModeController : IController
|
||||
{
|
||||
private DefaultGameMode.Config _config;
|
||||
|
||||
public DefaultGameModeController(DefaultGameMode.Config config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async UniTask OnStart(CancellationToken cancellationToken)
|
||||
{
|
||||
await UniTask.Yield();
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnTick()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[CreateAssetMenu(menuName = SzafaConsts.AssetMenu + "Defaults/Game Mode Controller")]
|
||||
public class DefaultGameMode : ScriptableGameMode
|
||||
{
|
||||
[Serializable]
|
||||
public class Config
|
||||
{
|
||||
public int value;
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Config _config;
|
||||
|
||||
public override void ConfigureGameMode(GameMode gameMode)
|
||||
{
|
||||
gameMode.AddController(new DefaultGameModeController(_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Defaults/DefaultGameMode.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Defaults/DefaultGameMode.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27f56e8918e649f9b6b9c75d3270f6aa
|
||||
timeCreated: 1740756094
|
||||
28
Assets/SzafaKit/Runtime/Defaults/DefaultPlayer.cs
Normal file
28
Assets/SzafaKit/Runtime/Defaults/DefaultPlayer.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using SzafaKit.World.Characters;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Defaults {
|
||||
public class DefaultPlayer : MonoBehaviour {
|
||||
[field: SerializeField]
|
||||
public CharacterLocomotion Locomotion { get; private set; }
|
||||
|
||||
[field: SerializeField]
|
||||
public FirstPersonCamera FPPCamera { get; private set; }
|
||||
|
||||
[field: SerializeField]
|
||||
public PhysicsObjectDragger Dragger { get; private set; }
|
||||
|
||||
[field: SerializeField]
|
||||
public float DragObjectDistanceFromCamera { get; private set; } = 2.0f;
|
||||
|
||||
public void MoveRight(float input) {
|
||||
Vector3 direction = Quaternion.AngleAxis(FPPCamera.Yaw, Vector3.up) * Vector3.right;
|
||||
Locomotion.AddMovementInput(direction, input);
|
||||
}
|
||||
|
||||
public void MoveForward(float input) {
|
||||
Vector3 direction = Quaternion.AngleAxis(FPPCamera.Yaw, Vector3.up) * Vector3.forward;
|
||||
Locomotion.AddMovementInput(direction, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Defaults/DefaultPlayer.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Defaults/DefaultPlayer.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1a5d6506c8347809103c23883d6bbfc
|
||||
timeCreated: 1740771959
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SzafaKit.Console;
|
||||
using SzafaKit.Foundation;
|
||||
using SzafaKit.Input;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace SzafaKit.Defaults {
|
||||
public class DefaultPlayerController : IController {
|
||||
[Serializable]
|
||||
public class Config {
|
||||
public DefaultPlayer PlayerPrefab;
|
||||
|
||||
public InputActionReference MoveActionReference;
|
||||
public InputActionReference LookActionReference;
|
||||
public InputActionReference JumpActionReference;
|
||||
public InputActionReference DragObjectActionReference;
|
||||
public InputActionReference PrimaryActionReference;
|
||||
public InputActionReference SecondaryActionReference;
|
||||
}
|
||||
|
||||
private Config _config;
|
||||
|
||||
private DefaultPlayer _player;
|
||||
|
||||
private CVar _sensitivityCVar;
|
||||
|
||||
public DefaultPlayerController(Config config) {
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async UniTask OnStart(CancellationToken cancellationToken) {
|
||||
_player = Object.Instantiate(_config.PlayerPrefab);
|
||||
|
||||
SzafaEngine.Shared.GetService<InputService>().LockCursor();
|
||||
SzafaEngine.Shared.GetService<InputService>().EnableControls();
|
||||
|
||||
_sensitivityCVar = CVar.Create("fpp_cam_look_sens", "FPP Camera look sensitivity");
|
||||
_sensitivityCVar.Set(0.25f);
|
||||
|
||||
await UniTask.Yield();
|
||||
}
|
||||
|
||||
public void OnStop() {
|
||||
SzafaEngine.Shared.GetService<InputService>().DisableControls();
|
||||
SzafaEngine.Shared.GetService<InputService>().UnlockCursor();
|
||||
Object.Destroy(_player);
|
||||
}
|
||||
|
||||
public void OnTick() {
|
||||
_player.FPPCamera.Sensitivity = _sensitivityCVar.FloatValue;
|
||||
|
||||
Vector2 lookInput = _config.LookActionReference.action.ReadValue<Vector2>();
|
||||
_player.FPPCamera.Rotate(lookInput.x, lookInput.y);
|
||||
|
||||
Vector2 moveInput = _config.MoveActionReference.action.ReadValue<Vector2>();
|
||||
_player.MoveRight(moveInput.x);
|
||||
_player.MoveForward(moveInput.y);
|
||||
|
||||
if (_config.JumpActionReference.action.WasPerformedThisFrame()) {
|
||||
_player.Locomotion.Jump();
|
||||
}
|
||||
|
||||
_player.Dragger.TargetWorldPosition = _player.FPPCamera.Camera.transform.position + _player.FPPCamera.Camera.transform.forward * _player.DragObjectDistanceFromCamera;
|
||||
|
||||
if (_config.DragObjectActionReference.action.WasPressedThisFrame() && !_player.Dragger.IsDragging) {
|
||||
GameObject pickedGameObject = _player.FPPCamera.Pick();
|
||||
if (pickedGameObject != null && pickedGameObject.TryGetComponent(out Rigidbody rigidbody)) {
|
||||
_player.Dragger.Grab(rigidbody);
|
||||
}
|
||||
}
|
||||
|
||||
if (_config.DragObjectActionReference.action.WasReleasedThisFrame()) {
|
||||
_player.Dragger.Drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CreateAssetMenu(menuName = SzafaConsts.AssetMenu + "Defaults/Player Controller")]
|
||||
public class ScriptableDefaultPlayerController : ScriptableController {
|
||||
[SerializeField]
|
||||
private DefaultPlayerController.Config _config;
|
||||
|
||||
public override IController Create() {
|
||||
return new DefaultPlayerController(_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39d504e1e5d74a5b936370449aa8b7bf
|
||||
timeCreated: 1740758863
|
||||
3
Assets/SzafaKit/Runtime/Foundation.meta
Normal file
3
Assets/SzafaKit/Runtime/Foundation.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68a77eab007d4aa39f16e9cc3485fab9
|
||||
timeCreated: 1740755614
|
||||
25
Assets/SzafaKit/Runtime/Foundation/EntryPoint.cs
Normal file
25
Assets/SzafaKit/Runtime/Foundation/EntryPoint.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Foundation
|
||||
{
|
||||
public static class EntryPoint
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
|
||||
public static void Start()
|
||||
{
|
||||
ScriptableEngineConfig config = Resources.Load<ScriptableEngineConfig>(SzafaConsts.EngineConfigResourcesPath);
|
||||
if (config == null)
|
||||
{
|
||||
Debug.LogError($"Couldn't load engine config from resources: {SzafaConsts.EngineConfigResourcesPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject engineGameObject = new GameObject("SzafaEngine");
|
||||
Object.DontDestroyOnLoad(engineGameObject);
|
||||
|
||||
SzafaEngine engine = engineGameObject.AddComponent<SzafaEngine>();
|
||||
engine.Fire(config).Forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Foundation/EntryPoint.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Foundation/EntryPoint.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83bc8a98e30147babef3641863699cd9
|
||||
timeCreated: 1740670775
|
||||
91
Assets/SzafaKit/Runtime/Foundation/GameMode.cs
Normal file
91
Assets/SzafaKit/Runtime/Foundation/GameMode.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Foundation
|
||||
{
|
||||
[Serializable]
|
||||
public class GameModeConfig
|
||||
{
|
||||
public ScriptableController[] Controllers;
|
||||
}
|
||||
|
||||
public abstract class ScriptableGameMode : ScriptableObject
|
||||
{
|
||||
[field: SerializeField]
|
||||
public GameModeConfig GameModeConfig { get; private set; }
|
||||
|
||||
public GameMode CreateGameMode()
|
||||
{
|
||||
GameMode gameMode = new GameMode(GameModeConfig);
|
||||
return gameMode;
|
||||
}
|
||||
|
||||
public abstract void ConfigureGameMode(GameMode gameMode);
|
||||
}
|
||||
|
||||
public class GameMode
|
||||
{
|
||||
private readonly GameModeConfig _config;
|
||||
private readonly List<IController> _controllers = new();
|
||||
|
||||
private bool _isRunning;
|
||||
|
||||
public GameMode(GameModeConfig config)
|
||||
{
|
||||
_config = config;
|
||||
_isRunning = false;
|
||||
}
|
||||
|
||||
public async UniTask<bool> Start(CancellationToken cancellationToken)
|
||||
{
|
||||
foreach (ScriptableController scriptableController in _config.Controllers)
|
||||
{
|
||||
AddController(scriptableController.Create());
|
||||
}
|
||||
|
||||
foreach (IController controller in _controllers)
|
||||
{
|
||||
await controller.OnStart(cancellationToken);
|
||||
}
|
||||
|
||||
_isRunning = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_isRunning = false;
|
||||
|
||||
foreach (IController controller in _controllers)
|
||||
{
|
||||
controller.OnStop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (IController controller in _controllers)
|
||||
{
|
||||
controller.OnTick();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddController(IController controller)
|
||||
{
|
||||
_controllers.Add(controller);
|
||||
|
||||
if (_isRunning)
|
||||
{
|
||||
controller.OnStart(default).Forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Foundation/GameMode.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Foundation/GameMode.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bebb9c7fda247de9259b519798b3310
|
||||
timeCreated: 1740755630
|
||||
12
Assets/SzafaKit/Runtime/Foundation/IController.cs
Normal file
12
Assets/SzafaKit/Runtime/Foundation/IController.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace SzafaKit.Foundation
|
||||
{
|
||||
public interface IController
|
||||
{
|
||||
UniTask OnStart(CancellationToken cancellationToken);
|
||||
void OnStop();
|
||||
void OnTick();
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Foundation/IController.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Foundation/IController.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a78e7e501a24257a006967827a937ab
|
||||
timeCreated: 1740757906
|
||||
30
Assets/SzafaKit/Runtime/Foundation/MainCameraService.cs
Normal file
30
Assets/SzafaKit/Runtime/Foundation/MainCameraService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Foundation
|
||||
{
|
||||
public class MainCameraService : IEngineService
|
||||
{
|
||||
public Camera Camera { get; private set; }
|
||||
|
||||
public MainCameraService(Camera camera)
|
||||
{
|
||||
Camera = camera;
|
||||
Camera = Camera.main;
|
||||
}
|
||||
|
||||
public async UniTask OnStart(CancellationToken cancellationToken)
|
||||
{
|
||||
await UniTask.Yield();
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 351d6b8577644d599058e76fa02a11c0
|
||||
timeCreated: 1740769963
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Foundation
|
||||
{
|
||||
public abstract class ScriptableController : ScriptableObject
|
||||
{
|
||||
public abstract IController Create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 146a4df868754b5498eb29b8450b498a
|
||||
timeCreated: 1740766190
|
||||
12
Assets/SzafaKit/Runtime/Foundation/ScriptableEngineConfig.cs
Normal file
12
Assets/SzafaKit/Runtime/Foundation/ScriptableEngineConfig.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Foundation {
|
||||
[CreateAssetMenu(menuName = SzafaConsts.AssetMenu + "New Engine Config")]
|
||||
public class ScriptableEngineConfig : ScriptableObject {
|
||||
//[Header("Core Services")]
|
||||
public ScriptableGameMode StartingGameMode;
|
||||
|
||||
public ScriptableEngineService ConsoleService;
|
||||
public ScriptableEngineService[] Services;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97642a764f1542c89f7f13f5abe773ab
|
||||
timeCreated: 1740670554
|
||||
9
Assets/SzafaKit/Runtime/Foundation/SzafaConsts.cs
Normal file
9
Assets/SzafaKit/Runtime/Foundation/SzafaConsts.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace SzafaKit.Foundation
|
||||
{
|
||||
public static class SzafaConsts
|
||||
{
|
||||
public const string EngineConfigResourcesPath = "TheGame/Szafa";
|
||||
|
||||
public const string AssetMenu = "Szafa/";
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Foundation/SzafaConsts.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Foundation/SzafaConsts.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbdd961efdac40acaf913d21179d274f
|
||||
timeCreated: 1740756126
|
||||
90
Assets/SzafaKit/Runtime/Foundation/SzafaEngine.cs
Normal file
90
Assets/SzafaKit/Runtime/Foundation/SzafaEngine.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SzafaKit.Console;
|
||||
using SzafaKit.Input;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Foundation {
|
||||
public interface IEngineService : IDisposable {
|
||||
UniTask OnStart(CancellationToken cancellationToken);
|
||||
void OnStop();
|
||||
}
|
||||
|
||||
public abstract class ScriptableEngineService : ScriptableObject {
|
||||
public abstract IEngineService Create();
|
||||
}
|
||||
|
||||
public class SzafaEngine : MonoBehaviour {
|
||||
public static SzafaEngine Shared { get; private set; }
|
||||
|
||||
private Dictionary<Type, IEngineService> _servicesMap = new();
|
||||
|
||||
private ScriptableEngineConfig _engineConfig;
|
||||
private GameMode _gameMode;
|
||||
|
||||
private bool _isRunning = false;
|
||||
|
||||
private void Awake() {
|
||||
Debug.AssertFormat(Shared == null, "There is already an instance of SzafeEngine");
|
||||
Shared = this;
|
||||
}
|
||||
|
||||
public async UniTask Fire(ScriptableEngineConfig engineConfig) {
|
||||
_engineConfig = engineConfig;
|
||||
|
||||
Register(_engineConfig.ConsoleService.Create());
|
||||
Register(new MainCameraService(null));
|
||||
|
||||
foreach (ScriptableEngineService service in _engineConfig.Services) {
|
||||
Register(service.Create());
|
||||
}
|
||||
|
||||
foreach ((Type _, IEngineService service) in _servicesMap) {
|
||||
await service.OnStart(destroyCancellationToken);
|
||||
}
|
||||
|
||||
_gameMode = _engineConfig.StartingGameMode.CreateGameMode();
|
||||
await _gameMode.Start(destroyCancellationToken);
|
||||
|
||||
_isRunning = true;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (!_isRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_gameMode != null) {
|
||||
_gameMode.Tick();
|
||||
}
|
||||
}
|
||||
|
||||
public void Register(IEngineService service, Type type) {
|
||||
Debug.AssertFormat(!_servicesMap.ContainsKey(type), $"There is already game service of type `{type}`");
|
||||
_servicesMap.Add(type, service);
|
||||
}
|
||||
|
||||
public void Register<T>(T service) where T : IEngineService {
|
||||
Register(service, service.GetType());
|
||||
}
|
||||
|
||||
public void UnRegisterService(Type type) {
|
||||
_servicesMap.Remove(type);
|
||||
}
|
||||
|
||||
public IEngineService GetService(Type type) {
|
||||
if (_servicesMap.TryGetValue(type, out IEngineService service)) {
|
||||
return service;
|
||||
}
|
||||
|
||||
Debug.LogAssertionFormat($"Couldn't find service of type `{type}`");
|
||||
return null;
|
||||
}
|
||||
|
||||
public T GetService<T>() where T : IEngineService {
|
||||
return (T) GetService(typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/SzafaKit/Runtime/Foundation/SzafaEngine.cs.meta
Normal file
11
Assets/SzafaKit/Runtime/Foundation/SzafaEngine.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c765ecc37ebedd94fbd983354ced43b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/SzafaKit/Runtime/Input.meta
Normal file
3
Assets/SzafaKit/Runtime/Input.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b0c063e9b7a4190894f338b2fdef3b4
|
||||
timeCreated: 1740768141
|
||||
53
Assets/SzafaKit/Runtime/Input/InputService.cs
Normal file
53
Assets/SzafaKit/Runtime/Input/InputService.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SzafaKit.Foundation;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace SzafaKit.Input {
|
||||
public class InputService : IEngineService {
|
||||
[Serializable]
|
||||
public class Config {
|
||||
public InputActionAsset InputAsset;
|
||||
}
|
||||
|
||||
private Config _config;
|
||||
|
||||
public InputService(Config config) {
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async UniTask OnStart(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield();
|
||||
}
|
||||
|
||||
public void OnStop() {
|
||||
}
|
||||
|
||||
public void EnableControls() {
|
||||
_config.InputAsset.Enable();
|
||||
}
|
||||
|
||||
public void DisableControls() {
|
||||
_config.InputAsset.Disable();
|
||||
}
|
||||
|
||||
public InputAction FindInputAction(string path) {
|
||||
return _config.InputAsset.FindAction(path);
|
||||
}
|
||||
|
||||
public void LockCursor() {
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
|
||||
public void UnlockCursor() {
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/Input/InputService.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/Input/InputService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6ee7382dba74afe84aaf53259b1cf8a
|
||||
timeCreated: 1740769896
|
||||
14
Assets/SzafaKit/Runtime/Input/ScriptableInputAction.cs
Normal file
14
Assets/SzafaKit/Runtime/Input/ScriptableInputAction.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using SzafaKit.Foundation;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace SzafaKit.Input
|
||||
{
|
||||
[CreateAssetMenu(menuName = SzafaConsts.AssetMenu + "Input Action", fileName = "Input Action")]
|
||||
public class ScriptableInputAction : ScriptableObject
|
||||
{
|
||||
[field: SerializeField]
|
||||
public InputAction Action { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8d574cf0e024ec7bc4363a675dbb2c9
|
||||
timeCreated: 1740768148
|
||||
17
Assets/SzafaKit/Runtime/Input/ScriptableInputService.cs
Normal file
17
Assets/SzafaKit/Runtime/Input/ScriptableInputService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using SzafaKit.Foundation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.Input
|
||||
{
|
||||
[CreateAssetMenu(menuName = SzafaConsts.AssetMenu + "Services/Input")]
|
||||
public class ScriptableInputService : ScriptableEngineService
|
||||
{
|
||||
[SerializeField]
|
||||
private InputService.Config _config;
|
||||
|
||||
public override IEngineService Create()
|
||||
{
|
||||
return new InputService(_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d8bf4c116af4e99947643c66bc227e5
|
||||
timeCreated: 1740839247
|
||||
7
Assets/SzafaKit/Runtime/LoadingScreenService.cs
Normal file
7
Assets/SzafaKit/Runtime/LoadingScreenService.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace SzafaKit
|
||||
{
|
||||
public class LoadingScreenService
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/LoadingScreenService.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/LoadingScreenService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a45f8f7ea6f45198713694a39790614
|
||||
timeCreated: 1740671052
|
||||
21
Assets/SzafaKit/Runtime/ScenesService.cs
Normal file
21
Assets/SzafaKit/Runtime/ScenesService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace SzafaKit
|
||||
{
|
||||
public interface IScenesService
|
||||
{
|
||||
}
|
||||
|
||||
public class ScenesService
|
||||
{
|
||||
public ScenesService()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async UniTask LoadSceneMode()
|
||||
{
|
||||
await UniTask.Yield();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/SzafaKit/Runtime/ScenesService.cs.meta
Normal file
3
Assets/SzafaKit/Runtime/ScenesService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6158eaacaf3a442aa8008634364090b2
|
||||
timeCreated: 1740671427
|
||||
8
Assets/SzafaKit/Runtime/SzafaGfx.meta
Normal file
8
Assets/SzafaKit/Runtime/SzafaGfx.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1ad1644f34e55a4d912533e416f7c06
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/SzafaKit/Runtime/SzafaGfx/CRT.meta
Normal file
8
Assets/SzafaKit/Runtime/SzafaGfx/CRT.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 162830275afaa9a40b54532a4a597593
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
136
Assets/SzafaKit/Runtime/SzafaGfx/CRT/M_CRT_Default.mat
Normal file
136
Assets/SzafaKit/Runtime/SzafaGfx/CRT/M_CRT_Default.mat
Normal file
@@ -0,0 +1,136 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: M_CRT_Default
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 4d0e8896444a6f84690b4862dc0f7452,
|
||||
type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BlurOffset: 0.00179
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _NumberOfScanLines: 200
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _ScanLinesSpeed: -0.001
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 16.948381, g: 16.948381, b: 16.948381, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &7239824129281003057
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 7
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 212bec7ca33591a489a68c541995db87
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5127
Assets/SzafaKit/Runtime/SzafaGfx/CRT/SG_CRT.shadergraph
Normal file
5127
Assets/SzafaKit/Runtime/SzafaGfx/CRT/SG_CRT.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
10
Assets/SzafaKit/Runtime/SzafaGfx/CRT/SG_CRT.shadergraph.meta
Normal file
10
Assets/SzafaKit/Runtime/SzafaGfx/CRT/SG_CRT.shadergraph.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d0e8896444a6f84690b4862dc0f7452
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
8
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize.meta
Normal file
8
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48eb2fb8f4d8a2445a73abbb9623838f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize/Pixelize.shader
Normal file
68
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize/Pixelize.shader
Normal file
@@ -0,0 +1,68 @@
|
||||
Shader "Hidden/Szafa/Pixelize"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white"
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
TEXTURE2D(_MainTex);
|
||||
float4 _MainTex_TexelSize;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
SamplerState sampler_point_clamp;
|
||||
|
||||
uniform float2 _BlockCount;
|
||||
uniform float2 _BlockSize;
|
||||
uniform float2 _HalfBlockSize;
|
||||
|
||||
Varyings vert(Attributes IN)
|
||||
{
|
||||
Varyings OUT;
|
||||
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.uv = TRANSFORM_TEX(IN.uv, _MainTex);
|
||||
return OUT;
|
||||
}
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Pixelation"
|
||||
|
||||
HLSLPROGRAM
|
||||
half4 frag(Varyings IN) : SV_TARGET
|
||||
{
|
||||
float2 blockPos = floor(IN.uv * _BlockCount);
|
||||
float2 blockCenter = blockPos * _BlockSize + _HalfBlockSize;
|
||||
|
||||
float4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_point_clamp, blockCenter);
|
||||
return tex;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 782df0a61dfc4acf8fe4ec5a7204f205
|
||||
timeCreated: 1740752799
|
||||
37
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize/PixelizeFeature.cs
Normal file
37
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize/PixelizeFeature.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace SzafaKit.SzafaGfx.Pixelize
|
||||
{
|
||||
public class PixelizeFeature : ScriptableRendererFeature
|
||||
{
|
||||
[Serializable]
|
||||
public class PassSettings
|
||||
{
|
||||
public RenderPassEvent RenderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing;
|
||||
public int FrameHeight = 240;
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private PassSettings _settings;
|
||||
|
||||
private PixelizePass _pass;
|
||||
|
||||
public override void Create()
|
||||
{
|
||||
_pass = new PixelizePass(_settings);
|
||||
}
|
||||
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (renderingData.cameraData.isSceneViewCamera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
renderer.EnqueuePass(_pass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dde9574f26949228f5a5ac71254a478
|
||||
timeCreated: 1740752516
|
||||
69
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize/PixelizePass.cs
Normal file
69
Assets/SzafaKit/Runtime/SzafaGfx/Pixelize/PixelizePass.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace SzafaKit.SzafaGfx.Pixelize
|
||||
{
|
||||
public class PixelizePass : ScriptableRenderPass
|
||||
{
|
||||
private static int PixelBufferID = Shader.PropertyToID("_PixelBuffer");
|
||||
|
||||
private PixelizeFeature.PassSettings _settings;
|
||||
|
||||
private RenderTargetIdentifier _colorBuffer;
|
||||
private RenderTargetIdentifier _pixelBuffer;
|
||||
|
||||
private Material _material;
|
||||
private int _frameWidth;
|
||||
private int _frameHeight;
|
||||
|
||||
public PixelizePass(PixelizeFeature.PassSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
renderPassEvent = settings.RenderPassEvent;
|
||||
_material = CoreUtils.CreateEngineMaterial("Hidden/Szafa/Pixelize");
|
||||
}
|
||||
|
||||
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
|
||||
{
|
||||
_colorBuffer = renderingData.cameraData.renderer.cameraColorTargetHandle;
|
||||
RenderTextureDescriptor descriptor = renderingData.cameraData.cameraTargetDescriptor;
|
||||
|
||||
_frameHeight = _settings.FrameHeight;
|
||||
_frameWidth = (int) (_frameHeight * renderingData.cameraData.camera.aspect + 0.5f);
|
||||
|
||||
_material.SetVector("_BlockCount", new Vector2(_frameWidth, _frameHeight));
|
||||
_material.SetVector("_BlockSize", new Vector2(1.0f / _frameWidth, 1.0f / _frameHeight));
|
||||
_material.SetVector("_HalfBlockSize", new Vector2(0.5f / _frameWidth, 0.5f / _frameHeight));
|
||||
|
||||
descriptor.height = _frameWidth;
|
||||
descriptor.width = _frameWidth;
|
||||
|
||||
cmd.GetTemporaryRT(PixelBufferID, descriptor, FilterMode.Point);
|
||||
_pixelBuffer = new RenderTargetIdentifier(PixelBufferID);
|
||||
}
|
||||
|
||||
public override void OnCameraCleanup(CommandBuffer cmd)
|
||||
{
|
||||
if (cmd == null)
|
||||
{
|
||||
throw new System.ArgumentNullException(nameof(cmd));
|
||||
}
|
||||
|
||||
cmd.ReleaseTemporaryRT(PixelBufferID);
|
||||
}
|
||||
|
||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
||||
{
|
||||
CommandBuffer cmd = CommandBufferPool.Get();
|
||||
using (new ProfilingScope(cmd, new ProfilingSampler("Pixelize Pass")))
|
||||
{
|
||||
// Blit(cmd, _colorBuffer, _pixelBuffer, _material);
|
||||
// Blit(cmd, _pixelBuffer, _colorBuffer);
|
||||
}
|
||||
|
||||
context.ExecuteCommandBuffer(cmd);
|
||||
CommandBufferPool.Release(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5eb50486f41a47bb96c549c3cba1865d
|
||||
timeCreated: 1740752552
|
||||
3
Assets/SzafaKit/Runtime/World.meta
Normal file
3
Assets/SzafaKit/Runtime/World.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fda1b5a08e44d878d326cd3b7692e42
|
||||
timeCreated: 1740766816
|
||||
3
Assets/SzafaKit/Runtime/World/Characters.meta
Normal file
3
Assets/SzafaKit/Runtime/World/Characters.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf2d5c590c224ae6a7acbdbfa0b79b57
|
||||
timeCreated: 1740770300
|
||||
171
Assets/SzafaKit/Runtime/World/Characters/CharacterLocomotion.cs
Normal file
171
Assets/SzafaKit/Runtime/World/Characters/CharacterLocomotion.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.World.Characters
|
||||
{
|
||||
public class CharacterLocomotion : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private CharacterController _characterController;
|
||||
|
||||
[SerializeField]
|
||||
private float _maxMovementSpeed = 10f;
|
||||
|
||||
[SerializeField]
|
||||
private float _maxSprintSpeed = 15.0f;
|
||||
|
||||
[SerializeField]
|
||||
private float _jumpHeight = 1.0f;
|
||||
|
||||
[SerializeField]
|
||||
private float _gravity = 10f;
|
||||
|
||||
[SerializeField]
|
||||
private float _maxFallSpeed = 50f;
|
||||
|
||||
[SerializeField]
|
||||
private float _damping = 40.0f;
|
||||
|
||||
private Vector3 _pendingInputValue;
|
||||
private Vector3 _currentVelocity;
|
||||
|
||||
private bool _isSprinting;
|
||||
private bool _jumpRequested;
|
||||
private bool _isFalling;
|
||||
|
||||
public bool IsGrounded => _characterController.isGrounded;
|
||||
|
||||
public Vector3 Velocity => _currentVelocity;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
ConsumePendingInput();
|
||||
UpdateVerticalVelocity();
|
||||
|
||||
_characterController.Move(_currentVelocity * Time.deltaTime);
|
||||
|
||||
ApplyFriction();
|
||||
DetectFall();
|
||||
}
|
||||
|
||||
private void DetectFall()
|
||||
{
|
||||
if (_isFalling && _characterController.isGrounded)
|
||||
{
|
||||
_isFalling = false;
|
||||
}
|
||||
else if (!_characterController.isGrounded)
|
||||
{
|
||||
_isFalling = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConsumePendingInput()
|
||||
{
|
||||
if (!IsGrounded)
|
||||
{
|
||||
_pendingInputValue = Vector3.zero;
|
||||
return;
|
||||
}
|
||||
|
||||
_pendingInputValue.y = 0.0f;
|
||||
|
||||
float pendingInputMagnitude = _pendingInputValue.magnitude;
|
||||
Vector3 direction = Vector3.zero;
|
||||
|
||||
if (pendingInputMagnitude > 0.0f)
|
||||
{
|
||||
// normalize vector, reusing magnitude to avoid multiple sqrt calls
|
||||
direction = _pendingInputValue / pendingInputMagnitude;
|
||||
}
|
||||
|
||||
float movementSpeed = _isSprinting ? _maxSprintSpeed : _maxMovementSpeed;
|
||||
Vector3 movementVelocity = _currentVelocity;
|
||||
movementVelocity.y = 0.0f;
|
||||
movementVelocity += direction * (movementSpeed * pendingInputMagnitude);
|
||||
movementVelocity.y = 0.0f;
|
||||
|
||||
// Clamp speed
|
||||
float movementVelocityMagnitude = movementVelocity.magnitude;
|
||||
Vector3 movementVelocityDirection = movementVelocityMagnitude > 0.0f ? movementVelocity / movementVelocityMagnitude : Vector3.zero;
|
||||
|
||||
if (movementVelocityMagnitude > movementSpeed)
|
||||
{
|
||||
movementVelocityMagnitude = movementSpeed;
|
||||
}
|
||||
|
||||
movementVelocity = movementVelocityDirection * movementVelocityMagnitude;
|
||||
|
||||
_currentVelocity.x = movementVelocity.x;
|
||||
_currentVelocity.z = movementVelocity.z;
|
||||
|
||||
_pendingInputValue = Vector3.zero;
|
||||
}
|
||||
|
||||
private void UpdateVerticalVelocity()
|
||||
{
|
||||
if (_characterController.isGrounded)
|
||||
{
|
||||
if (_jumpRequested)
|
||||
{
|
||||
_currentVelocity.y = Mathf.Sqrt(2.0f * _gravity * _jumpHeight);
|
||||
_jumpRequested = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentVelocity.y = -1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentVelocity.y -= _gravity * Time.deltaTime;
|
||||
_currentVelocity.y = Mathf.Max(_currentVelocity.y, -_maxFallSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyFriction()
|
||||
{
|
||||
if (!IsGrounded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 movementVelocity = _currentVelocity;
|
||||
movementVelocity.y = 0.0f;
|
||||
|
||||
movementVelocity = Vector3.MoveTowards(movementVelocity, Vector3.zero, _damping * Time.deltaTime);
|
||||
|
||||
_currentVelocity.x = movementVelocity.x;
|
||||
_currentVelocity.z = movementVelocity.z;
|
||||
}
|
||||
|
||||
public void AddVelocity(Vector3 velocity)
|
||||
{
|
||||
_currentVelocity += velocity;
|
||||
}
|
||||
|
||||
public void AddMovementInput(Vector3 input, float scale)
|
||||
{
|
||||
_pendingInputValue += input * scale;
|
||||
}
|
||||
|
||||
public void Jump()
|
||||
{
|
||||
if (!_characterController.isGrounded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_jumpRequested = true;
|
||||
}
|
||||
|
||||
public void StartSprint()
|
||||
{
|
||||
_isSprinting = true;
|
||||
}
|
||||
|
||||
public void StopSprint()
|
||||
{
|
||||
_isSprinting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e909888e8f2465fb2f032b66bbd20a4
|
||||
timeCreated: 1740766822
|
||||
@@ -0,0 +1,63 @@
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.World.Characters
|
||||
{
|
||||
public class FirstPersonCamera : MonoBehaviour, IObjectPicker
|
||||
{
|
||||
[SerializeField]
|
||||
private float _pickDistance = 5.0f;
|
||||
|
||||
[SerializeField]
|
||||
private LayerMask _pickLayer;
|
||||
|
||||
[field: SerializeField]
|
||||
public float Sensitivity { get; set; }
|
||||
|
||||
[SerializeField]
|
||||
private float _pitchMin = -80f;
|
||||
|
||||
[SerializeField]
|
||||
private float _pitchMax = 80f;
|
||||
|
||||
[field: SerializeField]
|
||||
public CinemachineVirtualCamera Camera { get; private set; }
|
||||
|
||||
public float Pitch { get; private set; }
|
||||
public float Yaw { get; private set; }
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
Camera.transform.localRotation = Quaternion.Euler(Pitch, 0f, 0f);
|
||||
transform.rotation = Quaternion.Euler(0f, Yaw, 0f);
|
||||
}
|
||||
|
||||
public void Rotate(float x, float y)
|
||||
{
|
||||
float sens = Sensitivity;
|
||||
|
||||
Pitch -= y * sens;
|
||||
Pitch = Mathf.Clamp(Pitch, _pitchMin, _pitchMax);
|
||||
|
||||
Yaw += x * sens;
|
||||
}
|
||||
|
||||
public void SetLookDirection(Vector3 forward)
|
||||
{
|
||||
Pitch = Mathf.Asin(-forward.y) * Mathf.Rad2Deg;
|
||||
Yaw = Mathf.Atan2(forward.x, forward.z) * Mathf.Rad2Deg;
|
||||
}
|
||||
|
||||
public GameObject Pick()
|
||||
{
|
||||
Debug.DrawRay(Camera.transform.position, Camera.transform.forward, Color.white);
|
||||
|
||||
if (Physics.Raycast(Camera.transform.position, Camera.transform.forward, out RaycastHit hit, _pickDistance, _pickLayer))
|
||||
{
|
||||
return hit.transform.gameObject;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36206ce4a4cc47beb4d9ec97b46280c4
|
||||
timeCreated: 1740770311
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.World.Characters
|
||||
{
|
||||
public interface IObjectPicker
|
||||
{
|
||||
GameObject Pick();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c32032821224d308950e112dfe2b0a1
|
||||
timeCreated: 1740773164
|
||||
@@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SzafaKit.World.Characters
|
||||
{
|
||||
public class PhysicsObjectDragger : MonoBehaviour
|
||||
{
|
||||
[field: SerializeField]
|
||||
public float DampingFactor { get; private set; } = 1.0f;
|
||||
|
||||
[field: SerializeField]
|
||||
public float AngularSlowdown { get; private set; } = 90.0f;
|
||||
|
||||
[field: SerializeField]
|
||||
public float DragForce { get; private set; } = 10.0f;
|
||||
|
||||
public Rigidbody Current { get; private set; }
|
||||
|
||||
public Vector3 TargetWorldPosition { get; set; }
|
||||
|
||||
public bool IsDragging => Current != null;
|
||||
|
||||
public void Grab(Rigidbody physicsObject)
|
||||
{
|
||||
Current = physicsObject;
|
||||
Current.linearDamping = 5.0f;
|
||||
}
|
||||
|
||||
public void Drop()
|
||||
{
|
||||
if (Current == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Current.linearDamping = 0.0f;
|
||||
Current = null;
|
||||
}
|
||||
|
||||
public void FixedUpdate()
|
||||
{
|
||||
if (Current == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 direction = (TargetWorldPosition - Current.position).normalized;
|
||||
float distance = Vector3.Distance(TargetWorldPosition, Current.position);
|
||||
|
||||
Vector3 damping = Current.linearVelocity * DampingFactor;
|
||||
|
||||
Vector3 force = direction * Mathf.Clamp(distance * DragForce, 0, DragForce) - damping;
|
||||
Current.AddForce(force, ForceMode.Force);
|
||||
|
||||
Current.angularVelocity = Vector3.MoveTowards(Current.angularVelocity, Vector3.zero, Time.fixedDeltaTime * AngularSlowdown);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4259fd9e0d9418baf2f6c2d8aacb87e
|
||||
timeCreated: 1740772545
|
||||
Reference in New Issue
Block a user