diff --git a/l2-unity/Assets/Resources/Prefab/Game.prefab b/l2-unity/Assets/Resources/Prefab/Game.prefab index 6ba950e86..88e2014de 100644 --- a/l2-unity/Assets/Resources/Prefab/Game.prefab +++ b/l2-unity/Assets/Resources/Prefab/Game.prefab @@ -13,9 +13,7 @@ GameObject: - component: {fileID: 2081572240581827940} - component: {fileID: 6227403751048920905} - component: {fileID: 5806285974765348047} - - component: {fileID: 6884152524510837502} - component: {fileID: 3414367172090928233} - - component: {fileID: 5694431573638000000} m_Layer: 0 m_Name: Game m_TagString: Untagged @@ -96,47 +94,6 @@ MonoBehaviour: - 17_25 - 16_24 - 17_24 ---- !u!114 &6884152524510837502 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6810262815525540192} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 02036ff767bda8941afeefd2b9dcebb0, type: 3} - m_Name: - m_EditorClassIdentifier: - pawns: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - currentPawnIndex: -1 - currentPawn: {fileID: 0} --- !u!114 &3414367172090928233 MonoBehaviour: m_ObjectHideFlags: 0 @@ -149,16 +106,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a7ec007b0cdb24343a752efda3c5bb5e, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &5694431573638000000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6810262815525540192} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4a2a645736c50d3468cc7a4d4b6acfe0, type: 3} - m_Name: - m_EditorClassIdentifier: - _characters: [] diff --git a/l2-unity/Assets/Scenes/Menu.unity b/l2-unity/Assets/Scenes/Menu.unity index 589571ecb..9fd1b1130 100644 --- a/l2-unity/Assets/Scenes/Menu.unity +++ b/l2-unity/Assets/Scenes/Menu.unity @@ -123,6 +123,75 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!21 &152725698 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Override + m_Shader: {fileID: 4800000, guid: a3a3bc8785681554d9558e2ea68f100e, 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: [] + m_Ints: [] + m_Floats: + - _AdvancedCat: 1 + - _Banner: 1 + - _DirectionalCat: 1 + - _DirectionalFalloff: 2 + - _DirectionalIntensity: 1 + - _FarDistanceHeight: 0 + - _FarDistanceOffset: 0 + - _FogAxisMode: 1 + - _FogCameraMode: 0 + - _FogCat: 1 + - _FogColorDuo: 1 + - _FogDistanceEnd: 100 + - _FogDistanceFalloff: 2 + - _FogDistanceStart: 0 + - _FogHeightEnd: 100 + - _FogHeightFalloff: 2 + - _FogHeightStart: 0 + - _FogIntensity: 1 + - _FogLayersMode: 0 + - _IsHeightFogPreset: 1 + - _IsHeightFogShader: 1 + - _JitterIntensity: 1 + - _NoiseCat: 1 + - _NoiseDistanceEnd: 50 + - _NoiseIntensity: 1 + - _NoiseMax: 1 + - _NoiseMin: 0 + - _NoiseModeBlend: 1 + - _NoiseScale: 30 + - _SkyboxCat: 1 + - _SkyboxFogBottom: 0 + - _SkyboxFogFalloff: 1 + - _SkyboxFogFill: 1 + - _SkyboxFogHeight: 1 + - _SkyboxFogIntensity: 1 + - _SkyboxFogOffset: 0 + m_Colors: + - _DirectionalColor: {r: 1, g: 0.7793103, b: 0.5, a: 1} + - _DirectionalDir: {r: 0, g: 0, b: 0, a: 0} + - _FogAxisOption: {r: 0, g: 0, b: 0, a: 0} + - _FogColorEnd: {r: 0.8862745, g: 1.443137, b: 2, a: 1} + - _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1} + - _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0} + m_BuildTextureStacks: [] --- !u!1 &413261805 GameObject: m_ObjectHideFlags: 0 @@ -220,10 +289,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 5694431573638000000, guid: 2bc6245aea0342f4f8c76719bfe12012, type: 3} - propertyPath: _characterMask.m_Bits - value: 8192 - objectReference: {fileID: 0} - target: {fileID: 6810262815525540192, guid: 2bc6245aea0342f4f8c76719bfe12012, type: 3} propertyPath: m_Name value: Game @@ -544,6 +609,41 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 824ee6870a432f9439e35ee4e771a1f5, type: 3} +--- !u!21 &1022123275 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Height Fog Global + m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Ints: [] + m_Floats: + - _AdvancedCat: 1 + - _Banner: 1 + - _DirectionalCat: 1 + - _FogCat: 1 + - _HeightFogGlobal: 1 + - _IsHeightFogShader: 1 + - _NoiseCat: 1 + - _SkyboxCat: 1 + m_Colors: [] + m_BuildTextureStacks: [] --- !u!108 &1061591418 stripped Light: m_CorrespondingSourceObject: {fileID: 4181994143891002370, guid: 824ee6870a432f9439e35ee4e771a1f5, type: 3} @@ -621,7 +721,7 @@ PrefabInstance: - target: {fileID: 14083907825353274, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3} propertyPath: m_Materials.Array.data[0] value: - objectReference: {fileID: 1844476951} + objectReference: {fileID: 1022123275} - target: {fileID: 2134954596300280144, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3} propertyPath: m_Name value: Height Fog Global @@ -747,15 +847,15 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3} ---- !u!21 &1344664817 +--- !u!21 &1305516715 Material: serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Override - m_Shader: {fileID: 4800000, guid: a3a3bc8785681554d9558e2ea68f100e, type: 3} + m_Name: Height Fog Global + m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 m_ValidKeywords: [] @@ -763,7 +863,7 @@ Material: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 + m_CustomRenderQueue: 3000 stringTagMap: {} disabledShaderPasses: [] m_LockedProperties: @@ -775,46 +875,12 @@ Material: - _AdvancedCat: 1 - _Banner: 1 - _DirectionalCat: 1 - - _DirectionalFalloff: 2 - - _DirectionalIntensity: 1 - - _FarDistanceHeight: 0 - - _FarDistanceOffset: 0 - - _FogAxisMode: 1 - - _FogCameraMode: 0 - _FogCat: 1 - - _FogColorDuo: 1 - - _FogDistanceEnd: 100 - - _FogDistanceFalloff: 2 - - _FogDistanceStart: 0 - - _FogHeightEnd: 100 - - _FogHeightFalloff: 2 - - _FogHeightStart: 0 - - _FogIntensity: 1 - - _FogLayersMode: 0 - - _IsHeightFogPreset: 1 + - _HeightFogGlobal: 1 - _IsHeightFogShader: 1 - - _JitterIntensity: 1 - _NoiseCat: 1 - - _NoiseDistanceEnd: 50 - - _NoiseIntensity: 1 - - _NoiseMax: 1 - - _NoiseMin: 0 - - _NoiseModeBlend: 1 - - _NoiseScale: 30 - _SkyboxCat: 1 - - _SkyboxFogBottom: 0 - - _SkyboxFogFalloff: 1 - - _SkyboxFogFill: 1 - - _SkyboxFogHeight: 1 - - _SkyboxFogIntensity: 1 - - _SkyboxFogOffset: 0 - m_Colors: - - _DirectionalColor: {r: 1, g: 0.7793103, b: 0.5, a: 1} - - _DirectionalDir: {r: 0, g: 0, b: 0, a: 0} - - _FogAxisOption: {r: 0, g: 0, b: 0, a: 0} - - _FogColorEnd: {r: 0.8862745, g: 1.443137, b: 2, a: 1} - - _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1} - - _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0} + m_Colors: [] m_BuildTextureStacks: [] --- !u!21 &1446991640 Material: @@ -885,41 +951,138 @@ Material: - _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1} - _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0} m_BuildTextureStacks: [] ---- !u!21 &1844476951 -Material: - serializedVersion: 8 +--- !u!1 &1592191233 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Height Fog Global - m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: 3000 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: [] - m_Ints: [] - m_Floats: - - _AdvancedCat: 1 - - _Banner: 1 - - _DirectionalCat: 1 - - _FogCat: 1 - - _HeightFogGlobal: 1 - - _IsHeightFogShader: 1 - - _NoiseCat: 1 - - _SkyboxCat: 1 - m_Colors: [] - m_BuildTextureStacks: [] + serializedVersion: 6 + m_Component: + - component: {fileID: 1592191236} + - component: {fileID: 1592191235} + - component: {fileID: 1592191234} + m_Layer: 0 + m_Name: Lobby + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1592191234 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1592191233} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4a2a645736c50d3468cc7a4d4b6acfe0, type: 3} + m_Name: + m_EditorClassIdentifier: + _selectedCharacterSlot: 0 + _selectedCharacter: + _slot: 0 + _name: + _account: + _id: 0 + _position: {x: 0, y: 0, z: 0} + _playerAppearance: + _collisonHeight: 0 + _collisionRadius: 0 + _lhand: 0 + _rhand: 0 + _race: 0 + _sex: 0 + _face: 0 + _hairStyle: 0 + _hairColor: 0 + _chest: 0 + _legs: 0 + _gloves: 0 + _feet: 0 + _characterRaceAnimation: 0 + _playerStatus: + _hp: 0 + _maxHp: 0 + _level: 0 + _cp: 0 + _maxCp: 0 + _mp: 0 + _maxMp: 0 + _isMage: 0 + _classId: 0 + _exp: 0 + _sp: 0 + _expPercent: 0 + _karma: 0 + _pvpKills: 0 + _pkKills: 0 + _deleteTimer: 0 + _clanId: 0 + _selected: 0 + _characters: [] + _characterMask: + serializedVersion: 2 + m_Bits: 8192 + _charSelectCamera: {fileID: 0} +--- !u!114 &1592191235 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1592191233} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 02036ff767bda8941afeefd2b9dcebb0, type: 3} + m_Name: + m_EditorClassIdentifier: + pawns: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + currentPawnIndex: -1 + currentPawn: {fileID: 0} +--- !u!4 &1592191236 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1592191233} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4546.5723, y: -118.85483, z: -316.70114} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &521792339377878846 PrefabInstance: m_ObjectHideFlags: 0 @@ -1226,6 +1389,7 @@ SceneRoots: - {fileID: 521792339377878846} - {fileID: 1147827734} - {fileID: 1001879169} + - {fileID: 1592191236} - {fileID: 461980325} - {fileID: 803395388} - {fileID: 1093616925} diff --git a/l2-unity/Assets/Scripts/Game/Character/CharacterCreator.cs b/l2-unity/Assets/Scripts/Game/Character/CharacterCreator.cs index dc5e859dd..4a1f02a55 100644 --- a/l2-unity/Assets/Scripts/Game/Character/CharacterCreator.cs +++ b/l2-unity/Assets/Scripts/Game/Character/CharacterCreator.cs @@ -151,10 +151,7 @@ public GameObject CreatePawn(CharacterRaceAnimation raceId, PlayerAppearance app public void PlacePawn(GameObject pawnObject, Logongrp pawnData, string name, GameObject container) { - Vector3 pawnPosition = new Vector3(pawnData.X, pawnData.Y, pawnData.Z); - pawnPosition = VectorUtils.ConvertPosToUnity(pawnPosition); - pawnObject.transform.position = pawnPosition; - pawnObject.transform.eulerAngles = new Vector3(0, 360.00f * pawnData.Yaw / 65536, 0); + UpdatePawnPosAndRot(pawnObject, pawnData); pawnObject.transform.name = name; pawnObject.transform.parent = container.transform; @@ -167,6 +164,13 @@ public void PlacePawn(GameObject pawnObject, Logongrp pawnData, string name, Gam animController.SetBool("wait_" + gear.WeaponAnim, true); } + public void UpdatePawnPosAndRot(GameObject pawnObject, Logongrp pawnData) { + Vector3 pawnPosition = new Vector3(pawnData.X, pawnData.Y, pawnData.Z); + pawnPosition = VectorUtils.ConvertPosToUnity(pawnPosition); + pawnObject.transform.position = pawnPosition; + pawnObject.transform.eulerAngles = new Vector3(0, 360.00f * pawnData.Yaw / 65536, 0); + } + public void RotatePawn(bool right) { _pawnRotating = true; _pawnRotatingRight = right; diff --git a/l2-unity/Assets/Scripts/Game/Character/CharacterSelector.cs b/l2-unity/Assets/Scripts/Game/Character/CharacterSelector.cs index 45d47dce8..070e81347 100644 --- a/l2-unity/Assets/Scripts/Game/Character/CharacterSelector.cs +++ b/l2-unity/Assets/Scripts/Game/Character/CharacterSelector.cs @@ -11,6 +11,7 @@ public class CharacterSelector : MonoBehaviour [SerializeField] private Camera _charSelectCamera; private GameObject _container; private List _pawnData; + private List _characterGameObjects; public Camera Camera { get { return _charSelectCamera; } set { _charSelectCamera = value; } } public int SelectedSlot { get { return _selectedCharacterSlot; } } @@ -28,9 +29,19 @@ void Awake() { } public void SetCharacterList(List characters) { - _container = new GameObject("Characters"); - _characters = characters; + if(_container == null) { + _container = new GameObject("Characters"); + } + + if (_characterGameObjects != null) { + _characterGameObjects.ForEach((go) => { + Destroy(go); + }); + } + + _characters = characters; _pawnData = LogongrpTable.Instance.Logongrps; + _characterGameObjects = new List(); _selectedCharacterSlot = -1; for (int i = 0; i < characters.Count; i++) { @@ -42,10 +53,21 @@ public void SpawnCharacterSlot(int id) { GameObject pawnObject = CharacterCreator.Instance.CreatePawn(_characters[id].CharacterRaceAnimation, _characters[id].PlayerAppearance); pawnObject.GetComponent().CharacterInfo = _characters[id]; CharacterCreator.Instance.PlacePawn(pawnObject, _pawnData[id], _characters[id].Name, _container); + _characterGameObjects.Add(pawnObject); } public void SelectCharacter(int slot) { if (slot >= 0 && slot < _characters.Count) { + if (_selectedCharacterSlot == slot) { + return; + } + + if(_selectedCharacterSlot != -1) { + CharacterCreator.Instance.UpdatePawnPosAndRot(_characterGameObjects[_selectedCharacterSlot], _pawnData[_selectedCharacterSlot]); + } + + CharacterCreator.Instance.UpdatePawnPosAndRot(_characterGameObjects[slot], _pawnData[7]); + _selectedCharacterSlot = slot; _selectedCharacter = _characters[slot]; }