Fix player bouncing off corners and align collider
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

- Исправлено поведение игрока при падении с высоты и разворотах (устранен сильный отскок от углов)
- Центрирован PolygonCollider2D по оси X на префабе character_defeat_4.prefab (m_Offset.x установлен в 0)
- Упрощена форма PolygonCollider2D до симметричного выпуклого шестиугольника
- Сохранен бэкап старого префаба игрока в Player_Old.prefab
This commit is contained in:
Данил Ярош 2026-07-16 15:39:43 +03:00
parent 5d86238fd0
commit 53afa5498e
22 changed files with 770 additions and 4234 deletions

View File

@ -1395,7 +1395,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0

View File

@ -1023,7 +1023,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0

View File

@ -1753,7 +1753,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -226,7 +226,10 @@ MonoBehaviour:
spreadRadiusX: 0.08
spreadRadiusY: 0.08
scale: 1
overrideSizeOverLife: 0
useScale3D: 0
scale3D: {x: 1, y: 1, z: 1}
rotation: {x: 0, y: 0, z: 0, w: 1}
overrideSizeOverLife: 1
sizeOverLife:
serializedVersion: 2
m_Curve:
@ -265,17 +268,17 @@ MonoBehaviour:
overrideColorOverLife: 1
colorOverLife:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 0.78431374}
key2: {r: 0, g: 0, b: 0, a: 0}
key0: {r: 0, g: 0.7648864, b: 1, a: 1}
key1: {r: 0.8468868, g: 0.48235297, b: 1, a: 0.78431374}
key2: {r: 1, g: 1, b: 1, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime1: 39321
ctime2: 65535
ctime3: 0
ctime4: 0
ctime5: 0
@ -291,9 +294,9 @@ MonoBehaviour:
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumColorKeys: 3
m_NumAlphaKeys: 3
overrideTexture: 0
overrideTexture: 1
texture: {fileID: 0}
--- !u!114 &2117915465640148810
MonoBehaviour:

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5e2f7649694807646a991b80b725b2e5
guid: 81fb42a4bd8f6ef4b96bc9dbbc0d0258
PrefabImporter:
externalObjects: {}
userData:

View File

@ -1687,7 +1687,7 @@ GameObject:
- component: {fileID: -3454622318120954605}
- component: {fileID: 7565635284530052038}
m_Layer: 0
m_Name: Player_New
m_Name: Player_Old
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -1,275 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &3899570649171643838
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1088233528469808677, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1088233528469808677, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1088233528469808677, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1844951699998854512, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1844951699998854512, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1844951699998854512, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2296100365438384468, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2296100365438384468, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2296100365438384468, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2346934753621729251, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2346934753621729251, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2346934753621729251, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4399818916102863011, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4399818916102863011, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4399818916102863011, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4846943149262119089, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4846943149262119089, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4846943149262119089, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4972258834068343481, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5354064293293011474, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5354064293293011474, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5354064293293011474, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6181501394461807322, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Name
value: character_defeat_4 Variant
objectReference: {fileID: 0}
- target: {fileID: 6186999574815194931, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6186999574815194931, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6186999574815194931, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6219394782786782508, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6219394782786782508, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6219394782786782508, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6313087823168944915, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6313087823168944915, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6313087823168944915, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6450388214406797760, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6450388214406797760, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6450388214406797760, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6505597154098655439, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6505597154098655439, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6505597154098655439, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6569994182173186684, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6569994182173186684, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6569994182173186684, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6580328407790038623, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6580328407790038623, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6580328407790038623, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6660693408115930507, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6660693408115930507, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6660693408115930507, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7211181599836190848, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7211181599836190848, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7211181599836190848, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8018266245638017402, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8018266245638017402, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8018266245638017402, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8997935938668111297, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8997935938668111297, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8997935938668111297, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6331eaa4049f7fc4a8107649fc474455, type: 3}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 81fb42a4bd8f6ef4b96bc9dbbc0d0258
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -247,7 +247,7 @@ PolygonCollider2D:
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0.43, y: -0.54}
m_Offset: {x: 0, y: -0.54}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
@ -259,19 +259,12 @@ PolygonCollider2D:
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: 1.1356617, y: 8.295978}
- {x: -0.06431764, y: 8.798516}
- {x: -1.1535529, y: 8.232804}
- {x: -1.4833037, y: 7.450561}
- {x: -1.3546549, y: 5.577679}
- {x: -1, y: 5}
- {x: -1, y: 1.15}
- {x: -0.3754585, y: 1.15}
- {x: 0.5933301, y: 1.15}
- {x: 0.9, y: 1.15}
- {x: 0.7, y: 5}
- {x: 1.3544114, y: 5.7226973}
- {x: 1.4644564, y: 7.0142045}
- - {x: -0.8, y: 1.15}
- {x: 0.8, y: 1.15}
- {x: 0.8, y: 7.5}
- {x: 0.5, y: 8.7}
- {x: -0.5, y: 8.7}
- {x: -0.8, y: 7.5}
m_UseDelaunayMesh: 0
--- !u!114 &2674134148909943391
MonoBehaviour:
@ -344,3 +337,10 @@ MonoBehaviour:
deathVFXOffset: {x: 0.2, y: -0.25, z: 0}
runVFX: {fileID: 8926484042661614526, guid: 4916628c3425a704989f02cb136b655b, type: 3}
runVFXOffset: {x: 0, y: 0, z: 0}
jumpVFX: {fileID: 0}
jumpVFXResourcePath: VFX/MVP_Dirt_VFX
jumpVFXOffset: {x: 0, y: 0, z: 0}
landingVFX: {fileID: 0}
landingVFXResourcePath: VFX/MVP_Dirt_VFX
landingVFXOffset: {x: 0, y: 0, z: 0}
landingMinFallSpeed: 1

View File

@ -221,7 +221,7 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 95449888}
m_Modifications:
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalScale.x
@ -245,7 +245,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: 0.12992167
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.w
@ -253,15 +253,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -923,6 +923,11 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!4 &23902550 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
m_PrefabInstance: {fileID: 446630965}
m_PrefabAsset: {fileID: 0}
--- !u!1 &25059596
GameObject:
m_ObjectHideFlags: 0
@ -2033,7 +2038,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!212 &40797979
SpriteRenderer:
serializedVersion: 2
@ -4129,6 +4134,40 @@ Transform:
- {fileID: 1476321862}
m_Father: {fileID: 1053302775}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &95449887
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 95449888}
m_Layer: 0
m_Name: Frogs
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &95449888
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 95449887}
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: 1599070937}
- {fileID: 23902550}
- {fileID: 1172208693}
m_Father: {fileID: 2037486992}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &95746896
GameObject:
m_ObjectHideFlags: 0
@ -134185,19 +134224,19 @@ CompositeCollider2D:
Y: 67019996
- m_Collider: {fileID: 878401281}
m_ColliderPaths:
- - X: 885726912
Y: 197020000
- - X: 1045726912
Y: 327020000
- X: 715726912
Y: 197020000
Y: 327020000
- X: 715726912
Y: 57019996
- X: 885726912
- X: 1045726912
Y: 57019996
m_CompositePaths:
m_Paths:
- - {x: 88.57266, y: 5.7019997}
- {x: 88.57266, y: 19.702}
- {x: 71.57269, y: 19.702028}
- - {x: 104.57266, y: 5.7019997}
- {x: 104.57266, y: 32.702}
- {x: 71.57269, y: 32.701973}
- {x: 71.57266, y: 21.702}
- {x: 36.572697, y: 21.701971}
- {x: 36.572723, y: 6.7019997}
@ -139105,7 +139144,7 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 95449888}
m_Modifications:
- target: {fileID: 1026952049702193566, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_Color.b
@ -139189,7 +139228,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: 0.12992167
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.w
@ -139197,15 +139236,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -168049,28 +168088,6 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!1 &932164648 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6550761235523395909, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
m_PrefabInstance: {fileID: 1449142390}
m_PrefabAsset: {fileID: 0}
--- !u!320 &932164657
PlayableDirector:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 932164648}
m_Enabled: 1
serializedVersion: 3
m_PlayableAsset: {fileID: 11400000, guid: 1a759cbde3c8dc248b11859b62334762, type: 2}
m_InitialState: 1
m_WrapMode: 2
m_DirectorUpdateMode: 1
m_InitialTime: 0
m_SceneBindings: []
m_ExposedReferences:
m_References: []
--- !u!1 &932512427
GameObject:
m_ObjectHideFlags: 0
@ -168848,19 +168865,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Size.x
value: 17
value: 33
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Size.y
value: 14
value: 27
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Offset.x
value: 5
value: 13
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Offset.y
value: 3.5
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_CompositeOperation
@ -260427,6 +260444,11 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!4 &1172208693 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
m_PrefabInstance: {fileID: 2037131261}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1172980721
GameObject:
m_ObjectHideFlags: 0
@ -318329,90 +318351,6 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!1001 &1449142390
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -953906007136484429, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: deathVFX
value:
objectReference: {fileID: 8926484042661614526, guid: 6c4fdce0f9a1b184d9c3660014bdfdb5, type: 3}
- target: {fileID: -953906007136484429, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5723917688524288437, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6106630833600239313, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395908, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395909, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395909, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6550761235523395915, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 6550761235523395909, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
insertIndex: -1
addedObject: {fileID: 932164657}
m_SourcePrefab: {fileID: 100100000, guid: 5e2f7649694807646a991b80b725b2e5, type: 3}
--- !u!1001 &1449273883
PrefabInstance:
m_ObjectHideFlags: 0
@ -327389,6 +327327,11 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!4 &1599070937 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
m_PrefabInstance: {fileID: 3288068}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1600969962
GameObject:
m_ObjectHideFlags: 0
@ -507350,9 +507293,9 @@ CompositeCollider2D:
- m_Collider: {fileID: 1442184985}
m_ColliderPaths:
- - X: 2265726720
Y: 597019968
Y: 687019968
- X: 2005726720
Y: 597019968
Y: 687019968
- X: 2005726720
Y: 487020000
- X: 2265726720
@ -507380,8 +507323,8 @@ CompositeCollider2D:
m_CompositePaths:
m_Paths:
- - {x: 226.57265, y: 48.702}
- {x: 226.57265, y: 59.701996}
- {x: 200.57268, y: 59.701965}
- {x: 226.57265, y: 68.701996}
- {x: 200.57268, y: 68.701965}
- {x: 200.5727, y: 48.702}
- - {x: 234.57265, y: 10.702}
- {x: 234.57265, y: 27.702}
@ -507544,7 +507487,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Size.y
value: 11
value: 19.999996
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Offset.x
@ -507552,7 +507495,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_Offset.y
value: 19
value: 23.499998
objectReference: {fileID: 0}
- target: {fileID: 4799275495668483708, guid: 86af44edd1f9ca248bd2f2a669401f8a, type: 3}
propertyPath: m_CompositeOperation
@ -514846,7 +514789,7 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 95449888}
m_Modifications:
- target: {fileID: 1026952049702193566, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_Color.b
@ -514930,7 +514873,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: 0.12992167
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.w
@ -514938,15 +514881,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2769071441779430884, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -515045,6 +514988,38 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9bc60fd998993ae49913b70d9583a6e5, type: 3}
--- !u!1 &2037486991
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2037486992}
m_Layer: 0
m_Name: Fauna
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2037486992
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2037486991}
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: 95449888}
m_Father: {fileID: 2144574669}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &2039693884 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2923341736873825775, guid: e5783e81b8b0fd648974f0ec7ebde930, type: 3}
@ -520558,6 +520533,7 @@ Transform:
- {fileID: 1829949916}
- {fileID: 1918398180}
- {fileID: 2022616203}
- {fileID: 2037486992}
m_Father: {fileID: 1053302775}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1000012292893215
@ -575813,6 +575789,10 @@ PrefabInstance:
propertyPath: m_Name
value: leaf_new_0
objectReference: {fileID: 0}
- target: {fileID: 4426242440828613974, guid: bf6fddc2a10c5d74a9311bdb44d2dbcb, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5817945200117649072, guid: bf6fddc2a10c5d74a9311bdb44d2dbcb, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -576054,15 +576034,11 @@ SceneRoots:
- {fileID: 7857954125673382157}
- {fileID: 601953095}
- {fileID: 1500894798}
- {fileID: 1866014609}
- {fileID: 1053302775}
- {fileID: 1449142390}
- {fileID: 5189102261111869253}
- {fileID: 523566710}
- {fileID: 2208544354061546943}
- {fileID: 3607579658351639123}
- {fileID: 40797980}
- {fileID: 8843872502559724393}
- {fileID: 1866014609}
- {fileID: 3288068}
- {fileID: 446630965}
- {fileID: 2037131261}

View File

@ -1,9 +1,10 @@
using System.Collections;
using System.Collections;
using UnityEngine;
using RR.Game2D.Behaviour;
using RR.Game2D.Behaviour.ScriptableObjects;
using RR.Game2D.Core.Managers;
using RR.Game2D.FX;
using UnityEngine.VFX;
namespace RR.Game2D.Animations
@ -17,12 +18,14 @@ namespace RR.Game2D.Animations
private SFXAsset _hurtSounds;
private Vector3 _vfxSpawnPoint;
private bool _deathScoreRegistered;
private Vector3 _creatureSize = Vector3.one;
private void Awake()
{
// Загружаем и кэшируем звуковые эффекты из контроллера врага
UpdateSFX();
Collider2D col = GetComponent<Collider2D>();
if (col) _creatureSize = col.bounds.size;
// Учитываем поворот объекта при вычислении смещения
Vector3 rotatedOffset = transform.rotation * deathVFXOffset;
_vfxSpawnPoint = (col ? col.bounds.center : transform.position) + rotatedOffset;
@ -32,8 +35,11 @@ namespace RR.Game2D.Animations
{
// Кэшируем ссылки на звуковые эффекты из контроллера врага
EnemyController controller = GetComponent<EnemyController>();
_stepSounds = controller.sfxAsset.stepSounds;
_hurtSounds = controller.sfxAsset.hurtSounds;
if (controller != null && controller.sfxAsset != null)
{
_stepSounds = controller.sfxAsset.stepSounds;
_hurtSounds = controller.sfxAsset.hurtSounds;
}
}
public void OnDeath() {}
@ -82,7 +88,16 @@ namespace RR.Game2D.Animations
}
// Создаем визуальный эффект смерти
if (deathVFX) VFXPool.Instance.Spawn(deathVFX, _vfxSpawnPoint, 1f);
if (deathVFX)
{
MvpVFXSpawnSettings spawnSettings = new MvpVFXSpawnSettings
{
useScale3D = true,
scale3D = _creatureSize * 0.5f,
rotation = transform.rotation
};
MvpVFXUtility.Spawn(deathVFX, null, _vfxSpawnPoint, 1f, spawnSettings);
}
// Уничтожаем врага
Destroy(gameObject);

View File

@ -121,7 +121,16 @@ namespace RR.Game2D.Animations
_deathVFXSpawnPoint = _col ? _col.bounds.center : transform.position + rotatedOffset;
if (deathVFX) VFXPool.Instance.Spawn(deathVFX, _deathVFXSpawnPoint, 1f);
if (deathVFX)
{
MvpVFXSpawnSettings spawnSettings = new MvpVFXSpawnSettings
{
useScale3D = true,
scale3D = (_col ? _col.bounds.size : Vector3.one) * 0.5f,
rotation = transform.rotation
};
MvpVFXUtility.Spawn(deathVFX, null, _deathVFXSpawnPoint, 1f, spawnSettings);
}
gameObject.layer = LayerMask.NameToLayer("Default");
// _rb.constraints = RigidbodyConstraints2D.FreezeRotation;
_controller.isDeadAtMoment = false;

View File

@ -94,12 +94,38 @@ namespace RR.Game2D.Behaviour
return SpawnNowInternal(null);
}
private void PopulateUsedSpawnPoints(HashSet<int> usedIndices)
{
if (spawnPoints == null || spawnPoints.Length == 0 || usedIndices == null)
return;
CleanupSpawnedObjects();
for (int i = 0; i < _spawnedObjects.Count; i++)
{
GameObject obj = _spawnedObjects[i];
if (obj == null) continue;
for (int j = 0; j < spawnPoints.Length; j++)
{
if (spawnPoints[j] == null) continue;
if (Vector3.Distance(obj.transform.position, spawnPoints[j].position) < 0.1f)
{
usedIndices.Add(j);
break;
}
}
}
}
public void SpawnCount(int count)
{
if (count <= 0)
return;
HashSet<int> usedSpawnPointIndices = new();
PopulateUsedSpawnPoints(usedSpawnPointIndices);
for (int i = 0; i < count; i++)
{
@ -117,6 +143,7 @@ namespace RR.Game2D.Behaviour
int toSpawn = target - currentAlive;
int spawnedCount = 0;
HashSet<int> usedSpawnPointIndices = new();
PopulateUsedSpawnPoints(usedSpawnPointIndices);
if (toSpawn <= 0)
return 0;

View File

@ -50,6 +50,20 @@ namespace RR.Game2D.Behaviour
"Count",
"count"
};
private static readonly string[] AnimationCurveOverrideNames =
{
"SizeOverLife",
"sizeOverLife",
"Size",
"size"
};
private static readonly string[] ScaleOverrideNames =
{
"Scale",
"scale",
"BaseScale",
"baseScale"
};
private void Awake()
{
@ -297,6 +311,20 @@ namespace RR.Game2D.Behaviour
if (visualEffect.HasFloat(propertyName))
visualEffect.ResetOverride(propertyName);
}
foreach (string propertyName in AnimationCurveOverrideNames)
{
if (visualEffect.HasAnimationCurve(propertyName))
visualEffect.ResetOverride(propertyName);
}
foreach (string propertyName in ScaleOverrideNames)
{
if (visualEffect.HasVector3(propertyName))
visualEffect.ResetOverride(propertyName);
else if (visualEffect.HasFloat(propertyName))
visualEffect.ResetOverride(propertyName);
}
}
Renderer renderer = vfxInstance.GetComponent<Renderer>();

View File

@ -28,6 +28,14 @@ namespace RR.Game2D.FX
[Min(0.01f)]
public float scale = 1f;
[Tooltip("Использовать трехмерный масштаб вместо равномерного.")]
public bool useScale3D;
public Vector3 scale3D = Vector3.one;
[Tooltip("Поворот объекта VFX. Если не задан, используется Quaternion.identity.")]
public Quaternion rotation = Quaternion.identity;
[Tooltip("Масштабировать весь spawned VFX по кривой в течение времени жизни эффекта.")]
public bool overrideSizeOverLife;

View File

@ -38,6 +38,20 @@ namespace RR.Game2D.FX
"Count",
"count"
};
private static readonly string[] AnimationCurvePropertyNames =
{
"SizeOverLife",
"sizeOverLife",
"Size",
"size"
};
private static readonly string[] ScalePropertyNames =
{
"Scale",
"scale",
"BaseScale",
"baseScale"
};
public static VisualEffectAsset LoadResourceAsset(string resourcePath)
{
@ -84,7 +98,26 @@ namespace RR.Game2D.FX
if (instance == null) continue;
if (settings != null && settings.overrideSizeOverLife && settings.sizeOverLife != null)
VFXPool.Instance.AnimateScaleOverLifetime(instance, settings.scale, settings.sizeOverLife, lifetime);
{
VisualEffect visualEffect = instance.GetComponent<VisualEffect>();
bool hasVfxCurve = false;
if (visualEffect != null)
{
foreach (string propertyName in AnimationCurvePropertyNames)
{
if (visualEffect.HasAnimationCurve(propertyName))
{
hasVfxCurve = true;
break;
}
}
}
if (!hasVfxCurve)
{
VFXPool.Instance.AnimateScaleOverLifetime(instance, settings.scale, settings.sizeOverLife, lifetime);
}
}
if (firstInstance == null)
firstInstance = instance;
@ -121,11 +154,33 @@ namespace RR.Game2D.FX
private static void ApplySettings(GameObject instance, VisualEffect visualEffect, MvpVFXSpawnSettings settings)
{
float scale = Mathf.Max(0.01f, settings?.scale ?? 1f);
instance.transform.localScale = Vector3.one * scale;
Vector3 scale = Vector3.one;
Quaternion rotation = Quaternion.identity;
if (settings != null)
{
scale = settings.useScale3D ? settings.scale3D : Vector3.one * settings.scale;
rotation = settings.rotation;
}
scale.x = Mathf.Max(0.01f, scale.x);
scale.y = Mathf.Max(0.01f, scale.y);
scale.z = Mathf.Max(0.01f, scale.z);
instance.transform.localScale = scale;
instance.transform.rotation = rotation;
ResetOverrides(instance, visualEffect);
if (visualEffect != null)
{
foreach (string propertyName in ScalePropertyNames)
{
if (visualEffect.HasVector3(propertyName))
visualEffect.SetVector3(propertyName, scale);
else if (visualEffect.HasFloat(propertyName))
visualEffect.SetFloat(propertyName, Mathf.Max(scale.x, scale.y));
}
}
if (settings == null)
return;
@ -166,6 +221,15 @@ namespace RR.Game2D.FX
}
}
if (settings.overrideSizeOverLife && settings.sizeOverLife != null && visualEffect != null)
{
foreach (string propertyName in AnimationCurvePropertyNames)
{
if (visualEffect.HasAnimationCurve(propertyName))
visualEffect.SetAnimationCurve(propertyName, settings.sizeOverLife);
}
}
Renderer renderer = instance.GetComponent<Renderer>();
if (renderer == null) return;
if (!settings.overrideColor && (!settings.overrideTexture || settings.texture == null)) return;
@ -215,6 +279,20 @@ namespace RR.Game2D.FX
if (visualEffect.HasFloat(propertyName))
visualEffect.ResetOverride(propertyName);
}
foreach (string propertyName in AnimationCurvePropertyNames)
{
if (visualEffect.HasAnimationCurve(propertyName))
visualEffect.ResetOverride(propertyName);
}
foreach (string propertyName in ScalePropertyNames)
{
if (visualEffect.HasVector3(propertyName))
visualEffect.ResetOverride(propertyName);
else if (visualEffect.HasFloat(propertyName))
visualEffect.ResetOverride(propertyName);
}
}
Renderer renderer = instance.GetComponent<Renderer>();

View File

@ -1,15 +1,14 @@
using System;
using System.IO;
using RR.Common.Controls;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;
using RR.Common.Managers;
using RR.Common.Settings;
using RR.Common.Utility;
using RR.Game2D.Behaviour;
using RR.Game2D.Entities;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;
namespace RR.Game2D.Core.Managers
{
@ -23,13 +22,13 @@ namespace RR.Game2D.Core.Managers
// Game settings (новая система)
public SettingsManager Settings { get; private set; }
// Audio control for game
public AudioManager Audio {get; private set;}
public AudioManager Audio { get; private set; }
// Payment control for game
public PaymentManager Payment {get; private set;}
public PaymentManager Payment { get; private set; }
// Balance control for game
public BalanceManager Balance {get; private set;}
public BalanceManager Balance { get; private set; }
// Inactivity control for game
public InactivityManager Inactivity {get; private set;}
public InactivityManager Inactivity { get; private set; }
// Plate control for game
public ComSystemManager Plate { get; private set; }
// Light control for game
@ -39,7 +38,7 @@ namespace RR.Game2D.Core.Managers
[Header("Globals")]
[SerializeField] private string globalsPrefabResourcePath = "Prefabs/Global/Globals";
[SerializeField] private string AudioMixerResourcePath = "Audio/Master";
private GameObject globals;
[Header("Пауза")]
@ -49,7 +48,7 @@ namespace RR.Game2D.Core.Managers
public int StartingLives { get; private set; } = 3;
public int MaxLives { get; private set; } = 3;
public int LivesIncrement { get; private set; } = 0;
[Header("Информация для игры")]
public int World { get; private set; } = 1;
public int Stage { get; private set; } = 1;
@ -58,15 +57,15 @@ namespace RR.Game2D.Core.Managers
public int Coins { get; private set; } = 0;
private int _lastLifeAwardCoinThreshold = 0;
private float? _pendingWinGameTime;
private float _gameStartTime;
[Header("Игрок")]
[SerializeField] private GameObject playerPrefab;
[SerializeField] private string playerPrefabResourcePath = "Prefabs/Player_New"; // Путь в Resources для загрузки префаба игрока, если не назначен в инспекторе
[SerializeField] private string playerPrefabResourcePath = "Prefabs/Player"; // Путь в Resources для загрузки префаба игрока, если не назначен в инспекторе
public GameObject PlayerObj { get; private set; }
private bool _shouldSpawnPlayer;
private void OnEnable() => SceneManager.sceneLoaded += OnSceneLoaded;
private void OnDisable() => SceneManager.sceneLoaded -= OnSceneLoaded;
@ -78,9 +77,9 @@ namespace RR.Game2D.Core.Managers
public event Action<int> LivesChanged; // Когда меняется кол-во жизней
public event Action<float> GameOverEvent; // Когда игрок проигрывает
public event Action<float> GameWonEvent; // Когда игрок выигрывает
#region Unity Lifetime
#region Unity Lifetime
// Singleton
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Initialize()
@ -112,7 +111,7 @@ namespace RR.Game2D.Core.Managers
FileLogger fileLogger = new(Path.Combine(Directory.GetParent(Application.dataPath)?.ToString() ?? Application.dataPath, "game.log"));
Logger.Initialize(fileLogger);
}
// Initialize Audio control
AudioMixer audioMixer = Resources.Load<AudioMixer>(AudioMixerResourcePath);
if (Audio == null)
@ -120,7 +119,7 @@ namespace RR.Game2D.Core.Managers
Audio = gameObject.AddComponent<AudioManager>();
Audio.Initialize(audioMixer);
}
// Initialize Global Scripts from prefab
if (globals == null)
{
@ -137,40 +136,40 @@ namespace RR.Game2D.Core.Managers
Debug.LogError($"[GameManager] Failed to load Globals prefab from {globalsPrefabResourcePath}");
}
}
// Initialize Settings Manager (новая система) from Globals
if (Settings == null) Settings = globals.GetComponent<SettingsManager>();
if (Settings == null) Settings = SettingsManager.Instance;
if (Settings != null)
{
Settings.OnSettingsLoaded += OnSettingsChanged;
Settings.OnSettingsSaved += OnSettingsChanged;
}
// Initialize Payment control
if (Payment == null) Payment = globals.GetComponent<PaymentManager>();
// Initialize Balance control
if (Balance == null) Balance = globals.GetComponent<BalanceManager>();
if (Balance == null) Balance = BalanceManager.Instance;
// Initialize Inactivity control
if (Inactivity == null) Inactivity = gameObject.AddComponent<InactivityManager>();
if (Inactivity == null) Inactivity = InactivityManager.Instance;
if (Plate == null) Plate = globals.GetComponent<ComSystemManager>();
if (Plate != null) Light = Plate.Light;
StartIdleEffects();
Payment.OnCreditAdded.AddListener(OnCreditAdded);
_gameStartTime = Time.unscaledTime;
MaxLives = StartingLives;
MaxLivesChanged?.Invoke(MaxLives);
if (SceneManager.GetActiveScene().name != "MainMenu") _shouldSpawnPlayer = true;
}
@ -179,7 +178,7 @@ namespace RR.Game2D.Core.Managers
if (!Light) return;
Light.StopBlink(false);
Light.StopSequence();
if (Instance == this) Instance = null;
}
@ -198,7 +197,7 @@ namespace RR.Game2D.Core.Managers
if (playerPrefab != null) return playerPrefab;
GameObject loaded = Resources.Load<GameObject>(playerPrefabResourcePath);
if (loaded == null)
{
Logger.LogError(
@ -209,10 +208,10 @@ namespace RR.Game2D.Core.Managers
}
return loaded;
}
#endregion
#region Payment Event Handlers
#endregion
#region Payment Event Handlers
private void OnCreditAdded(int newCount)
{
@ -224,57 +223,57 @@ namespace RR.Game2D.Core.Managers
}
}
// Debug.Log($"Max Lives: {MaxLives}");
MaxLivesChanged?.Invoke(MaxLives);
}
#endregion
#endregion
#region Settings Event Handlers
#region Settings Event Handlers
private void OnSettingsChanged()
{
if (Settings == null) return;
// Получаем настройки из нового SettingsManager
StartingLives = Settings.GetInt("gameplay.startLives");
LivesIncrement = Settings.GetInt("gameplay.additionalLives");
int currentCredits = Payment?.CreditsCount ?? 0;
MaxLives = currentCredits > 1 ? StartingLives + (currentCredits - 1) * LivesIncrement : StartingLives;
MaxLivesChanged?.Invoke(MaxLives);
}
#endregion
#endregion
#region Pause
#region Pause
/// <summary>
/// Метод паузы игры.
/// Ставит на паузу все SFX и саму игру
/// </summary>
/// <param name="pause">Ставить ли на паузу</param>
public void SetPause(bool pause)
{
if (IsPaused == pause) return;
IsPaused = pause;
/// <summary>
/// Метод паузы игры.
/// Ставит на паузу все SFX и саму игру
/// </summary>
/// <param name="pause">Ставить ли на паузу</param>
public void SetPause(bool pause)
{
if (IsPaused == pause) return;
IsPaused = pause;
Time.timeScale = pause ? 0f : 1f;
Audio.SmoothPauseMusic(pause);
Time.timeScale = pause ? 0f : 1f;
Audio.SmoothPauseMusic(pause);
PauseStateChanged?.Invoke(IsPaused);
}
PauseStateChanged?.Invoke(IsPaused);
}
// Можно заменить на другое поведение
/// <summary>
/// Метод переключателя паузы.
/// </summary>
public void TogglePause() => SetPause(!IsPaused);
// --
// Можно заменить на другое поведение
/// <summary>
/// Метод переключателя паузы.
/// </summary>
public void TogglePause() => SetPause(!IsPaused);
// --
#endregion
#endregion
#region Levels and Scene management
#region Levels and Scene management
/// <summary>
/// Начало новой игры.
@ -285,7 +284,7 @@ public void TogglePause() => SetPause(!IsPaused);
{
Debug.Log("[GameManager] NewGame called");
bool isFreeGame = Settings != null && Settings.GetBool("payment.freeGame");
// Проверка баланса перед началом игры
if (!isFreeGame && Balance != null && !Balance.CanStartGame())
{
@ -293,18 +292,18 @@ public void TogglePause() => SetPause(!IsPaused);
Debug.LogWarning("[GameManager] Cannot start - insufficient balance");
return;
}
int livesToGive = StartingLives;
int balanceToSpend = 0;
if (!isFreeGame && Balance != null)
{
int currentBalance = Balance.CurrentBalance;
int impulseCost = Settings?.GetInt("payment.paymentImpulseCost") ?? 10;
// Рассчитываем количество оплат
int totalImpulses = currentBalance / impulseCost;
// Первая оплата даёт базовые жизни
// Каждая дополнительная оплата даёт LivesIncrement жизней
if (totalImpulses > 0)
@ -312,27 +311,27 @@ public void TogglePause() => SetPause(!IsPaused);
int additionalImpulses = totalImpulses - 1;
int bonusLives = additionalImpulses * LivesIncrement;
livesToGive = StartingLives + bonusLives;
Debug.Log($"[GameManager] Balance: {currentBalance}, Impulses: {totalImpulses}, Base lives: {StartingLives}, Bonus lives: {bonusLives}, Total lives: {livesToGive}");
}
// Списываем ВЕСЬ баланс
balanceToSpend = currentBalance;
if (!Balance.SpendBalance(balanceToSpend, "начало игры (полный баланс)"))
{
Logger?.Log(gameObject.name, "Failed to spend balance for game start");
Debug.LogError("[GameManager] Failed to spend balance!");
return;
}
Debug.Log($"[GameManager] Spent entire balance: {balanceToSpend}, Lives given: {livesToGive}");
}
else if (isFreeGame)
{
Debug.Log("[GameManager] Free game mode enabled. Balance spend skipped.");
}
Lives = livesToGive;
LivesChanged?.Invoke(Lives);
Coins = 0;
@ -340,9 +339,9 @@ public void TogglePause() => SetPause(!IsPaused);
_pendingWinGameTime = null;
CoinsChanged?.Invoke(Coins);
ScoreSystem.Instance?.ResetStats();
_gameStartTime = Time.time;
Logger.Log(gameObject.name,$"Game start time = {_gameStartTime}");
Logger.Log(gameObject.name, $"Game start time = {_gameStartTime}");
// Активируем шапку и эффекты при начале игры
if (Light)
@ -351,13 +350,13 @@ public void TogglePause() => SetPause(!IsPaused);
if (Light.IsSequencePlaying) Light.StopSequence();
Light.SetLight(LightMode.Rainbow).Loop();
}
// Включаем отслеживание бездействия
if (Inactivity != null) Inactivity.EnableInactivityCheck();
LoadLevel(1, 1);
}
public void ContinueGame()
{
// Проверка баланса перед продолжением игры
@ -366,14 +365,14 @@ public void TogglePause() => SetPause(!IsPaused);
Logger?.Log(gameObject.name, "Cannot continue game - insufficient balance");
return;
}
// Списание баланса за продолжение игры
if (Balance != null && !Balance.SpendForContinue())
{
Logger?.Log(gameObject.name, "Failed to spend balance for continue");
return;
}
Lives = StartingLives + 1;
LivesChanged?.Invoke(Lives);
Coins = 0;
@ -381,10 +380,10 @@ public void TogglePause() => SetPause(!IsPaused);
_pendingWinGameTime = null;
CoinsChanged?.Invoke(Coins);
ScoreSystem.Instance?.ResetStats();
// Сбрасываем таймер бездействия
if (Inactivity != null) Inactivity.ResetInactivityTimer();
RespawnPlayer();
}
@ -396,12 +395,12 @@ public void TogglePause() => SetPause(!IsPaused);
private void GameOver()
{
float totalTime = Time.unscaledTime - _gameStartTime;
// Отключаем отслеживание бездействия
if (Inactivity != null) Inactivity.DisableInactivityCheck();
Light?.SetLight(LightMode.BlueWave, 30f);
GameOverEvent?.Invoke(totalTime);
}
// --
@ -409,12 +408,12 @@ public void TogglePause() => SetPause(!IsPaused);
private void GameWin()
{
float totalTime = _pendingWinGameTime ?? (Time.unscaledTime - _gameStartTime);
// Отключаем отслеживание бездействия
if (Inactivity != null) Inactivity.DisableInactivityCheck();
Light?.SetLight(LightMode.FinalWave, 30f);
GameWonEvent?.Invoke(totalTime);
_pendingWinGameTime = null;
}
@ -561,7 +560,7 @@ public void TogglePause() => SetPause(!IsPaused);
/// <param name="mode">Режим загрузки сцены</param>
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
string currentSceneName = SceneManager.GetActiveScene().name;
string currentSceneName = scene.name;
// При переходе в главное меню — гарантированно запускаем подсветку и мигание
if (currentSceneName == "MainMenu")
@ -603,9 +602,9 @@ public void TogglePause() => SetPause(!IsPaused);
.Loop();
}
#endregion
#endregion
#region Player management
#region Player management
/// <summary>
/// Метод для спавна игрока.
@ -709,9 +708,9 @@ public void TogglePause() => SetPause(!IsPaused);
playerHealth.ResetHealth();
}
#endregion
#endregion
#region Coins and Lives management
#region Coins and Lives management
/// <summary>
/// Метод добавления внутриигровой монеты
@ -743,7 +742,7 @@ public void TogglePause() => SetPause(!IsPaused);
}
// --
#endregion
#endregion
}
}

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- playerPrefab: {fileID: 3840518727065684471, guid: d705af614a982e74bba9e2a3b697f565, type: 3}
- playerPrefab: {fileID: 7194241041632862052, guid: 81fb42a4bd8f6ef4b96bc9dbbc0d0258, type: 3}
executionOrder: -1
icon: {instanceID: 0}
userData: