Compare commits

...

52 Commits

Author SHA1 Message Date
0ea7e7ca84 All settings migrated, stuff should work 2025-09-24 15:28:13 +02:00
aeaa977294 The feel is fine 2025-09-24 15:16:31 +02:00
783541a776 Working Developer Settings 2025-09-24 13:31:15 +02:00
8b96a5d0c3 IMplement basic Developer Settings 2025-09-24 12:21:21 +02:00
Michal Pikulski
f07ce88331 Refactor the settings to remove the old class 2025-09-24 10:30:28 +02:00
Michal Pikulski
404f6f4e5c Working synchronous Addressables settings loading 2025-09-23 15:30:21 +02:00
Michal Pikulski
197aedddb0 Migrate settings to a more manageable structure and implement Service Locator pattern for runtime Addressables retrieval 2025-09-23 14:43:02 +02:00
Michal Pikulski
4b206b9b2e Little Trafalgar dust trail fun 2025-09-23 11:05:35 +02:00
2ae2bc3ac5 Updates to make sure the build goes through 2025-09-22 15:40:41 +02:00
1a9c82f5d7 Touch up touch input 2025-09-22 15:01:53 +02:00
da07f778c3 Move around scripts to cleanup the Minigame structure 2025-09-22 14:50:51 +02:00
96aad806a9 Merge branch 'main' of https://homelab.tailf7f81b.ts.net/tschesky/AppleHillsProduction 2025-09-22 14:49:36 +02:00
f589b53234 Changes to the Diving For Pictures Minigame 2025-09-22 14:49:17 +02:00
28c342235c Merge pull request 'damianNonsense' (#4) from damianNonsense into main
Reviewed-on: #4
2025-09-22 12:46:50 +00:00
322bd5377d SoundGenerator Puzzle Section WIP
Started on the sound generator section of the soundbird puzzle, plus organized folders.
2025-09-22 14:37:16 +02:00
2923ba0851 Lawnmowwer is working!
Done with the lawnmower section of the puzzle.
2025-09-22 14:37:16 +02:00
8ed40e137c Update Quarry.unity 2025-09-22 14:37:16 +02:00
aa16f36eac Lawnmower Chase Work
Gardener chases but gets flipped
2025-09-22 14:37:15 +02:00
6abf25b2ad Working gardener chase without flipping 2025-09-22 14:37:15 +02:00
e1ee73bfb4 Trying to make the lawnmower flip 2025-09-22 14:37:15 +02:00
074b052abe Populate minigame with obstacles and monster spawns (#5)
- Simulated "fake" physics and collisions
- Object pooling for tiles, obstacles and monster spawns
- Base monster scoring with proximity triggers and depth multiplier

Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #5
2025-09-22 14:37:15 +02:00
5305c20b00 Create a diving minigame MVP (#6)
- Obstacles
- Tiles
- Object pooling
- Monster spawns
- Scoring
- Minigame End

Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Reviewed-on: #6
2025-09-22 12:16:32 +00:00
46755fecb3 Populate minigame with obstacles and monster spawns (#5)
- Simulated "fake" physics and collisions
- Object pooling for tiles, obstacles and monster spawns
- Base monster scoring with proximity triggers and depth multiplier

Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #5
2025-09-21 07:32:56 +00:00
2ec5c3d855 Working monster spawns 2025-09-19 13:46:24 +02:00
40c3867d29 Add a sprite variant generator and create monster prefabs for heads 2025-09-19 13:14:47 +02:00
d110616907 Add Monster Spawn points, monster head placeholders. Add utility for prefab variation by sprite selection. 2025-09-19 12:51:25 +02:00
31f2ce338d Component move/copy utility 2025-09-19 10:08:58 +02:00
24f5228003 Started to deal with the Gardener
This is driving slightly insane plus I forgot ALL the programs Alex told me about, i'll adress this tomorrow.
2025-09-17 15:30:59 +02:00
8b3c9a09cb Anna Lise is working!
A lot of hardcoded stuff but Anna Lise is working
2025-09-17 13:59:21 +02:00
DamianCorazza
6a24330ea0 Trying to make Anna Lise face the Bird before taking the picture to no avail
Can't make her look at the bird, got pissed off, gonna try tomorrow.
2025-09-16 23:52:28 +02:00
81723a3cdb Anna Lise Moves To the Spot and takes a picture when the bird is there. 2025-09-16 18:14:00 +02:00
70a14e5a84 AnneLise moved to the spot, still trying to make her interactable then 2025-09-16 15:52:30 +02:00
Michal Pikulski
a455e34ed0 Add a sprite collider generator tool window 2025-09-16 15:39:49 +02:00
Michal Pikulski
75be338065 Working generic object pooling, pool monitor editor tool and batch component adder editor tool 2025-09-16 15:02:57 +02:00
Michal Pikulski
bcc6f05058 Working single-purpose object pooling solution 2025-09-16 15:02:57 +02:00
2c56d0e1de Merge pull request 'Introduce unit and integration tests' (#3) from integration_test into main
Reviewed-on: #3
2025-09-15 07:32:18 +00:00
Michal Pikulski
793da5e568 [Test] Cleanup assemblies for Android build test. Working game flow, working build, passing unit tests 2025-09-15 09:30:27 +02:00
Michal Pikulski
15414f9414 [Test] Add unit tests for base code 2025-09-14 13:35:35 +02:00
Michal Pikulski
8cffe0b161 Fix build issues due to comparison operators 2025-09-12 16:47:45 +02:00
Michal Pikulski
0057ae9fa3 Fix issues with scene loading, introduce an intermediate bootstrap scene 2025-09-12 15:37:26 +02:00
Michal Pikulski
cec661586e Fix issues with disabled puzzle steps not registering with puzzle manager 2025-09-12 14:39:08 +02:00
DamianCorazza
a580a5f35a Eyes are working now 2025-09-12 13:57:26 +02:00
Michal Pikulski
c0df46f9f8 Update dispatchers and message for slotting items 2025-09-12 13:24:04 +02:00
Michal Pikulski
9a12a79698 Fix item removed being called one too many times, fix Pulver movement 2025-09-12 13:14:21 +02:00
DamianCorazza
d62516f0cb Added Bird Spawning and Copied behaviour for the hammer bird 2025-09-12 12:49:07 +02:00
Michal Pikulski
445e36975d Interactable items - slotting working correctly and calling the dispatchers each time 2025-09-12 12:26:44 +02:00
Michal Pikulski
ef96d80d51 Small touchups of input and A* graphing 2025-09-12 10:36:23 +02:00
DamianCorazza
afd3bc3863 Eyes Work nicely now, switching items is a bit iffy though 2025-09-12 10:30:49 +02:00
9b590ca6ec Made Changes To slotted items (not fully functional but progressing)
Added Unity events to the Slotting Items, the eyes react fine but sometimes they fuck up. gonna check that out later.
2025-09-11 17:03:56 +02:00
Michal Pikulski
15b8146815 Update Puzzle Manager's initialization sequence 2025-09-11 15:48:44 +02:00
Michal Pikulski
c5b8561b73 Quick scene browser tab 2025-09-11 15:29:28 +02:00
fd220de298 Merge pull request 'rewrite_interactables' (#2) from rewrite_interactables into main
Reviewed-on: #2
2025-09-11 12:39:22 +00:00
331 changed files with 31953 additions and 1982 deletions

5
.gitignore vendored
View File

@@ -99,3 +99,8 @@ InitTestScene*.unity*
# Auto-generated scenes by play mode tests
/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*
.idea/.idea.AppleHillsProduction/.idea/indexLayout.xml
.vscode/extensions.json
.vscode/launch.json
.vscode/settings.json
.idea/.idea.AppleHillsProduction/.idea/indexLayout.xml

View File

@@ -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: dea69d41f90c6ea4fa55c27c1d60c145, type: 3}
m_Name: AddressableAssetGroupSortSettings
m_EditorClassIdentifier:
sortOrder:
- eb8a37153d819c44194f7ce97570a3d3
- 2b3d7cefec0915e42be04aebf0400a56
- 6f3207429a65b3e4b83935ac19791077
- c62e6f02418e19949bca4cccdd5fa02e

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 32c1a9c8651793e41848a173d66d98fd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: 6f3207429a65b3e4b83935ac19791077
m_currentHash:
serializedVersion: 2
Hash: c0cf00979528ae95d3583c572e4eb343
Hash: 00000000000000000000000000000000
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 0
m_CatalogRequestsTimeout: 0
@@ -61,6 +61,7 @@ MonoBehaviour:
m_GroupAssets:
- {fileID: 11400000, guid: efe7e1728e73e9546ac5dfee2eff524f, type: 2}
- {fileID: 11400000, guid: 6e4927e7e19eef34b93dc2baa9e9e8e2, type: 2}
- {fileID: 11400000, guid: e25c7672a65b5974bb354fcfb2a8400c, type: 2}
- {fileID: 11400000, guid: 7fcc03e584505ed4381983b6ebb1179d, type: 2}
m_BuildSettings:
m_LogResourceManagerExceptions: 1

View File

@@ -0,0 +1,41 @@
%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: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
m_Name: Settings
m_EditorClassIdentifier:
m_GroupName: Settings
m_GUID: c62e6f02418e19949bca4cccdd5fa02e
m_SerializeEntries:
- m_GUID: 328ce914b893df646be3ad3c62755453
m_Address: Settings/Developer/DivingDeveloperSettings
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 35bfcff00faa72c4eb272a9e8288f965
m_Address: Settings/PlayerFollowerSettings
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 8f5195fb013895049a19488fd4d8f2a1
m_Address: Settings/InteractionSettings
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: a9569848f604a6540827d4d4bb0a35c2
m_Address: Settings/DivingMinigameSettings
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 11da9bb90d9dd5848b4f7629415a6937, type: 2}
m_SchemaSet:
m_Schemas: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e25c7672a65b5974bb354fcfb2a8400c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -11,6 +11,9 @@ AnimatorStateTransition:
- m_ConditionMode: 1
m_ConditionEvent: IsTalking
m_EventTreshold: 0
- m_ConditionMode: 4
m_ConditionEvent: speed
m_EventTreshold: 0.1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8246786244015671829}
m_Solo: 0
@@ -58,7 +61,7 @@ AnimatorState:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ANIM_Annelise_Camera_TakePhoto
m_Speed: 1
m_Speed: 5
m_CycleOffset: 0
m_Transitions:
- {fileID: 72347323649537359}
@@ -74,7 +77,7 @@ AnimatorState:
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 10efbd38167aad04298e975a0f5a5b03, type: 2}
m_Tag:
m_SpeedParameter:
m_SpeedParameter: speed
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
@@ -90,8 +93,8 @@ AnimatorStateTransition:
m_ConditionEvent: IsTalking
m_EventTreshold: 0
- m_ConditionMode: 3
m_ConditionEvent: Speed
m_EventTreshold: 0
m_ConditionEvent: speed
m_EventTreshold: 0.01
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -209390523250253645}
m_Solo: 0
@@ -144,12 +147,6 @@ AnimatorController:
m_Name: Annelise_Camera
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Speed
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: TakePhoto
m_Type: 9
m_DefaultFloat: 0
@@ -162,6 +159,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: speed
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@@ -184,8 +187,8 @@ AnimatorStateTransition:
m_Name:
m_Conditions:
- m_ConditionMode: 3
m_ConditionEvent: Speed
m_EventTreshold: 0
m_ConditionEvent: speed
m_EventTreshold: 0.1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -209390523250253645}
m_Solo: 0
@@ -212,8 +215,8 @@ AnimatorStateTransition:
m_ConditionEvent: IsTalking
m_EventTreshold: 0
- m_ConditionMode: 4
m_ConditionEvent: Speed
m_EventTreshold: 0.1
m_ConditionEvent: speed
m_EventTreshold: 0.01
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6759965249582913303}
m_Solo: 0
@@ -267,13 +270,13 @@ AnimatorStateMachine:
m_Position: {x: 40, y: 270, z: 0}
- serializedVersion: 1
m_State: {fileID: -209390523250253645}
m_Position: {x: 50, y: 420, z: 0}
m_Position: {x: 40, y: 540, z: 0}
- serializedVersion: 1
m_State: {fileID: -4318263607971929773}
m_Position: {x: 330, y: 340, z: 0}
m_Position: {x: 190, y: 410, z: 0}
- serializedVersion: 1
m_State: {fileID: 8246786244015671829}
m_Position: {x: -240, y: 390, z: 0}
m_Position: {x: -100, y: 410, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
@@ -293,8 +296,8 @@ AnimatorStateTransition:
m_Name:
m_Conditions:
- m_ConditionMode: 3
m_ConditionEvent: Speed
m_EventTreshold: 0
m_ConditionEvent: speed
m_EventTreshold: 0.1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -209390523250253645}
m_Solo: 0
@@ -318,8 +321,8 @@ AnimatorStateTransition:
m_Name:
m_Conditions:
- m_ConditionMode: 4
m_ConditionEvent: Speed
m_EventTreshold: 0.1
m_ConditionEvent: speed
m_EventTreshold: 0.01
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6759965249582913303}
m_Solo: 0
@@ -425,8 +428,8 @@ AnimatorStateTransition:
m_Name:
m_Conditions:
- m_ConditionMode: 4
m_ConditionEvent: Speed
m_EventTreshold: 0.1
m_ConditionEvent: speed
m_EventTreshold: 0.01
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6759965249582913303}
m_Solo: 0

View File

@@ -1,5 +1,30 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-8622141701191891965
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: NoGuess
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5993408738867988234}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-7993130233709895848
AnimatorStateTransition:
m_ObjectHideFlags: 1
@@ -17,7 +42,7 @@ AnimatorStateTransition:
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.9594595
m_HasExitTime: 0
@@ -37,6 +62,7 @@ AnimatorState:
m_CycleOffset: 0
m_Transitions:
- {fileID: -169883073761575190}
- {fileID: -953515106580102534}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -52,6 +78,31 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-953515106580102534
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: RightGuess
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -92837137932308198}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.87903225
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-169883073761575190
AnimatorStateTransition:
m_ObjectHideFlags: 1
@@ -59,14 +110,17 @@ AnimatorStateTransition:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: NoGuess
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5993408738867988234}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.8076923
m_HasExitTime: 1
@@ -84,7 +138,9 @@ AnimatorState:
m_Name: ANIM_BirdEyes_Correct
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: -8622141701191891965}
- {fileID: 1249646924704393990}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -121,6 +177,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: NoGuess
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@@ -134,6 +196,31 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1101 &1249646924704393990
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: WrongGuess
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -2838832837941805979}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &4511680777278260622
AnimatorStateTransition:
m_ObjectHideFlags: 1
@@ -151,7 +238,7 @@ AnimatorStateTransition:
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.9594595
m_HasExitTime: 0
@@ -201,10 +288,10 @@ AnimatorStateMachine:
m_Position: {x: 40, y: 350, z: 0}
- serializedVersion: 1
m_State: {fileID: -2838832837941805979}
m_Position: {x: -70, y: 450, z: 0}
m_Position: {x: -100, y: 450, z: 0}
- serializedVersion: 1
m_State: {fileID: -92837137932308198}
m_Position: {x: 150, y: 450, z: 0}
m_Position: {x: 200, y: 450, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []

View File

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

View File

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

View File

@@ -45,14 +45,14 @@ AnimatorStateMachine:
m_Position: {x: -120, y: 440, z: 0}
- serializedVersion: 1
m_State: {fileID: -4345756845471828943}
m_Position: {x: 200, y: 420, z: 0}
m_Position: {x: 230, y: 440, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_EntryPosition: {x: 80, y: 130, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1953973717063047684}
@@ -64,10 +64,11 @@ AnimatorState:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ANIM_Gardener_Scared
m_Speed: 1
m_Speed: 0.5
m_CycleOffset: 0
m_Transitions:
- {fileID: 2668893367386582248}
- {fileID: 5345143784295595667}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -91,10 +92,11 @@ AnimatorState:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ANIM_Gardener_Chase
m_Speed: 1
m_Speed: 0.5
m_CycleOffset: 0
m_Transitions:
- {fileID: -2076711753281386268}
- {fileID: 3331597516917425559}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -189,11 +191,11 @@ AnimatorStateTransition:
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75409836
m_HasExitTime: 1
m_HasFixedDuration: 1
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
@@ -250,3 +252,53 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &3331597516917425559
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: IsScared?
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4517652540075123250}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.16666669
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5345143784295595667
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: IsScared?
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4345756845471828943}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.16666669
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View File

@@ -1,9 +1,8 @@
fileFormatVersion: 2
guid: 0d863bca9b2680743bd08a98ae378772
guid: e0fea2035fd22e64392c401493442839
folderAsset: yes
timeCreated: 1522266281
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
%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: DustParticleMaterial
m_Shader: {fileID: 4800000, guid: e260cfa7296ee7642b167f1eb5be5023, 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:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: b9d432b4d3650ba44824ca95d422fe00, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _EnableExternalAlpha: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0ae7738b822ad0e4d9f65ef0c03aacce
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,195 @@
fileFormatVersion: 2
guid: 03a5936ba20198b48a228a1cb0ccf1e0
TextureImporter:
internalIDToNameTable:
- first:
213: 1508337238920719353
second: dust_cloud_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: dust_cloud_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 239
height: 164
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 9fbec5f2ab0bee410800000000000000
internalID: 1508337238920719353
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
dust_cloud_0: 1508337238920719353
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,195 @@
fileFormatVersion: 2
guid: 47c77f51628506e43a3a29e93e2ef24b
TextureImporter:
internalIDToNameTable:
- first:
213: -2531649364063002299
second: dust_cloud_2_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: dust_cloud_2_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 372
height: 254
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 5416e2f0156cddcd0800000000000000
internalID: -2531649364063002299
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
dust_cloud_2_0: -2531649364063002299
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,221 @@
fileFormatVersion: 2
guid: b9d432b4d3650ba44824ca95d422fe00
TextureImporter:
internalIDToNameTable:
- first:
213: -756740347226745237
second: dust_particles_0
- first:
213: 2076369268542635579
second: dust_particles_1
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: dust_particles_0
rect:
serializedVersion: 2
x: 0
y: 172
width: 239
height: 163
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: b661850e9a48f75f0800000000000000
internalID: -756740347226745237
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: dust_particles_1
rect:
serializedVersion: 2
x: 0
y: 0
width: 239
height: 165
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: b3e750249deb0dc10800000000000000
internalID: 2076369268542635579
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
dust_particles_0: -756740347226745237
dust_particles_1: 2076369268542635579
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -0,0 +1,194 @@
fileFormatVersion: 2
guid: 1021fffcba2a03d40ae5371555089a22
TextureImporter:
internalIDToNameTable:
- first:
213: 7766407121562134464
second: monster_head1_0
- first:
213: -9125130289615156199
second: monster_head1_1
- first:
213: -3901095240998639361
second: monster_head1_2
- first:
213: 8247604547213676640
second: monster_head1_3
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: monster_head1_1
rect:
serializedVersion: 2
x: 10
y: 5
width: 246
height: 345
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 91cc45e39560d5180800000000000000
internalID: -9125130289615156199
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: e64f2633c5a06984296cf655c4c0de04
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
monster_head1_0: 7766407121562134464
monster_head1_1: -9125130289615156199
monster_head1_2: -3901095240998639361
monster_head1_3: 8247604547213676640
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -0,0 +1,190 @@
fileFormatVersion: 2
guid: e9ac6c3e349f9b247a0ea03665da57ce
TextureImporter:
internalIDToNameTable:
- first:
213: -7812277834941893986
second: monster_head2_0
- first:
213: 8776893643225885828
second: monster_head2_1
- first:
213: -1611368835902351828
second: monster_head2_2
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: monster_head2_0
rect:
serializedVersion: 2
x: 31
y: 0
width: 200
height: 275
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: e9271a943b6359390800000000000000
internalID: -7812277834941893986
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 53b458ab419e36f47a2f4e7800de67d7
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
monster_head2_0: -7812277834941893986
monster_head2_1: 8776893643225885828
monster_head2_2: -1611368835902351828
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,190 @@
fileFormatVersion: 2
guid: 1043ceca06eb2ac48b22c20d281278b0
TextureImporter:
internalIDToNameTable:
- first:
213: 4139348639081821586
second: monster_head3_0
- first:
213: 2144489520682081444
second: monster_head3_1
- first:
213: 6575383119194002169
second: monster_head3_2
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: monster_head3_0
rect:
serializedVersion: 2
x: 29
y: 0
width: 199
height: 286
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 295f7f1f7abe17930800000000000000
internalID: 4139348639081821586
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: c24627f1ff7adbc498117b1ab2dc914c
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
monster_head3_0: 4139348639081821586
monster_head3_1: 2144489520682081444
monster_head3_2: 6575383119194002169
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -0,0 +1,190 @@
fileFormatVersion: 2
guid: c85ce41979ed896429c62330c546d3ce
TextureImporter:
internalIDToNameTable:
- first:
213: -3471612407960728276
second: monster_head4_0
- first:
213: 7033164403599601001
second: monster_head4_1
- first:
213: -8127244325322508915
second: monster_head4_2
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: monster_head4_0
rect:
serializedVersion: 2
x: 21
y: 0
width: 221
height: 278
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: c2d89a988ea52dfc0800000000000000
internalID: -3471612407960728276
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: dd6e5478aaac282458b9f8d39a624aca
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
monster_head4_0: -3471612407960728276
monster_head4_1: 7033164403599601001
monster_head4_2: -8127244325322508915
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,169 @@
fileFormatVersion: 2
guid: 5e07c2b448e92b740aa0cedeaec6b17b
TextureImporter:
internalIDToNameTable:
- first:
213: -6472171441532308910
second: HornOnPLACEHOLDER_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: HornOnPLACEHOLDER_0
rect:
serializedVersion: 2
x: 6
y: 52
width: 218
height: 135
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 252f90e6d5a3e26a0800000000000000
internalID: -6472171441532308910
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
HornOnPLACEHOLDER_0: -6472171441532308910
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -1,10 +1,10 @@
fileFormatVersion: 2
guid: 2e6d5c9e1ab5664428bd966573578533
guid: c5858285e4dccc040b7e7c1f7386cb9e
TextureImporter:
internalIDToNameTable:
- first:
213: 385901794228357913
second: HornPLACEHOLDER_0
213: -7985933250357003947
second: HornPLACEHOLDER 1_0
externalObjects: {}
serializedVersion: 13
mipmaps:
@@ -126,13 +126,13 @@ TextureImporter:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: HornPLACEHOLDER_0
name: HornPLACEHOLDER 1_0
rect:
serializedVersion: 2
x: 7
y: 34
width: 213
height: 167
x: 17
y: 47
width: 197
height: 113
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
@@ -141,8 +141,8 @@ TextureImporter:
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 91bca2323affa5500800000000000000
internalID: 385901794228357913
spriteID: 5597d7425044c2190800000000000000
internalID: -7985933250357003947
vertices: []
indices:
edges: []
@@ -161,7 +161,7 @@ TextureImporter:
spriteCustomMetadata:
entries: []
nameFileIdTable:
HornPLACEHOLDER_0: 385901794228357913
HornPLACEHOLDER 1_0: -7985933250357003947
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -0,0 +1,327 @@
fileFormatVersion: 2
guid: 464f70d7647a22a4aa688ffc2b6654cc
TextureImporter:
internalIDToNameTable:
- first:
213: -4444670910754578914
second: LawnMowerMovingPLACEHOLDER_0
- first:
213: 6348190279078284696
second: LawnMowerMovingPLACEHOLDER_1
- first:
213: 5233908553689211412
second: LawnMowerMovingPLACEHOLDER_2
- first:
213: -877913300417174042
second: LawnMowerMovingPLACEHOLDER_3
- first:
213: 7052581180763600252
second: LawnMowerMovingPLACEHOLDER_4
- first:
213: 4839952163610979709
second: LawnMowerMovingPLACEHOLDER_5
- first:
213: -5099098398506052249
second: LawnMowerMovingPLACEHOLDER_6
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_0
rect:
serializedVersion: 2
x: 24
y: 13
width: 569
height: 384
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: e1e16f40b5b5152c0800000000000000
internalID: -4444670910754578914
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_1
rect:
serializedVersion: 2
x: 416
y: 7
width: 14
height: 20
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 89d8c07bc6d491850800000000000000
internalID: 6348190279078284696
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_2
rect:
serializedVersion: 2
x: 632
y: 13
width: 570
height: 384
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 4122681691492a840800000000000000
internalID: 5233908553689211412
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_3
rect:
serializedVersion: 2
x: 1013
y: 11
width: 24
height: 26
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 6e52b01318601d3f0800000000000000
internalID: -877913300417174042
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_4
rect:
serializedVersion: 2
x: 1238
y: 13
width: 575
height: 384
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: c75f40db73dcfd160800000000000000
internalID: 7052581180763600252
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_5
rect:
serializedVersion: 2
x: 1861
y: 11
width: 568
height: 386
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: d7d6ae189d6fa2340800000000000000
internalID: 4839952163610979709
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: LawnMowerMovingPLACEHOLDER_6
rect:
serializedVersion: 2
x: 2243
y: 10
width: 24
height: 26
alignment: 9
pivot: {x: 0.5, y: 0.2}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 7659842d50d5c39b0800000000000000
internalID: -5099098398506052249
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 3d4135416001629439aa7297ef718481
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries:
- key: SpriteEditor.SliceSettings
value: '{"sliceOnImport":false,"gridCellCount":{"x":1.0,"y":1.0},"gridSpriteSize":{"x":100.0,"y":100.0},"gridSpriteOffset":{"x":0.0,"y":0.0},"gridSpritePadding":{"x":0.0,"y":0.0},"pivot":{"x":0.5,"y":0.20000000298023225},"autoSlicingMethod":0,"spriteAlignment":9,"slicingType":0,"keepEmptyRects":false,"isAlternate":false}'
nameFileIdTable:
LawnMowerMovingPLACEHOLDER_0: -4444670910754578914
LawnMowerMovingPLACEHOLDER_1: 6348190279078284696
LawnMowerMovingPLACEHOLDER_2: 5233908553689211412
LawnMowerMovingPLACEHOLDER_3: -877913300417174042
LawnMowerMovingPLACEHOLDER_4: 7052581180763600252
LawnMowerMovingPLACEHOLDER_5: 4839952163610979709
LawnMowerMovingPLACEHOLDER_6: -5099098398506052249
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
%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: LawnMowerMovingPLACEHOLDER
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
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:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 464f70d7647a22a4aa688ffc2b6654cc, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- PixelSnap: 0
- _EnableExternalAlpha: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cba74e1bf006eed439d8cc2938aeddf1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,195 @@
fileFormatVersion: 2
guid: ad9b785acb09cb247ae2c8cd895863de
TextureImporter:
internalIDToNameTable:
- first:
213: 5958968447627082961
second: DivingBackground_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WindowsStoreApps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: DivingBackground_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 1080
height: 1981
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 1dcb29c2b3282b250800000000000000
internalID: 5958968447627082961
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
DivingBackground_0: 5958968447627082961
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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: 84e39aac66cf4a10a89abc01b04b13af, type: 3}
m_Name: InteractWithFootballBird
m_EditorClassIdentifier:
stepId: InteractFootballBird
displayName: Interact Football Bird
description: Take a picture of the Football bird
icon: {fileID: 0}
unlocks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0df54e69020c39e44b3b486cd6ac475a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -16,4 +16,5 @@ MonoBehaviour:
displayName: Football in luring spot A
description: Place the Football into luring spot A
icon: {fileID: 0}
unlocks: []
unlocks:
- {fileID: 11400000, guid: 0df54e69020c39e44b3b486cd6ac475a, type: 2}

View File

@@ -16,5 +16,4 @@ MonoBehaviour:
displayName: Start Lawnmower
description: Start up the lawnmower so the Gardener runs after it.
icon: {fileID: 0}
unlocks:
- {fileID: 11400000, guid: f9da68caaae2a244885a13cf2e2e45c0, type: 2}
unlocks: []

View File

@@ -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: 84e39aac66cf4a10a89abc01b04b13af, type: 3}
m_Name: InteractWithHammerBird
m_EditorClassIdentifier:
stepId: InteractHammerBird
displayName: Interact With HammerBird
description: TAke picture of the HammerBird
icon: {fileID: 0}
unlocks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 829fc7c8046e0844f93bf810dc1f0ebd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -16,4 +16,5 @@ MonoBehaviour:
displayName: Nails In Lure C
description: Place the Nails in the Luring Spot C
icon: {fileID: 0}
unlocks: []
unlocks:
- {fileID: 11400000, guid: 829fc7c8046e0844f93bf810dc1f0ebd, type: 2}

View File

@@ -0,0 +1,20 @@
{
"name": "AppleHillsEditor",
"rootNamespace": "",
"references": [
"GUID:d91d3f46515a6954caa674697afbf416",
"GUID:69448af7b92c7f342b298e06a37122aa",
"GUID:9e24947de15b9834991c9d8411ea37cf"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1ab90989592ecff489d33348d53a0d25
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,207 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace AppleHills.Core.Settings.Editor
{
public class DeveloperSettingsEditorWindow : EditorWindow
{
private Vector2 scrollPosition;
private List<BaseDeveloperSettings> allDeveloperSettings = new List<BaseDeveloperSettings>();
private string[] tabNames = new string[] { "Diving", "Other Systems" }; // Add more tabs as needed
private int selectedTab = 0;
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
private GUIStyle headerStyle;
[MenuItem("AppleHills/Developer Settings Editor")]
public static void ShowWindow()
{
GetWindow<DeveloperSettingsEditorWindow>("Developer Settings");
}
private void OnEnable()
{
LoadAllSettings();
}
private void LoadAllSettings()
{
allDeveloperSettings.Clear();
serializedSettingsObjects.Clear();
// Find all developer settings assets
string[] guids = AssetDatabase.FindAssets("t:BaseDeveloperSettings");
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
BaseDeveloperSettings settings = AssetDatabase.LoadAssetAtPath<BaseDeveloperSettings>(path);
if (settings != null)
{
allDeveloperSettings.Add(settings);
serializedSettingsObjects[settings.GetType().Name] = new SerializedObject(settings);
}
}
// If any settings are missing, create them
CreateSettingsIfMissing<DivingDeveloperSettings>("DivingDeveloperSettings");
// Add more developer settings types here as needed
// CreateSettingsIfMissing<OtherDeveloperSettings>("OtherDeveloperSettings");
}
private void CreateSettingsIfMissing<T>(string fileName) where T : BaseDeveloperSettings
{
if (!allDeveloperSettings.Any(s => s is T))
{
// Check if the asset already exists
string[] guids = AssetDatabase.FindAssets($"t:{typeof(T).Name}");
if (guids.Length == 0)
{
// Create the settings folder if it doesn't exist
string settingsFolder = "Assets/Settings/Developer";
if (!AssetDatabase.IsValidFolder("Assets/Settings"))
{
AssetDatabase.CreateFolder("Assets", "Settings");
}
if (!AssetDatabase.IsValidFolder(settingsFolder))
{
AssetDatabase.CreateFolder("Assets/Settings", "Developer");
}
// Create new settings asset
T settings = CreateInstance<T>();
string path = $"{settingsFolder}/{fileName}.asset";
AssetDatabase.CreateAsset(settings, path);
AssetDatabase.SaveAssets();
allDeveloperSettings.Add(settings);
serializedSettingsObjects[typeof(T).Name] = new SerializedObject(settings);
Debug.Log($"Created missing developer settings asset: {path}");
}
else
{
// Load existing asset
string path = AssetDatabase.GUIDToAssetPath(guids[0]);
T settings = AssetDatabase.LoadAssetAtPath<T>(path);
allDeveloperSettings.Add(settings);
serializedSettingsObjects[typeof(T).Name] = new SerializedObject(settings);
}
}
}
private void OnGUI()
{
if (headerStyle == null)
{
headerStyle = new GUIStyle(EditorStyles.boldLabel);
headerStyle.fontSize = 14;
headerStyle.margin = new RectOffset(0, 0, 10, 10);
}
EditorGUILayout.Space(10);
EditorGUILayout.LabelField("Apple Hills Developer Settings", headerStyle);
EditorGUILayout.HelpBox("This editor is for technical settings intended for developers. For gameplay settings, use the Game Settings editor.", MessageType.Info);
EditorGUILayout.Space(10);
selectedTab = GUILayout.Toolbar(selectedTab, tabNames);
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
switch (selectedTab)
{
case 0: // Diving
DrawSettingsEditor<DivingDeveloperSettings>();
break;
case 1: // Other Systems
EditorGUILayout.HelpBox("Other developer settings will appear here as they are added.", MessageType.Info);
break;
// Add additional cases as more developer settings types are added
}
EditorGUILayout.EndScrollView();
EditorGUILayout.Space(10);
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Refresh", GUILayout.Width(100)))
{
LoadAllSettings();
}
if (GUILayout.Button("Save All", GUILayout.Width(100)))
{
foreach (var serializedObj in serializedSettingsObjects.Values)
{
serializedObj.ApplyModifiedProperties();
EditorUtility.SetDirty(serializedObj.targetObject);
}
AssetDatabase.SaveAssets();
Debug.Log("All developer settings saved!");
}
EditorGUILayout.EndHorizontal();
}
private void DrawSettingsEditor<T>() where T : BaseDeveloperSettings
{
BaseDeveloperSettings settings = allDeveloperSettings.Find(s => s is T);
if (settings == null)
{
EditorGUILayout.HelpBox($"No {typeof(T).Name} found. Click Refresh to create one.", MessageType.Warning);
return;
}
SerializedObject serializedObj = serializedSettingsObjects[typeof(T).Name];
serializedObj.Update();
EditorGUILayout.Space(10);
// Draw all properties
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
while (property.NextVisible(enterChildren))
{
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
// Group headers
if (property.isArray && property.propertyType == SerializedPropertyType.Generic)
{
EditorGUILayout.LabelField(property.displayName, EditorStyles.boldLabel);
}
EditorGUILayout.PropertyField(property, true);
}
// Apply changes
if (serializedObj.ApplyModifiedProperties())
{
EditorUtility.SetDirty(settings);
// Trigger OnValidate on the asset
if (settings != null)
{
settings.OnValidate();
}
}
}
// Helper method to highlight important fields
private void DrawHighlightedProperty(SerializedProperty property, string tooltip = null)
{
GUI.backgroundColor = new Color(0.8f, 0.9f, 1f); // Light blue for developer settings
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
GUI.backgroundColor = Color.white;
EditorGUILayout.PropertyField(property, new GUIContent(property.displayName, tooltip));
EditorGUILayout.EndVertical();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8ab6d9fee0924431b8e22edb500b35df
timeCreated: 1758710778

View File

@@ -0,0 +1,48 @@
using UnityEditor;
using UnityEngine;
using Minigames.DivingForPictures;
/// <summary>
/// Custom editor for DivingGameManager that adds runtime buttons for testing surfacing and other functionality
/// </summary>
[CustomEditor(typeof(DivingGameManager))]
public class DivingGameManagerEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
// Draw the default inspector
DrawDefaultInspector();
// Get the target DivingGameManager
DivingGameManager manager = (DivingGameManager)target;
// Add space between default inspector and custom buttons
EditorGUILayout.Space(10);
// Separator line
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
// Add a label for the runtime testing section
EditorGUILayout.LabelField("Runtime Testing", EditorStyles.boldLabel);
// Only enable the buttons during play mode
EditorGUI.BeginDisabledGroup(!Application.isPlaying);
// Add the button to call StartSurfacing
if (GUILayout.Button("Start Surfacing", GUILayout.Height(30)))
{
manager.StartSurfacing();
}
// Add a button for breaking a rope (for testing damage)
if (GUILayout.Button("Break Rope (Test Damage)", GUILayout.Height(30)))
{
manager.ForceBreakRope();
}
EditorGUI.EndDisabledGroup();
// Add explanatory text
EditorGUILayout.HelpBox("These buttons only work in Play Mode. 'Start Surfacing' will reverse the trench direction, slow bubbles, and reverse obstacles. 'Break Rope' simulates player taking damage.", MessageType.Info);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8bbb340d8d9b4af581770757e86cc1f8
timeCreated: 1758532258

View File

@@ -0,0 +1,97 @@
using UnityEditor;
using AppleHills.Core.Settings;
using UnityEngine;
namespace AppleHills.Editor
{
/// <summary>
/// Provides access to settings in editor (non-play) mode
/// </summary>
[InitializeOnLoad]
public static class EditorSettingsProvider
{
private static PlayerFollowerSettings _playerFollowerSettings;
private static InteractionSettings _interactionSettings;
private static DivingMinigameSettings _divingMinigameSettings;
// Static constructor will be called when Unity loads/reloads scripts
static EditorSettingsProvider()
{
LoadAllSettings();
// Set up the delegates in SettingsAccess
AppleHills.SettingsAccess.SetupEditorProviders(
GetPlayerStopDistance,
GetPlayerStopDistanceDirectInteraction
);
// Subscribe to asset changes to auto-refresh when settings are modified
EditorApplication.delayCall += () =>
{
EditorApplication.projectChanged += OnProjectChanged;
};
}
private static void OnProjectChanged()
{
// Check if any settings assets have changed
if (HasSettingsChanged())
{
LoadAllSettings();
RefreshSceneViews();
}
}
private static bool HasSettingsChanged()
{
// Simplified check - you might want to make this more efficient
// by checking timestamps or specific files
return true;
}
public static void LoadAllSettings()
{
_playerFollowerSettings = AssetDatabase.LoadAssetAtPath<PlayerFollowerSettings>("Assets/Settings/PlayerFollowerSettings.asset");
_interactionSettings = AssetDatabase.LoadAssetAtPath<InteractionSettings>("Assets/Settings/InteractionSettings.asset");
_divingMinigameSettings = AssetDatabase.LoadAssetAtPath<DivingMinigameSettings>("Assets/Settings/MinigameSettings.asset");
// Re-register the delegates in case they were lost
AppleHills.SettingsAccess.SetupEditorProviders(
GetPlayerStopDistance,
GetPlayerStopDistanceDirectInteraction
);
Debug.Log("Editor settings loaded for Scene View use");
}
public static void RefreshSceneViews()
{
// Force scene views to repaint to refresh gizmos
SceneView.RepaintAll();
}
// Implementation of delegate methods
private static float GetPlayerStopDistance()
{
return _interactionSettings?.PlayerStopDistance ?? 6.0f;
}
private static float GetPlayerStopDistanceDirectInteraction()
{
return _interactionSettings?.PlayerStopDistanceDirectInteraction ?? 2.0f;
}
// Other utility methods
public static T GetSettings<T>() where T : BaseSettings
{
if (typeof(T) == typeof(PlayerFollowerSettings))
return _playerFollowerSettings as T;
else if (typeof(T) == typeof(InteractionSettings))
return _interactionSettings as T;
else if (typeof(T) == typeof(DivingMinigameSettings))
return _divingMinigameSettings as T;
return null;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1e8da573a8db4ea892fe476592276e0f
timeCreated: 1758634265

View File

@@ -18,7 +18,7 @@ namespace Editor
private enum ItemType { None, Pickup, ItemSlot }
private ItemType _itemType = ItemType.None;
[MenuItem("Tools/Item Prefab Editor")]
[MenuItem("AppleHills/Item Prefab Editor")]
public static void ShowWindow()
{
var window = GetWindow<ItemPrefabEditorWindow>("Item Prefab Editor");

View File

@@ -0,0 +1,54 @@
using UnityEngine;
using UnityEditor;
namespace AppleHills.Core.Settings.Editor
{
/// <summary>
/// Custom property drawer for layer fields to display a dropdown with layer names
/// </summary>
[CustomPropertyDrawer(typeof(LayerAttribute))]
public class LayerPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
// Draw a nice layer selection dropdown like the one in Unity inspector
if (property.propertyType == SerializedPropertyType.Integer)
{
property.intValue = EditorGUI.LayerField(position, label, property.intValue);
}
else
{
EditorGUI.LabelField(position, label.text, "Use [Layer] with int fields only");
}
EditorGUI.EndProperty();
}
}
/// <summary>
/// Custom property drawer for LayerMask fields to display a mask dropdown with layer names
/// </summary>
[CustomPropertyDrawer(typeof(LayerMaskAttribute))]
public class LayerMaskPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
// Draw a nice layer mask selection like the one in Unity inspector
if (property.propertyType == SerializedPropertyType.LayerMask)
{
property.intValue = EditorGUI.MaskField(position, label,
property.intValue, UnityEditorInternal.InternalEditorUtility.layers);
}
else
{
EditorGUI.LabelField(position, label.text, "Use [LayerMask] with LayerMask fields only");
}
EditorGUI.EndProperty();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6c6b274ce7b14e91bf5a294a23ba0609
timeCreated: 1758711663

View File

@@ -23,7 +23,7 @@ namespace Editor
private bool _createNext = false;
[MenuItem("Tools/Prefab Creator")]
[MenuItem("AppleHills/Item Prefab Creator")]
public static void ShowWindow()
{
var window = GetWindow<PrefabCreatorWindow>("Prefab Creator");

View File

@@ -0,0 +1,776 @@
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Editor
{
public class PrefabVariantGeneratorWindow : EditorWindow
{
// Renderer configuration class to track sprite renderers and their assigned sprites
[System.Serializable]
private class RendererConfig
{
public string Path; // Hierarchy path to the renderer
public string Name; // Display name for the renderer
public SpriteRenderer Renderer; // Reference to the actual renderer
public Sprite CurrentSprite; // Current sprite in the renderer
public List<Sprite> AssignedSprites = new List<Sprite>(); // Sprites to use for variants
public bool Enabled = true; // Whether to include in variant generation
public bool Expanded = true; // UI expanded state
public Vector2 ScrollPosition; // Scroll position for sprite list
}
// Main fields
private GameObject sourcePrefab;
private GameObject previousSourcePrefab;
private List<RendererConfig> detectedRenderers = new List<RendererConfig>();
private Vector2 mainScrollPosition;
private string variantSaveFolder = "Assets/Prefabs/Variants";
private string namingPattern = "{0}_{1}"; // Default: {0} = prefab name, {1} = first renderer sprite
private bool userChangedSavePath = false;
private int estimatedVariantCount = 0;
private int maxSafeVariantCount = 100; // Warn above this number
private GUIStyle boldFoldoutStyle;
private bool showDefaultHelp = true;
// Editor window setup
[MenuItem("Tools/Sprite Variant Generator")]
public static void ShowWindow()
{
var window = GetWindow<PrefabVariantGeneratorWindow>("Prefab Variant Generator");
window.minSize = new Vector2(500, 600);
}
private void OnEnable()
{
// Initialize styles on enable to avoid null reference issues
boldFoldoutStyle = new GUIStyle(EditorStyles.foldout)
{
fontStyle = FontStyle.Bold
};
}
private void OnGUI()
{
// Initialize styles if needed
if (boldFoldoutStyle == null)
{
boldFoldoutStyle = new GUIStyle(EditorStyles.foldout)
{
fontStyle = FontStyle.Bold
};
}
EditorGUILayout.LabelField("Prefab Variant Generator", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Create multiple prefab variants with different sprites assigned to renderers.", MessageType.Info);
mainScrollPosition = EditorGUILayout.BeginScrollView(mainScrollPosition);
// Source Prefab Selection
EditorGUILayout.Space();
EditorGUILayout.LabelField("Step 1: Select Source Prefab", EditorStyles.boldLabel);
// Store previous selection to detect changes
GameObject newSourcePrefab = (GameObject)EditorGUILayout.ObjectField("Source Prefab", sourcePrefab, typeof(GameObject), false);
// Check if prefab selection changed
if (newSourcePrefab != previousSourcePrefab)
{
sourcePrefab = newSourcePrefab;
previousSourcePrefab = newSourcePrefab;
// Auto-set save folder to match source prefab's directory if a valid prefab is selected
if (sourcePrefab != null && !userChangedSavePath)
{
string prefabPath = AssetDatabase.GetAssetPath(sourcePrefab);
if (!string.IsNullOrEmpty(prefabPath))
{
variantSaveFolder = Path.GetDirectoryName(prefabPath).Replace("\\", "/");
}
}
// Find sprite renderers in the prefab
FindRenderersInPrefab();
// Clear default help once a prefab is selected
if (sourcePrefab != null)
{
showDefaultHelp = false;
}
}
// Warn if not a prefab
if (sourcePrefab != null && !PrefabUtility.IsPartOfPrefabAsset(sourcePrefab) && !PrefabUtility.IsPartOfPrefabInstance(sourcePrefab))
{
EditorGUILayout.HelpBox("Please select a prefab asset.", MessageType.Warning);
}
// Display default help if no prefab selected
if (showDefaultHelp && sourcePrefab == null)
{
EditorGUILayout.HelpBox(
"This tool lets you create prefab variants with different sprites.\n\n" +
"1. Select a source prefab\n" +
"2. Assign sprites to each detected sprite renderer\n" +
"3. Generate all combinations as prefab variants",
MessageType.Info
);
}
// Only show the rest if a valid prefab is selected
if (sourcePrefab != null)
{
// Renderer sections
EditorGUILayout.Space();
EditorGUILayout.LabelField("Step 2: Configure Sprite Renderers", EditorStyles.boldLabel);
if (detectedRenderers.Count == 0)
{
EditorGUILayout.HelpBox("No sprite renderers found in prefab. A new renderer will be created.", MessageType.Info);
}
else
{
EditorGUILayout.HelpBox($"{detectedRenderers.Count} sprite renderer{(detectedRenderers.Count > 1 ? "s" : "")} found in prefab.", MessageType.Info);
}
// Display each renderer configuration
for (int i = 0; i < detectedRenderers.Count; i++)
{
DrawRendererSection(detectedRenderers[i], i);
}
// Update estimated variant count
UpdateVariantCount();
// Output settings
EditorGUILayout.Space();
EditorGUILayout.LabelField("Step 3: Output Settings", EditorStyles.boldLabel);
// Save folder
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Save Folder");
EditorGUILayout.SelectableLabel(variantSaveFolder, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
if (GUILayout.Button("Select...", GUILayout.Width(80)))
{
string newFolder = PrefabEditorUtility.SelectFolder(variantSaveFolder, "Prefabs/Variants");
if (newFolder != variantSaveFolder)
{
variantSaveFolder = newFolder;
userChangedSavePath = true; // Mark that user manually changed the path
}
}
EditorGUILayout.EndHorizontal();
// Add a reset button if user changed the path and a valid prefab is selected
if (userChangedSavePath && sourcePrefab != null)
{
string prefabPath = AssetDatabase.GetAssetPath(sourcePrefab);
if (!string.IsNullOrEmpty(prefabPath))
{
if (GUILayout.Button("Reset Path to Prefab Directory"))
{
variantSaveFolder = Path.GetDirectoryName(prefabPath).Replace("\\", "/");
userChangedSavePath = false;
}
}
}
// Naming pattern field
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Naming Pattern");
namingPattern = EditorGUILayout.TextField(namingPattern);
EditorGUILayout.EndHorizontal();
// Help text for naming pattern
StringBuilder helpText = new StringBuilder("Naming placeholders:\n");
helpText.AppendLine("{0} = Prefab name");
for (int i = 0; i < detectedRenderers.Count; i++)
{
helpText.AppendLine($"{{{i+1}}} = {detectedRenderers[i].Name} sprite name");
}
EditorGUILayout.HelpBox(helpText.ToString(), MessageType.Info);
// Variant count display
string variantCountText = $"Will generate {estimatedVariantCount} variant{(estimatedVariantCount != 1 ? "s" : "")}";
if (estimatedVariantCount > maxSafeVariantCount)
{
EditorGUILayout.HelpBox($"Warning: {variantCountText}. This might take some time.", MessageType.Warning);
}
else if (estimatedVariantCount > 0)
{
EditorGUILayout.HelpBox(variantCountText, MessageType.Info);
}
else
{
EditorGUILayout.HelpBox("Please assign at least one sprite to each enabled renderer to generate variants.", MessageType.Warning);
}
// Generate button
EditorGUILayout.Space();
GUI.enabled = estimatedVariantCount > 0;
if (GUILayout.Button("Generate Prefab Variants", GUILayout.Height(30)))
{
// Show warning for large numbers of variants
if (estimatedVariantCount > maxSafeVariantCount)
{
bool proceed = EditorUtility.DisplayDialog(
"Generate Many Variants?",
$"You are about to generate {estimatedVariantCount} prefab variants. This might take some time and use significant disk space. Continue?",
"Generate",
"Cancel"
);
if (!proceed) return;
}
GeneratePrefabVariants();
}
GUI.enabled = true;
}
EditorGUILayout.EndScrollView();
}
private void DrawRendererSection(RendererConfig config, int index)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.BeginHorizontal();
// Expand/collapse button
config.Expanded = EditorGUILayout.Foldout(config.Expanded, "", boldFoldoutStyle);
// Enable/disable toggle
bool newEnabled = EditorGUILayout.Toggle(config.Enabled, GUILayout.Width(20));
if (newEnabled != config.Enabled)
{
config.Enabled = newEnabled;
UpdateVariantCount();
}
// Renderer name/title
EditorGUILayout.LabelField(config.Name, EditorStyles.boldLabel);
// Current sprite preview if available
if (config.CurrentSprite != null)
{
GUILayout.Box(
AssetPreview.GetAssetPreview(config.CurrentSprite),
GUILayout.Width(40),
GUILayout.Height(40)
);
}
EditorGUILayout.EndHorizontal();
// Only show contents if expanded
if (config.Expanded)
{
// Path display
if (!string.IsNullOrEmpty(config.Path))
{
EditorGUILayout.LabelField($"Path: {config.Path}", EditorStyles.miniLabel);
}
EditorGUI.BeginDisabledGroup(!config.Enabled);
// Sprite selection controls
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
// Drag and drop area for sprites
EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Height(60));
EditorGUILayout.LabelField("Drag and drop sprites here", EditorStyles.centeredGreyMiniLabel);
Rect dropArea = GUILayoutUtility.GetRect(0, 40, GUILayout.ExpandWidth(true));
HandleDragAndDrop(dropArea, config);
EditorGUILayout.EndVertical();
if (GUILayout.Button("Add Selected", GUILayout.Width(100), GUILayout.Height(60)))
{
AddSelectedSpritesToConfig(config);
}
EditorGUILayout.EndHorizontal();
if (GUILayout.Button("Clear Sprites"))
{
config.AssignedSprites.Clear();
UpdateVariantCount();
}
// Display selected sprites
EditorGUILayout.Space();
EditorGUILayout.LabelField($"Selected Sprites ({config.AssignedSprites.Count}):", EditorStyles.miniBoldLabel);
// Sprite list
config.ScrollPosition = EditorGUILayout.BeginScrollView(config.ScrollPosition, GUILayout.Height(120));
for (int i = config.AssignedSprites.Count - 1; i >= 0; i--)
{
EditorGUILayout.BeginHorizontal();
config.AssignedSprites[i] = (Sprite)EditorGUILayout.ObjectField(
config.AssignedSprites[i],
typeof(Sprite),
false,
GUILayout.ExpandWidth(true)
);
// Preview sprite
if (config.AssignedSprites[i] != null)
{
GUILayout.Box(
AssetPreview.GetAssetPreview(config.AssignedSprites[i]),
GUILayout.Width(40),
GUILayout.Height(40)
);
}
if (GUILayout.Button("Remove", GUILayout.Width(60)))
{
config.AssignedSprites.RemoveAt(i);
UpdateVariantCount();
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
EditorGUI.EndDisabledGroup();
}
EditorGUILayout.EndVertical();
}
private void HandleDragAndDrop(Rect dropArea, RendererConfig config)
{
Event evt = Event.current;
switch (evt.type)
{
case EventType.DragUpdated:
case EventType.DragPerform:
if (!dropArea.Contains(evt.mousePosition))
break;
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
if (evt.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
bool added = false;
foreach (var draggedObject in DragAndDrop.objectReferences)
{
if (draggedObject is Sprite sprite)
{
if (!config.AssignedSprites.Contains(sprite))
{
config.AssignedSprites.Add(sprite);
added = true;
}
}
else if (draggedObject is Texture2D texture)
{
// Try to get sprites from texture
string texturePath = AssetDatabase.GetAssetPath(texture);
var sprites = AssetDatabase.LoadAllAssetsAtPath(texturePath)
.OfType<Sprite>()
.ToArray();
foreach (var s in sprites)
{
if (!config.AssignedSprites.Contains(s))
{
config.AssignedSprites.Add(s);
added = true;
}
}
}
}
if (added)
{
UpdateVariantCount();
}
evt.Use();
}
break;
}
}
private void AddSelectedSpritesToConfig(RendererConfig config)
{
var selectedObjects = Selection.objects;
bool added = false;
foreach (var obj in selectedObjects)
{
if (obj is Sprite sprite)
{
if (!config.AssignedSprites.Contains(sprite))
{
config.AssignedSprites.Add(sprite);
added = true;
}
}
else if (obj is Texture2D texture)
{
// Try to get sprites from texture
string texturePath = AssetDatabase.GetAssetPath(texture);
var sprites = AssetDatabase.LoadAllAssetsAtPath(texturePath)
.OfType<Sprite>()
.ToArray();
foreach (var s in sprites)
{
if (!config.AssignedSprites.Contains(s))
{
config.AssignedSprites.Add(s);
added = true;
}
}
}
}
if (added)
{
UpdateVariantCount();
}
}
private void FindRenderersInPrefab()
{
detectedRenderers.Clear();
if (sourcePrefab == null) return;
// Get all renderers in prefab (including children)
GameObject instance = null;
try
{
instance = (GameObject)PrefabUtility.InstantiatePrefab(sourcePrefab);
SpriteRenderer[] renderers = instance.GetComponentsInChildren<SpriteRenderer>(true);
for (int i = 0; i < renderers.Length; i++)
{
var renderer = renderers[i];
string path = GetRelativePath(instance.transform, renderer.transform);
string name = renderer.gameObject.name;
// For root object, use "Main"
if (string.IsNullOrEmpty(path))
{
name = "Main";
}
// For objects with the same name, add index
else if (renderers.Count(r => r.gameObject.name == renderer.gameObject.name) > 1)
{
name = $"{name} ({i+1})";
}
detectedRenderers.Add(new RendererConfig
{
Path = path,
Name = name,
Renderer = renderer,
CurrentSprite = renderer.sprite,
AssignedSprites = renderer.sprite != null ?
new List<Sprite> { renderer.sprite } :
new List<Sprite>()
});
}
}
finally
{
if (instance != null)
DestroyImmediate(instance);
}
// If no renderers found, create a default entry
if (detectedRenderers.Count == 0)
{
detectedRenderers.Add(new RendererConfig
{
Path = "",
Name = "Main",
Renderer = null,
CurrentSprite = null,
AssignedSprites = new List<Sprite>()
});
}
UpdateVariantCount();
}
private string GetRelativePath(Transform root, Transform target)
{
if (target == root) return "";
string path = target.name;
Transform parent = target.parent;
while (parent != null && parent != root)
{
path = parent.name + "/" + path;
parent = parent.parent;
}
return path;
}
private void UpdateVariantCount()
{
// Calculate estimated variants
estimatedVariantCount = 0;
// Get only enabled renderers with at least one sprite
var enabledConfigs = detectedRenderers
.Where(r => r.Enabled && r.AssignedSprites.Count > 0)
.ToList();
if (enabledConfigs.Count > 0)
{
// Start with count of first renderer's sprites
estimatedVariantCount = enabledConfigs[0].AssignedSprites.Count;
// Multiply by subsequent renderers' sprite counts
for (int i = 1; i < enabledConfigs.Count; i++)
{
estimatedVariantCount *= enabledConfigs[i].AssignedSprites.Count;
}
}
}
private List<List<Sprite>> GenerateAllCombinations()
{
var enabledConfigs = detectedRenderers
.Where(r => r.Enabled && r.AssignedSprites.Count > 0)
.ToList();
if (enabledConfigs.Count == 0)
return new List<List<Sprite>>();
// Initialize with first renderer's sprites
var combinations = enabledConfigs[0].AssignedSprites
.Select(s => new List<Sprite> { s })
.ToList();
// Add each subsequent renderer's sprites
for (int i = 1; i < enabledConfigs.Count; i++)
{
var newCombinations = new List<List<Sprite>>();
foreach (var combo in combinations)
{
foreach (var sprite in enabledConfigs[i].AssignedSprites)
{
var newCombo = new List<Sprite>(combo) { sprite };
newCombinations.Add(newCombo);
}
}
combinations = newCombinations;
}
return combinations;
}
private void GeneratePrefabVariants()
{
if (sourcePrefab == null)
{
EditorUtility.DisplayDialog("Error", "Please select a source prefab.", "OK");
return;
}
// Get enabled renderer configurations
var enabledConfigs = detectedRenderers
.Where(r => r.Enabled && r.AssignedSprites.Count > 0)
.ToList();
if (enabledConfigs.Count == 0)
{
EditorUtility.DisplayDialog("Error", "Please assign at least one sprite to a renderer.", "OK");
return;
}
// Ensure the save folder exists
EnsureFolderExists(variantSaveFolder);
// Generate all sprite combinations
var combinations = GenerateAllCombinations();
string sourcePrefabPath = AssetDatabase.GetAssetPath(sourcePrefab);
string prefabName = Path.GetFileNameWithoutExtension(sourcePrefabPath);
int successCount = 0;
// Show progress bar
EditorUtility.DisplayProgressBar("Generating Prefab Variants", "Preparing...", 0f);
try
{
// For each combination, create a prefab variant
for (int i = 0; i < combinations.Count; i++)
{
// Update progress
if (i % 5 == 0 || i == combinations.Count - 1)
{
float progress = (float)i / combinations.Count;
if (EditorUtility.DisplayCancelableProgressBar(
"Generating Prefab Variants",
$"Creating variant {i+1} of {combinations.Count}",
progress))
{
// User canceled
break;
}
}
var combination = combinations[i];
// Generate variant name
string variantName = prefabName;
string[] spriteNames = new string[combination.Count];
for (int j = 0; j < combination.Count; j++)
{
spriteNames[j] = combination[j].name;
}
// Format with the naming pattern
object[] formatArgs = new object[spriteNames.Length + 1];
formatArgs[0] = prefabName;
for (int j = 0; j < spriteNames.Length; j++)
{
formatArgs[j + 1] = spriteNames[j];
}
try
{
variantName = string.Format(namingPattern, formatArgs);
}
catch (System.FormatException)
{
// Fallback if format fails
variantName = $"{prefabName}_{string.Join("_", spriteNames)}";
}
variantName = PrefabEditorUtility.SanitizeFileName(variantName);
string variantPath = Path.Combine(variantSaveFolder, variantName + ".prefab").Replace("\\", "/");
// Create the prefab variant
GameObject prefabInstance = (GameObject)PrefabUtility.InstantiatePrefab(sourcePrefab);
try
{
// Apply sprites to renderers
for (int j = 0; j < enabledConfigs.Count; j++)
{
SpriteRenderer renderer = null;
// Find the corresponding renderer in the instance
if (string.IsNullOrEmpty(enabledConfigs[j].Path))
{
// Root object
renderer = prefabInstance.GetComponent<SpriteRenderer>();
if (renderer == null)
{
renderer = prefabInstance.AddComponent<SpriteRenderer>();
}
}
else
{
// Child object
Transform child = prefabInstance.transform.Find(enabledConfigs[j].Path);
if (child != null)
{
renderer = child.GetComponent<SpriteRenderer>();
}
}
// Apply sprite if renderer was found
if (renderer != null)
{
renderer.sprite = combination[j];
}
}
// Create the prefab variant
GameObject prefabVariant = PrefabUtility.SaveAsPrefabAsset(prefabInstance, variantPath);
if (prefabVariant != null)
{
successCount++;
}
}
catch (System.Exception e)
{
Debug.LogError($"Error creating prefab variant: {e.Message}");
}
finally
{
// Clean up the instance
DestroyImmediate(prefabInstance);
}
}
}
finally
{
EditorUtility.ClearProgressBar();
}
AssetDatabase.Refresh();
if (successCount > 0)
{
EditorUtility.DisplayDialog(
"Prefab Variants Created",
$"Successfully created {successCount} prefab variants in {variantSaveFolder}.",
"OK"
);
// Open the folder in Project view
var folderObject = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(variantSaveFolder);
if (folderObject != null)
{
Selection.activeObject = folderObject;
EditorGUIUtility.PingObject(folderObject);
}
}
else
{
EditorUtility.DisplayDialog(
"Prefab Variants",
"No prefab variants were created. Please check the console for errors.",
"OK"
);
}
}
private void EnsureFolderExists(string folderPath)
{
if (!AssetDatabase.IsValidFolder(folderPath))
{
string[] folderParts = folderPath.Split('/');
string currentPath = folderParts[0];
for (int i = 1; i < folderParts.Length; i++)
{
string folderName = folderParts[i];
string newPath = Path.Combine(currentPath, folderName);
if (!AssetDatabase.IsValidFolder(newPath))
{
AssetDatabase.CreateFolder(currentPath, folderName);
}
currentPath = newPath;
}
AssetDatabase.Refresh();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b49d63944914b3b87e5f6112aee72ca
timeCreated: 1758278821

View File

@@ -9,7 +9,7 @@ public class PuzzleChainEditorWindow : EditorWindow
private Vector2 scrollPos;
private const int INDENT_SIZE = 24;
[MenuItem("Tools/Puzzle Chain Editor")]
[MenuItem("AppleHills/Puzzle Chain Editor")]
public static void ShowWindow()
{
var window = GetWindow<PuzzleChainEditorWindow>("Puzzle Chain Editor");

View File

@@ -0,0 +1,123 @@
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System.Linq;
public class SceneBrowserWindow : EditorWindow
{
private class SceneInfo
{
public string path;
public string name;
public string folder;
public bool inBuildSettings;
}
private Vector2 _scroll;
private List<SceneInfo> _scenes = new List<SceneInfo>();
private Dictionary<string, List<SceneInfo>> _scenesByFolder = new Dictionary<string, List<SceneInfo>>();
[MenuItem("Tools/Scene Browser")]
public static void ShowWindow()
{
var window = GetWindow<SceneBrowserWindow>(false, "Scene Browser", true);
window.RefreshScenes();
}
private void OnFocus()
{
RefreshScenes();
}
private void RefreshScenes()
{
_scenes.Clear();
_scenesByFolder.Clear();
string[] guids = AssetDatabase.FindAssets("t:Scene", new[] { "Assets/Scenes" });
var buildScenes = EditorBuildSettings.scenes.Select(s => s.path).ToHashSet();
foreach (var guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
string name = Path.GetFileNameWithoutExtension(path);
string folder = Path.GetDirectoryName(path).Replace("\\", "/");
if (folder == "Assets/Scenes") folder = "";
var info = new SceneInfo
{
path = path,
name = name,
folder = folder,
inBuildSettings = buildScenes.Contains(path)
};
_scenes.Add(info);
if (!_scenesByFolder.ContainsKey(folder))
_scenesByFolder[folder] = new List<SceneInfo>();
_scenesByFolder[folder].Add(info);
}
}
private void OnGUI()
{
if (GUILayout.Button("Refresh"))
RefreshScenes();
_scroll = EditorGUILayout.BeginScrollView(_scroll);
// Top-level scenes
if (_scenesByFolder.ContainsKey(""))
{
foreach (var scene in _scenesByFolder[""])
DrawSceneRow(scene);
EditorGUILayout.Space();
}
// Subfolders
foreach (var kvp in _scenesByFolder)
{
if (string.IsNullOrEmpty(kvp.Key)) continue;
EditorGUILayout.LabelField(kvp.Key, EditorStyles.boldLabel);
foreach (var scene in kvp.Value)
DrawSceneRow(scene);
EditorGUILayout.Space();
}
EditorGUILayout.EndScrollView();
}
private void DrawSceneRow(SceneInfo scene)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(scene.name, GUILayout.Width(180));
if (GUILayout.Button("Open", GUILayout.Width(50)))
{
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
EditorSceneManager.OpenScene(scene.path);
}
if (GUILayout.Button("Locate", GUILayout.Width(50)))
{
var obj = AssetDatabase.LoadAssetAtPath<SceneAsset>(scene.path);
EditorGUIUtility.PingObject(obj);
}
bool inBuild = scene.inBuildSettings;
bool newInBuild = GUILayout.Toggle(inBuild, "In Build", GUILayout.Width(70));
if (newInBuild != inBuild)
{
ToggleSceneInBuildSettings(scene.path, newInBuild);
scene.inBuildSettings = newInBuild;
}
EditorGUILayout.EndHorizontal();
}
private void ToggleSceneInBuildSettings(string path, bool add)
{
var scenes = EditorBuildSettings.scenes.ToList();
if (add)
{
if (!scenes.Any(s => s.path == path))
scenes.Add(new EditorBuildSettingsScene(path, true));
}
else
{
scenes = scenes.Where(s => s.path != path).ToList();
}
EditorBuildSettings.scenes = scenes.ToArray();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bda5b0c96582450e94a8b332f86c726d
timeCreated: 1757596929

View File

@@ -15,7 +15,7 @@ public class SceneObjectLocatorWindow : EditorWindow
private List<PickupInfo> pickupInfos = new List<PickupInfo>();
private Vector2 scrollPos;
[MenuItem("Tools/Scene Object Locator")]
[MenuItem("AppleHills/Scene Object Locator")]
public static void ShowWindow()
{
var window = GetWindow<SceneObjectLocatorWindow>("Scene Object Locator");

View File

@@ -0,0 +1,195 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace AppleHills.Core.Settings.Editor
{
public class SettingsEditorWindow : EditorWindow
{
private Vector2 scrollPosition;
private List<BaseSettings> allSettings = new List<BaseSettings>();
private string[] tabNames = new string[] { "Player & Follower", "Interaction & Items", "Diving Minigame" };
private int selectedTab = 0;
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
private GUIStyle headerStyle;
[MenuItem("AppleHills/Settings Editor")]
public static void ShowWindow()
{
GetWindow<SettingsEditorWindow>("Game Settings");
}
private void OnEnable()
{
LoadAllSettings();
}
private void LoadAllSettings()
{
allSettings.Clear();
serializedSettingsObjects.Clear();
// Find all settings assets
string[] guids = AssetDatabase.FindAssets("t:BaseSettings");
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
BaseSettings settings = AssetDatabase.LoadAssetAtPath<BaseSettings>(path);
if (settings != null)
{
allSettings.Add(settings);
serializedSettingsObjects[settings.GetType().Name] = new SerializedObject(settings);
}
}
// If any settings are missing, create them
CreateSettingsIfMissing<PlayerFollowerSettings>("PlayerFollowerSettings");
CreateSettingsIfMissing<InteractionSettings>("InteractionSettings");
CreateSettingsIfMissing<DivingMinigameSettings>("DivingMinigameSettings");
}
private void CreateSettingsIfMissing<T>(string fileName) where T : BaseSettings
{
if (!allSettings.Any(s => s is T))
{
// Check if the asset already exists
string[] guids = AssetDatabase.FindAssets($"t:{typeof(T).Name}");
if (guids.Length == 0)
{
// Create the settings folder if it doesn't exist
if (!AssetDatabase.IsValidFolder("Assets/Settings"))
{
AssetDatabase.CreateFolder("Assets", "Settings");
}
// Create new settings asset
T settings = CreateInstance<T>();
string path = $"Assets/Settings/{fileName}.asset";
AssetDatabase.CreateAsset(settings, path);
AssetDatabase.SaveAssets();
allSettings.Add(settings);
serializedSettingsObjects[typeof(T).Name] = new SerializedObject(settings);
Debug.Log($"Created missing settings asset: {path}");
}
else
{
// Load existing asset
string path = AssetDatabase.GUIDToAssetPath(guids[0]);
T settings = AssetDatabase.LoadAssetAtPath<T>(path);
allSettings.Add(settings);
serializedSettingsObjects[typeof(T).Name] = new SerializedObject(settings);
}
}
}
private void OnGUI()
{
if (headerStyle == null)
{
headerStyle = new GUIStyle(EditorStyles.boldLabel);
headerStyle.fontSize = 14;
headerStyle.margin = new RectOffset(0, 0, 10, 10);
}
EditorGUILayout.Space(10);
EditorGUILayout.LabelField("Apple Hills Game Settings", headerStyle);
EditorGUILayout.HelpBox("Use this window to modify game settings. Changes are saved automatically.", MessageType.Info);
EditorGUILayout.Space(10);
selectedTab = GUILayout.Toolbar(selectedTab, tabNames);
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
switch (selectedTab)
{
case 0: // Player & Follower
DrawSettingsEditor<PlayerFollowerSettings>();
break;
case 1: // Interaction & Items
DrawSettingsEditor<InteractionSettings>();
break;
case 2: // Minigames
DrawSettingsEditor<DivingMinigameSettings>();
break;
}
EditorGUILayout.EndScrollView();
EditorGUILayout.Space(10);
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Refresh", GUILayout.Width(100)))
{
LoadAllSettings();
}
if (GUILayout.Button("Save All", GUILayout.Width(100)))
{
foreach (var serializedObj in serializedSettingsObjects.Values)
{
serializedObj.ApplyModifiedProperties();
EditorUtility.SetDirty(serializedObj.targetObject);
}
AssetDatabase.SaveAssets();
// Refresh editor settings after save
AppleHills.Editor.EditorSettingsProvider.LoadAllSettings();
AppleHills.Editor.EditorSettingsProvider.RefreshSceneViews();
Debug.Log("All settings saved and editor views refreshed!");
}
EditorGUILayout.EndHorizontal();
}
private void DrawSettingsEditor<T>() where T : BaseSettings
{
BaseSettings settings = allSettings.Find(s => s is T);
if (settings == null)
{
EditorGUILayout.HelpBox($"No {typeof(T).Name} found. Click Refresh to create one.", MessageType.Warning);
return;
}
SerializedObject serializedObj = serializedSettingsObjects[typeof(T).Name];
serializedObj.Update();
EditorGUILayout.Space(10);
// Draw all properties
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
while (property.NextVisible(enterChildren))
{
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
EditorGUILayout.PropertyField(property, true);
}
// Apply changes
if (serializedObj.ApplyModifiedProperties())
{
EditorUtility.SetDirty(settings);
}
}
// Helper method to highlight important fields
private void DrawHighlightedProperty(SerializedProperty property, string tooltip = null)
{
GUI.backgroundColor = new Color(1f, 1f, 0.8f);
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
GUI.backgroundColor = Color.white;
EditorGUILayout.PropertyField(property, new GUIContent(property.displayName, tooltip));
EditorGUILayout.EndVertical();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bfb9e77c746e41a2903603a39df3d424
timeCreated: 1758619952

View File

@@ -0,0 +1,42 @@
using UnityEditor;
using UnityEngine;
using Minigames.DivingForPictures;
/// <summary>
/// Custom editor for TrenchTileSpawner that adds a runtime button to test the StartSurfacing function
/// </summary>
[CustomEditor(typeof(TrenchTileSpawner))]
public class TrenchTileSpawnerEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
// Draw the default inspector
DrawDefaultInspector();
// Get the target TrenchTileSpawner
TrenchTileSpawner spawner = (TrenchTileSpawner)target;
// Add space between default inspector and custom button
EditorGUILayout.Space(10);
// Separator line
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
// Add a label for the runtime testing section
EditorGUILayout.LabelField("Runtime Testing", EditorStyles.boldLabel);
// Only enable the button during play mode
EditorGUI.BeginDisabledGroup(!Application.isPlaying);
// Add the button to call StartSurfacing
if (GUILayout.Button("Start Surfacing", GUILayout.Height(30)))
{
spawner.StartSurfacing();
}
EditorGUI.EndDisabledGroup();
// Add explanatory text
EditorGUILayout.HelpBox("This button will reverse the direction of the trench movement, making the player surface instead of descend. Only works in Play Mode.", MessageType.Info);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9fb1a138e45d4720ba5c95da894b4491
timeCreated: 1758531024

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8b28cee1553b4a15aa1c3be950983fee
timeCreated: 1758016486

View File

@@ -0,0 +1,227 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Editor.Utilities
{
public class BatchComponentAdder : EditorWindow
{
private Vector2 scrollPosition;
private List<GameObject> selectedPrefabs = new List<GameObject>();
private string searchText = "";
private List<Type> availableComponentTypes = new List<Type>();
private List<Type> filteredComponentTypes = new List<Type>();
private int selectedComponentIndex = -1;
private bool showScriptsOnly = true;
private bool showBuiltInComponents = false;
[MenuItem("Tools/Batch Component Adder")]
public static void ShowWindow()
{
GetWindow<BatchComponentAdder>("Batch Component Adder");
}
private void OnEnable()
{
// Get all component types when the window is opened
RefreshComponentTypes();
}
private void RefreshComponentTypes()
{
// Get all types that derive from Component
availableComponentTypes = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(assembly => assembly.GetTypes())
.Where(type => type.IsSubclassOf(typeof(Component)) && !type.IsAbstract)
.OrderBy(type => type.Name)
.ToList();
// Apply initial filtering
FilterComponentTypes();
}
private void FilterComponentTypes()
{
filteredComponentTypes = availableComponentTypes
.Where(type => {
if (!showBuiltInComponents && type.Namespace != null && type.Namespace.StartsWith("UnityEngine"))
return false;
if (showScriptsOnly && type.Namespace != null && type.Namespace.StartsWith("UnityEngine"))
return false;
if (!string.IsNullOrEmpty(searchText))
return type.Name.ToLower().Contains(searchText.ToLower());
return true;
})
.ToList();
// Reset selection if it's no longer valid
if (selectedComponentIndex >= filteredComponentTypes.Count)
selectedComponentIndex = -1;
}
private void OnGUI()
{
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Batch Component Adder", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Select multiple prefabs, choose a component type, and add it to the root of all selected prefabs.", MessageType.Info);
EditorGUILayout.Space();
// Prefab selection section
EditorGUILayout.LabelField("Selected Prefabs", EditorStyles.boldLabel);
if (GUILayout.Button("Add Selected Assets"))
{
AddSelectedAssets();
}
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUILayout.Height(150));
for (int i = 0; i < selectedPrefabs.Count; i++)
{
EditorGUILayout.BeginHorizontal();
selectedPrefabs[i] = (GameObject)EditorGUILayout.ObjectField(selectedPrefabs[i], typeof(GameObject), false);
if (GUILayout.Button("X", GUILayout.Width(20)))
{
selectedPrefabs.RemoveAt(i);
i--;
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
if (GUILayout.Button("Clear All"))
{
selectedPrefabs.Clear();
}
EditorGUILayout.Space();
// Component selection section
EditorGUILayout.LabelField("Component to Add", EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal();
showScriptsOnly = EditorGUILayout.Toggle("Scripts Only", showScriptsOnly);
showBuiltInComponents = EditorGUILayout.Toggle("Show Built-in Components", showBuiltInComponents);
EditorGUILayout.EndHorizontal();
string newSearchText = EditorGUILayout.TextField("Search", searchText);
if (newSearchText != searchText)
{
searchText = newSearchText;
FilterComponentTypes();
}
string[] componentNames = filteredComponentTypes.Select(t => t.Name).ToArray();
selectedComponentIndex = EditorGUILayout.Popup("Component Type", selectedComponentIndex, componentNames);
EditorGUILayout.Space();
// Validate and add the component
GUI.enabled = selectedPrefabs.Count > 0 && selectedComponentIndex >= 0 && selectedComponentIndex < filteredComponentTypes.Count;
if (GUILayout.Button("Add Component to Prefabs"))
{
AddComponentToPrefabs();
}
GUI.enabled = true;
EditorGUILayout.EndVertical();
}
private void AddSelectedAssets()
{
UnityEngine.Object[] selectedObjects = Selection.objects;
foreach (var obj in selectedObjects)
{
if (obj is GameObject go)
{
string path = AssetDatabase.GetAssetPath(go);
if (!string.IsNullOrEmpty(path) && path.EndsWith(".prefab"))
{
if (!selectedPrefabs.Contains(go))
{
selectedPrefabs.Add(go);
}
}
}
}
}
private void AddComponentToPrefabs()
{
if (selectedComponentIndex < 0 || selectedComponentIndex >= filteredComponentTypes.Count)
return;
Type componentType = filteredComponentTypes[selectedComponentIndex];
int successCount = 0;
List<string> failedPrefabs = new List<string>();
// For undo operations
Undo.RecordObjects(selectedPrefabs.ToArray(), "Add Component To Prefabs");
foreach (GameObject prefab in selectedPrefabs)
{
// Skip null entries
if (prefab == null) continue;
try
{
// Open the prefab for editing
string prefabPath = AssetDatabase.GetAssetPath(prefab);
GameObject prefabRoot = PrefabUtility.LoadPrefabContents(prefabPath);
// Check if the component already exists
if (prefabRoot.GetComponent(componentType) == null)
{
// Add the component
prefabRoot.AddComponent(componentType);
// Save the prefab
PrefabUtility.SaveAsPrefabAsset(prefabRoot, prefabPath);
successCount++;
}
else
{
failedPrefabs.Add($"{prefab.name} (already has component)");
}
// Unload the prefab
PrefabUtility.UnloadPrefabContents(prefabRoot);
}
catch (Exception e)
{
Debug.LogError($"Error adding component to {prefab.name}: {e.Message}");
failedPrefabs.Add($"{prefab.name} (error)");
}
}
// Show results
if (successCount > 0)
{
Debug.Log($"Successfully added {componentType.Name} to {successCount} prefabs.");
}
if (failedPrefabs.Count > 0)
{
Debug.LogWarning($"Failed to add component to {failedPrefabs.Count} prefabs: {string.Join(", ", failedPrefabs)}");
}
// Refresh the asset database to show changes
AssetDatabase.Refresh();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 34bcaf56206d4ec29cfa108c96622c37
timeCreated: 1758027437

View File

@@ -0,0 +1,217 @@
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
namespace Editor.Utilities
{
public class ComponentTransferWindow : EditorWindow
{
private GameObject sourceGameObject;
private GameObject targetGameObject;
private Vector2 scrollPosition;
private Dictionary<Component, bool> componentSelections = new Dictionary<Component, bool>();
private bool selectAll = false;
[MenuItem("Tools/Component Transfer Tool")]
public static void ShowWindow()
{
ComponentTransferWindow window = GetWindow<ComponentTransferWindow>("Component Transfer");
window.minSize = new Vector2(400, 300);
}
private void OnGUI()
{
GUILayout.Label("Component Transfer Tool", EditorStyles.boldLabel);
EditorGUILayout.Space();
DrawGameObjectSelectors();
EditorGUILayout.Space();
if (sourceGameObject != null)
{
DrawComponentSelectionArea();
EditorGUILayout.Space();
DrawOperationButtons();
}
}
private void DrawGameObjectSelectors()
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.BeginVertical();
EditorGUI.BeginChangeCheck();
GameObject newSource = EditorGUILayout.ObjectField("Source GameObject", sourceGameObject, typeof(GameObject), true) as GameObject;
if (EditorGUI.EndChangeCheck())
{
if (newSource != sourceGameObject)
{
sourceGameObject = newSource;
RefreshComponentList();
}
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.BeginVertical();
targetGameObject = EditorGUILayout.ObjectField("Target GameObject", targetGameObject, typeof(GameObject), true) as GameObject;
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
// Error validation
if (sourceGameObject == targetGameObject && sourceGameObject != null)
{
EditorGUILayout.HelpBox("Source and target cannot be the same GameObject.", MessageType.Error);
}
}
private void DrawComponentSelectionArea()
{
if (componentSelections.Count == 0)
{
EditorGUILayout.LabelField("No components found on source GameObject.");
return;
}
EditorGUILayout.LabelField("Select Components to Transfer:", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
bool newSelectAll = EditorGUILayout.ToggleLeft("Select All", selectAll);
if (EditorGUI.EndChangeCheck() && newSelectAll != selectAll)
{
selectAll = newSelectAll;
foreach (var key in componentSelections.Keys.ToArray())
{
componentSelections[key] = selectAll;
}
}
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
foreach (var kvp in componentSelections.ToArray())
{
Component component = kvp.Key;
if (component != null)
{
string componentName = component.GetType().Name;
componentSelections[component] = EditorGUILayout.ToggleLeft(componentName, componentSelections[component]);
}
}
EditorGUILayout.EndScrollView();
}
private void DrawOperationButtons()
{
bool isValid = sourceGameObject != null && targetGameObject != null && sourceGameObject != targetGameObject;
bool hasSelection = HasSelectedComponents();
EditorGUI.BeginDisabledGroup(!isValid || !hasSelection);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Copy Components"))
{
CopyComponents(false);
}
if (GUILayout.Button("Move Components"))
{
CopyComponents(true);
}
EditorGUILayout.EndHorizontal();
EditorGUI.EndDisabledGroup();
}
private void RefreshComponentList()
{
componentSelections.Clear();
if (sourceGameObject != null)
{
Component[] components = sourceGameObject.GetComponents<Component>();
foreach (Component component in components)
{
// Skip Transform component as it's required and should not be transferred
if (component is Transform)
continue;
componentSelections.Add(component, false);
}
}
}
private bool HasSelectedComponents()
{
foreach (bool selected in componentSelections.Values)
{
if (selected)
return true;
}
return false;
}
private void CopyComponents(bool moveInsteadOfCopy)
{
if (sourceGameObject == null || targetGameObject == null)
return;
Undo.RegisterCompleteObjectUndo(targetGameObject, moveInsteadOfCopy ? "Move Components" : "Copy Components");
if (moveInsteadOfCopy)
{
Undo.RegisterCompleteObjectUndo(sourceGameObject, "Move Components (Source)");
}
// Store references to components that need to be destroyed after copying
List<Component> componentsToDestroy = new List<Component>();
// Copy each selected component
foreach (var kvp in componentSelections)
{
if (kvp.Value) // If component is selected
{
Component sourceComponent = kvp.Key;
if (sourceComponent != null)
{
// Skip Transform component as it's required
if (sourceComponent is Transform)
continue;
// Add the component of the same type to the target
ComponentUtility.CopyComponent(sourceComponent);
ComponentUtility.PasteComponentAsNew(targetGameObject);
// If we're moving components, mark this for destruction
if (moveInsteadOfCopy)
{
componentsToDestroy.Add(sourceComponent);
}
}
}
}
// Destroy components on source if needed (after copying all components)
if (moveInsteadOfCopy)
{
foreach (Component component in componentsToDestroy)
{
Undo.DestroyObjectImmediate(component);
}
}
RefreshComponentList();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9dae5cb1c71f74a4eb8c8c0a77fe2e3f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,432 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System;
using System.Reflection;
using System.Collections;
using Pooling;
namespace Editor.Utilities
{
public class PoolMonitorWindow : EditorWindow
{
private Vector2 scrollPosition;
private bool autoRefresh = true;
private float refreshInterval = 1.0f;
private float lastRefreshTime;
private bool showSinglePrefabPools = true;
private bool showMultiPrefabPools = true;
[MenuItem("Tools/Pool Monitor")]
public static void ShowWindow()
{
GetWindow<PoolMonitorWindow>("Pool Monitor");
}
void OnGUI()
{
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Object Pool Monitor", EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal();
autoRefresh = EditorGUILayout.Toggle("Auto Refresh", autoRefresh);
if (autoRefresh)
{
refreshInterval = EditorGUILayout.Slider("Refresh Interval", refreshInterval, 0.1f, 5f);
}
if (GUILayout.Button("Refresh Now"))
{
RefreshPoolInfo();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
// Display toggles for showing different pool types
EditorGUILayout.BeginHorizontal();
showSinglePrefabPools = EditorGUILayout.ToggleLeft("Show Single Prefab Pools", showSinglePrefabPools, GUILayout.Width(200));
showMultiPrefabPools = EditorGUILayout.ToggleLeft("Show Multi-Prefab Pools", showMultiPrefabPools, GUILayout.Width(200));
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
if (Application.isPlaying)
{
DisplayPoolInfo();
}
else
{
EditorGUILayout.HelpBox("Enter play mode to see pool statistics.", MessageType.Info);
}
EditorGUILayout.EndScrollView();
EditorGUILayout.EndVertical();
}
void Update()
{
if (autoRefresh && Application.isPlaying)
{
float currentTime = (float)EditorApplication.timeSinceStartup;
if (currentTime - lastRefreshTime > refreshInterval)
{
lastRefreshTime = currentTime;
RefreshPoolInfo();
Repaint();
}
}
}
void RefreshPoolInfo()
{
if (!Application.isPlaying) return;
// Find all pool types and call LogPoolStats
if (showSinglePrefabPools)
{
// Find all types that derive from BaseObjectPool<T>
foreach (var pool in FindObjectsOfBaseType(typeof(Component), typeof(BaseObjectPool<>)))
{
if (pool != null && pool.gameObject.activeInHierarchy)
{
var logMethod = pool.GetType().GetMethod("LogPoolStats");
if (logMethod != null)
{
logMethod.Invoke(pool, null);
}
}
}
}
if (showMultiPrefabPools)
{
// Find all types that derive from MultiPrefabPool<T>
foreach (var pool in FindObjectsOfBaseType(typeof(Component), typeof(MultiPrefabPool<>)))
{
if (pool != null && pool.gameObject.activeInHierarchy)
{
var logMethod = pool.GetType().GetMethod("LogPoolStats");
if (logMethod != null)
{
logMethod.Invoke(pool, null);
}
}
}
}
}
void DisplayPoolInfo()
{
EditorGUILayout.LabelField("Scene Statistics:", EditorStyles.boldLabel);
EditorGUILayout.LabelField($"Total GameObjects: {UnityEngine.Object.FindObjectsByType<GameObject>(FindObjectsSortMode.None).Length}");
EditorGUILayout.Space();
if (showSinglePrefabPools)
{
DisplaySinglePrefabPoolInfo();
}
if (showMultiPrefabPools)
{
DisplayMultiPrefabPoolInfo();
}
}
void DisplaySinglePrefabPoolInfo()
{
// Find all types that derive from BaseObjectPool<T>
Component[] pools = FindObjectsOfBaseType(typeof(Component), typeof(BaseObjectPool<>));
if (pools.Length == 0)
{
EditorGUILayout.HelpBox("No single prefab pools found in the scene.", MessageType.Info);
return;
}
EditorGUILayout.LabelField("Single Prefab Pools", EditorStyles.boldLabel);
foreach (var poolComponent in pools)
{
EditorGUILayout.LabelField($"Pool: {poolComponent.name} ({poolComponent.GetType().Name})", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
// Get private field values using reflection
Type poolType = poolComponent.GetType();
FieldInfo pooledObjectsField = poolType.GetField("pooledObjects",
BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo totalCreatedField = poolType.GetField("totalCreated",
BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo totalReturnedField = poolType.GetField("totalReturned",
BindingFlags.NonPublic | BindingFlags.Instance);
PropertyInfo maxPoolSizeProp = poolType.GetProperty("maxPoolSize") ??
poolType.GetField("maxPoolSize")?.DeclaringType.GetProperty("maxPoolSize");
PropertyInfo initialPoolSizeProp = poolType.GetProperty("initialPoolSize") ??
poolType.GetField("initialPoolSize")?.DeclaringType.GetProperty("initialPoolSize");
if (pooledObjectsField != null)
{
object pooledObjects = pooledObjectsField.GetValue(poolComponent);
int count = 0;
// Handle Stack<T>
if (pooledObjects is System.Collections.ICollection collection)
{
count = collection.Count;
}
int maxSize = 0;
if (maxPoolSizeProp != null)
{
maxSize = (int)maxPoolSizeProp.GetValue(poolComponent);
}
else
{
FieldInfo maxPoolSizeField = poolType.GetField("maxPoolSize",
BindingFlags.Public | BindingFlags.Instance);
if (maxPoolSizeField != null)
{
maxSize = (int)maxPoolSizeField.GetValue(poolComponent);
}
}
EditorGUILayout.LabelField($"Pooled Objects: {count}/{maxSize}");
int initialSize = 0;
if (initialPoolSizeProp != null)
{
initialSize = (int)initialPoolSizeProp.GetValue(poolComponent);
}
else
{
FieldInfo initialPoolSizeField = poolType.GetField("initialPoolSize",
BindingFlags.Public | BindingFlags.Instance);
if (initialPoolSizeField != null)
{
initialSize = (int)initialPoolSizeField.GetValue(poolComponent);
}
}
EditorGUILayout.LabelField($"Initial Pool Size: {initialSize}");
if (totalCreatedField != null && totalReturnedField != null)
{
int created = (int)totalCreatedField.GetValue(poolComponent);
int returned = (int)totalReturnedField.GetValue(poolComponent);
EditorGUILayout.LabelField($"Created: {created}, Returned: {returned}");
}
}
// Try to find active objects of the pool's type
if (poolType.BaseType.IsGenericType)
{
Type elementType = poolType.BaseType.GetGenericArguments()[0];
// More accurately count only active objects in the current scene
int activeCount = 0;
// First, try to get a more accurate count from the current scene
foreach (var obj in UnityEngine.Object.FindObjectsByType(elementType, FindObjectsSortMode.None))
{
var comp = obj as Component;
if (comp != null && comp.gameObject.activeInHierarchy)
{
activeCount++;
}
}
EditorGUILayout.LabelField($"Active Objects (Current Scene): {activeCount}");
// Add a note about pooling status
if (activeCount > 0)
{
int pooledCount = 0;
if (pooledObjectsField != null)
{
object pooledObjects = pooledObjectsField.GetValue(poolComponent);
if (pooledObjects is ICollection collection)
{
pooledCount = collection.Count;
}
}
EditorGUILayout.LabelField($"Pooling Efficiency: {pooledCount} ready in pool, {activeCount} active");
}
}
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
}
void DisplayMultiPrefabPoolInfo()
{
// Find all types that derive from MultiPrefabPool<T>
Component[] pools = FindObjectsOfBaseType(typeof(Component), typeof(MultiPrefabPool<>));
if (pools.Length == 0)
{
EditorGUILayout.HelpBox("No multi-prefab pools found in the scene.", MessageType.Info);
return;
}
EditorGUILayout.LabelField("Multi-Prefab Pools", EditorStyles.boldLabel);
foreach (var poolComponent in pools)
{
EditorGUILayout.LabelField($"Pool: {poolComponent.name} ({poolComponent.GetType().Name})", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
// Get private field values using reflection
Type poolType = poolComponent.GetType();
FieldInfo totalPooledCountField = poolType.GetField("totalPooledCount",
BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo pooledObjectsField = poolType.GetField("pooledObjects",
BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo prefabUsageField = poolType.GetField("prefabUsageCount",
BindingFlags.NonPublic | BindingFlags.Instance);
PropertyInfo totalMaxPoolSizeProp = poolType.GetProperty("totalMaxPoolSize") ??
poolType.GetField("totalMaxPoolSize")?.DeclaringType.GetProperty("totalMaxPoolSize");
if (totalPooledCountField != null && totalMaxPoolSizeProp != null)
{
int totalCount = (int)totalPooledCountField.GetValue(poolComponent);
int maxSize = 0;
if (totalMaxPoolSizeProp != null)
{
maxSize = (int)totalMaxPoolSizeProp.GetValue(poolComponent);
}
else
{
FieldInfo totalMaxPoolSizeField = poolType.GetField("totalMaxPoolSize",
BindingFlags.Public | BindingFlags.Instance);
if (totalMaxPoolSizeField != null)
{
maxSize = (int)totalMaxPoolSizeField.GetValue(poolComponent);
}
}
EditorGUILayout.LabelField($"Total Pooled Objects: {totalCount}/{maxSize}");
}
if (pooledObjectsField != null && prefabUsageField != null)
{
// This is more complex because we don't know the exact generic types
// Just show basic information
object pooledTiles = pooledObjectsField.GetValue(poolComponent);
object usageCounts = prefabUsageField.GetValue(poolComponent);
if (pooledTiles != null && pooledTiles is IDictionary poolDict)
{
EditorGUILayout.LabelField("Prefab Details:", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
foreach (DictionaryEntry entry in poolDict)
{
int prefabIndex = Convert.ToInt32(entry.Key);
object value = entry.Value;
int count = 0;
// Handle Stack<T>
if (value is ICollection collection)
{
count = collection.Count;
}
int usageCount = 0;
if (usageCounts is IDictionary usageDict)
{
if (usageDict.Contains(entry.Key))
{
usageCount = Convert.ToInt32(usageDict[entry.Key]);
}
}
EditorGUILayout.LabelField($"Prefab {prefabIndex}: {count} pooled, {usageCount} usages");
}
EditorGUI.indentLevel--;
}
}
// Try to find active objects of the pool's type
if (poolType.BaseType.IsGenericType)
{
Type elementType = poolType.BaseType.GetGenericArguments()[0];
int activeCount = 0;
// Count active objects of the specific pool's component type
foreach (var obj in UnityEngine.Object.FindObjectsByType(elementType, FindObjectsSortMode.None))
{
var comp = obj as Component;
if (comp != null && comp.gameObject.activeInHierarchy)
{
activeCount++;
}
}
EditorGUILayout.LabelField($"Active Objects (Current Scene): {activeCount}");
// Add a note about pooling status
if (activeCount > 0 && totalPooledCountField != null)
{
int pooledCount = (int)totalPooledCountField.GetValue(poolComponent);
EditorGUILayout.LabelField($"Pooling Efficiency: {pooledCount} ready in pool, {activeCount} active");
}
}
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
}
/// <summary>
/// Finds all objects that derive from a generic base type
/// </summary>
private Component[] FindObjectsOfBaseType(Type baseComponentType, Type genericBaseType)
{
List<Component> results = new List<Component>();
// Find all components in the scene
Component[] allComponents = UnityEngine.Object.FindObjectsByType<Component>(FindObjectsSortMode.None);
foreach (var component in allComponents)
{
Type componentType = component.GetType();
// Check if this type derives from the generic base type
while (componentType != null && componentType != typeof(object))
{
if (componentType.IsGenericType &&
componentType.GetGenericTypeDefinition() == genericBaseType)
{
results.Add(component);
break;
}
// Also check for non-generic derived types
if (componentType.BaseType != null &&
componentType.BaseType.IsGenericType &&
componentType.BaseType.GetGenericTypeDefinition() == genericBaseType)
{
results.Add(component);
break;
}
componentType = componentType.BaseType;
}
}
return results.ToArray();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 17d6e42e7ca549b8b209f0714c8d106b
timeCreated: 1758016486

View File

@@ -0,0 +1,911 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Editor.Utilities
{
public class SpriteColliderGenerator : EditorWindow
{
private Vector2 scrollPosition;
[Tooltip("List of GameObjects with SpriteRenderers to generate colliders for")]
private List<GameObject> selectedObjects = new List<GameObject>();
[Tooltip("Controls how much to simplify the collider shape (lower values create more complex colliders)")]
private float simplificationTolerance = 0.05f;
[Tooltip("When enabled, removes any existing PolygonCollider2D components before adding new ones")]
private bool replaceExistingColliders = true;
[Tooltip("When enabled, applies colliders to all child objects with SpriteRenderers")]
private bool applyToChildren = false;
[Tooltip("When enabled, allows scaling the collider outward or inward from the sprite center")]
private bool offsetFromCenter = false;
[Tooltip("Distance to offset the collider from the sprite outline (positive values expand, negative values contract)")]
private float offsetDistance = 0f;
[Tooltip("When enabled, creates trigger colliders instead of solid colliders")]
private bool generateTriggerColliders = false;
[Tooltip("Threshold for transparency detection (pixels with alpha below this value are considered transparent)")]
private int alphaCutoff = 128; // Used when generating colliders (0-255)
[Tooltip("Controls the level of detail for the generated collider (affects vertex count)")]
private int detailLevel = 2; // 1 = low, 2 = medium, 3 = high
[Tooltip("When enabled, shows a preview of the colliders in the scene view before generating them")]
private bool previewColliders = true;
[Tooltip("Color used for previewing colliders in the scene view")]
private Color previewColor = new Color(0.2f, 1f, 0.3f, 0.5f);
[Tooltip("Layer to assign to GameObjects when colliders are generated")]
private int targetLayer = 0;
private List<Mesh> previewMeshes = new List<Mesh>();
[MenuItem("Tools/Sprite Collider Generator")]
public static void ShowWindow()
{
GetWindow<SpriteColliderGenerator>("Sprite Collider Generator");
}
private void OnEnable()
{
// Subscribe to scene change events to clear invalid object references
UnityEditor.SceneManagement.EditorSceneManager.sceneOpened += OnSceneOpened;
UnityEditor.SceneManagement.EditorSceneManager.sceneClosed += OnSceneClosed;
// Also subscribe to playmode changes as they can invalidate references
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
// Subscribe to prefab stage changes (Unity 2018.3+)
UnityEditor.SceneManagement.PrefabStage.prefabStageOpened += OnPrefabStageOpened;
UnityEditor.SceneManagement.PrefabStage.prefabStageClosing += OnPrefabStageClosing;
}
private void OnDisable()
{
// Unsubscribe from events
UnityEditor.SceneManagement.EditorSceneManager.sceneOpened -= OnSceneOpened;
UnityEditor.SceneManagement.EditorSceneManager.sceneClosed -= OnSceneClosed;
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
UnityEditor.SceneManagement.PrefabStage.prefabStageOpened -= OnPrefabStageOpened;
UnityEditor.SceneManagement.PrefabStage.prefabStageClosing -= OnPrefabStageClosing;
// Clean up any preview meshes when window is closed
foreach (var mesh in previewMeshes)
{
if (mesh != null)
{
DestroyImmediate(mesh);
}
}
previewMeshes.Clear();
}
private void OnSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
{
// Clear selected objects when a scene is opened
ClearInvalidReferences();
}
private void OnSceneClosed(UnityEngine.SceneManagement.Scene scene)
{
// Clear selected objects when a scene is closed
ClearInvalidReferences();
}
private void OnPlayModeStateChanged(PlayModeStateChange state)
{
// Clear references when entering/exiting play mode as they become invalid
if (state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.ExitingPlayMode)
{
ClearInvalidReferences();
}
}
private void OnPrefabStageOpened(UnityEditor.SceneManagement.PrefabStage stage)
{
// Clear selected objects when entering a prefab stage
ClearInvalidReferences();
}
private void OnPrefabStageClosing(UnityEditor.SceneManagement.PrefabStage stage)
{
// Clear selected objects when exiting a prefab stage
ClearInvalidReferences();
}
/// <summary>
/// Clears invalid GameObject references from the selected objects list
/// </summary>
private void ClearInvalidReferences()
{
if (selectedObjects.Count > 0)
{
selectedObjects.Clear();
ClearPreviews(); // Also clear any preview meshes
Repaint(); // Refresh the window UI
}
}
private void OnGUI()
{
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Sprite Collider Generator", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Select GameObjects with SpriteRenderers and generate accurate PolygonCollider2D components based on the sprite outlines.", MessageType.Info);
EditorGUILayout.Space();
// Object selection section
EditorGUILayout.LabelField("Selected Objects", EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(new GUIContent("Add Selected GameObjects", "Add GameObjects currently selected in the scene or project to the list for processing.")))
{
AddSelectedGameObjects();
}
EditorGUILayout.EndHorizontal();
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUILayout.Height(150));
for (int i = 0; i < selectedObjects.Count; i++)
{
EditorGUILayout.BeginHorizontal();
selectedObjects[i] = (GameObject)EditorGUILayout.ObjectField(selectedObjects[i], typeof(GameObject), true);
if (GUILayout.Button("X", GUILayout.Width(20)))
{
selectedObjects.RemoveAt(i);
i--;
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
if (GUILayout.Button(new GUIContent("Clear All", "Remove all objects from the selection list.")))
{
selectedObjects.Clear();
}
EditorGUILayout.Space();
// Collider generation options
EditorGUILayout.LabelField("Generation Options", EditorStyles.boldLabel);
// Detail level for collider generation (affects vertex count)
string[] detailOptions = new string[] { "Low", "Medium", "High" };
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent("Detail Level:", "Controls the level of detail for the generated collider (affects vertex count)."), GUILayout.Width(180));
detailLevel = EditorGUILayout.Popup(detailLevel - 1, detailOptions) + 1;
EditorGUILayout.EndHorizontal();
// Simplification tolerance (how much to simplify the collider)
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent("Simplification Tolerance:", "Controls how much to simplify the collider shape (lower values create more complex colliders)."), GUILayout.Width(180));
simplificationTolerance = EditorGUILayout.Slider(simplificationTolerance, 0.01f, 0.2f);
EditorGUILayout.EndHorizontal();
// Alpha cutoff for transparency
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent("Alpha Cutoff (0-255):", "Threshold for transparency detection (pixels with alpha below this value are considered transparent)."), GUILayout.Width(180));
alphaCutoff = EditorGUILayout.IntSlider(alphaCutoff, 0, 255);
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
// Additional options
replaceExistingColliders = EditorGUILayout.Toggle(
new GUIContent("Replace Existing Colliders", "When enabled, removes any existing PolygonCollider2D components before adding new ones."),
replaceExistingColliders);
applyToChildren = EditorGUILayout.Toggle(
new GUIContent("Apply To Children", "When enabled, applies colliders to all child objects with SpriteRenderers."),
applyToChildren);
generateTriggerColliders = EditorGUILayout.Toggle(
new GUIContent("Generate Trigger Colliders", "When enabled, creates trigger colliders instead of solid colliders."),
generateTriggerColliders);
// Layer selection
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent("Target Layer:", "Layer to assign to GameObjects when colliders are generated. Leave as 'Nothing' to keep current layer."), GUILayout.Width(180));
targetLayer = EditorGUILayout.LayerField(targetLayer);
EditorGUILayout.EndHorizontal();
// Offset option
offsetFromCenter = EditorGUILayout.Toggle(
new GUIContent("Offset From Center", "When enabled, allows scaling the collider outward or inward from the sprite center."),
offsetFromCenter);
if (offsetFromCenter)
{
EditorGUI.indentLevel++;
offsetDistance = EditorGUILayout.FloatField(
new GUIContent("Offset Distance", "Distance to offset the collider from the sprite outline (positive values expand, negative values contract)."),
offsetDistance);
EditorGUI.indentLevel--;
}
// Preview option
previewColliders = EditorGUILayout.Toggle(
new GUIContent("Preview Colliders", "When enabled, shows a preview of the colliders in the scene view before generating them."),
previewColliders);
if (previewColliders)
{
EditorGUI.indentLevel++;
previewColor = EditorGUILayout.ColorField(
new GUIContent("Preview Color", "Color used for previewing colliders in the scene view."),
previewColor);
// Create a horizontal layout for the preview buttons
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(new GUIContent("Update Preview", "Refresh the preview display in the scene view.")))
{
GenerateColliderPreviews();
}
if (GUILayout.Button(new GUIContent("Clear Preview", "Remove all preview colliders from the scene view.")))
{
ClearPreviews();
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
// Generate colliders button
GUI.enabled = selectedObjects.Count > 0;
if (GUILayout.Button(new GUIContent("Generate Colliders", "Create polygon colliders for all selected sprites based on current settings.")))
{
GenerateColliders();
}
GUI.enabled = true;
EditorGUILayout.EndVertical();
// Force the scene view to repaint if we're showing previews
if (previewColliders && Event.current.type == EventType.Repaint)
{
SceneView.RepaintAll();
}
}
private void AddSelectedGameObjects()
{
foreach (GameObject obj in Selection.gameObjects)
{
if (!selectedObjects.Contains(obj))
{
// Only add if it has a SpriteRenderer or any of its children do
if (obj.GetComponent<SpriteRenderer>() != null ||
(applyToChildren && obj.GetComponentInChildren<SpriteRenderer>() != null))
{
selectedObjects.Add(obj);
}
}
}
}
private void GenerateColliderPreviews()
{
// Clean up existing preview meshes
foreach (var mesh in previewMeshes)
{
if (mesh != null)
{
DestroyImmediate(mesh);
}
}
previewMeshes.Clear();
if (!previewColliders || selectedObjects.Count == 0)
return;
foreach (var obj in selectedObjects)
{
if (obj == null) continue;
var spriteRenderers = applyToChildren ?
obj.GetComponentsInChildren<SpriteRenderer>() :
new SpriteRenderer[] { obj.GetComponent<SpriteRenderer>() };
foreach (var renderer in spriteRenderers)
{
if (renderer == null || renderer.sprite == null)
continue;
Sprite sprite = renderer.sprite;
List<Vector2[]> paths = GetSpritePaths(sprite, simplificationTolerance);
if (paths.Count == 0)
continue;
foreach (var path in paths)
{
// Create a preview mesh from the path
Mesh previewMesh = CreateMeshFromPath(path, renderer.transform);
if (previewMesh != null)
previewMeshes.Add(previewMesh);
}
}
}
}
/// <summary>
/// Clears all preview meshes from the scene view
/// </summary>
private void ClearPreviews()
{
foreach (var mesh in previewMeshes)
{
if (mesh != null)
{
DestroyImmediate(mesh);
}
}
previewMeshes.Clear();
// Force a repaint of the scene view
SceneView.RepaintAll();
}
private Mesh CreateMeshFromPath(Vector2[] path, Transform transform)
{
if (path.Length < 3)
return null;
Mesh mesh = new Mesh();
// Convert the path to 3D vertices and apply the sprite's transform
Vector3[] vertices = new Vector3[path.Length];
for (int i = 0; i < path.Length; i++)
{
// Convert the local position to world space using the transform
vertices[i] = transform.TransformPoint(new Vector3(path[i].x, path[i].y, 0));
}
// Triangulate the polygon
Triangulator triangulator = new Triangulator(path);
int[] triangles = triangulator.Triangulate();
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.RecalculateNormals();
return mesh;
}
private void GenerateColliders()
{
int successCount = 0;
List<string> errors = new List<string>();
Undo.RecordObjects(selectedObjects.ToArray(), "Generate Sprite Colliders");
foreach (var obj in selectedObjects)
{
if (obj == null) continue;
try
{
var spriteRenderers = applyToChildren ?
obj.GetComponentsInChildren<SpriteRenderer>() :
new SpriteRenderer[] { obj.GetComponent<SpriteRenderer>() };
foreach (var renderer in spriteRenderers)
{
if (renderer == null || renderer.sprite == null)
continue;
// Check if we're working with a prefab
bool isPrefab = PrefabUtility.IsPartOfPrefabAsset(renderer.gameObject);
GameObject targetObject = renderer.gameObject;
if (isPrefab)
{
// If it's a prefab, we need special handling
string prefabPath = AssetDatabase.GetAssetPath(targetObject);
targetObject = PrefabUtility.LoadPrefabContents(prefabPath);
SpriteRenderer prefabRenderer = targetObject.GetComponent<SpriteRenderer>();
if (prefabRenderer == null || prefabRenderer.sprite == null)
{
PrefabUtility.UnloadPrefabContents(targetObject);
continue;
}
if (GenerateColliderForRenderer(prefabRenderer))
{
// Save the changes to the prefab
PrefabUtility.SaveAsPrefabAsset(targetObject, prefabPath);
successCount++;
}
PrefabUtility.UnloadPrefabContents(targetObject);
}
else
{
// For scene objects, just generate the collider directly
if (GenerateColliderForRenderer(renderer))
{
successCount++;
}
}
}
}
catch (Exception e)
{
errors.Add($"{obj.name}: {e.Message}");
}
}
// Clean up any preview meshes as we've now generated real colliders
ClearPreviews();
if (successCount > 0)
{
Debug.Log($"Successfully generated colliders for {successCount} sprite(s).");
}
if (errors.Count > 0)
{
Debug.LogError($"Errors occurred while generating colliders:\n{string.Join("\n", errors)}");
}
}
private bool GenerateColliderForRenderer(SpriteRenderer renderer)
{
if (renderer == null || renderer.sprite == null)
return false;
Sprite sprite = renderer.sprite;
GameObject targetObject = renderer.gameObject;
// Remove existing colliders if specified
if (replaceExistingColliders)
{
PolygonCollider2D[] existingColliders = targetObject.GetComponents<PolygonCollider2D>();
foreach (var collider in existingColliders)
{
Undo.DestroyObjectImmediate(collider);
}
}
// Create a new polygon collider
PolygonCollider2D polygonCollider = Undo.AddComponent<PolygonCollider2D>(targetObject);
if (polygonCollider == null)
return false;
// Set as trigger if specified
polygonCollider.isTrigger = generateTriggerColliders;
// Get paths from the sprite
List<Vector2[]> paths = GetSpritePaths(sprite, simplificationTolerance);
if (paths.Count == 0)
return false;
// Apply offset if needed
if (offsetFromCenter && offsetDistance != 0)
{
for (int i = 0; i < paths.Count; i++)
{
Vector2[] offsetPath = new Vector2[paths[i].Length];
for (int j = 0; j < paths[i].Length; j++)
{
// Calculate direction from center (0,0) to the point
Vector2 dir = paths[i][j].normalized;
// Apply offset in that direction
offsetPath[j] = paths[i][j] + dir * offsetDistance;
}
paths[i] = offsetPath;
}
}
// Set the paths on the collider
polygonCollider.pathCount = paths.Count;
for (int i = 0; i < paths.Count; i++)
{
polygonCollider.SetPath(i, paths[i]);
}
// Set the layer on the GameObject if a specific layer is selected
SetTargetLayer(targetObject);
return true;
}
/// <summary>
/// Sets the target layer on the GameObject if a layer is selected
/// </summary>
/// <param name="targetObject">The GameObject to set the layer on</param>
private void SetTargetLayer(GameObject targetObject)
{
if (targetLayer != 0)
{
Undo.RecordObject(targetObject, "Set GameObject Layer");
targetObject.layer = targetLayer;
}
}
private List<Vector2[]> GetSpritePaths(Sprite sprite, float tolerance)
{
List<Vector2[]> result = new List<Vector2[]>();
if (sprite == null)
return result;
// Get the raw physics shape data from the sprite
int physicsShapeCount = sprite.GetPhysicsShapeCount();
if (physicsShapeCount == 0)
{
// Use the sprite's bounds if no physics shape is defined
Vector2[] boundingBoxPath = new Vector2[4];
Bounds bounds = sprite.bounds;
boundingBoxPath[0] = new Vector2(bounds.min.x, bounds.min.y);
boundingBoxPath[1] = new Vector2(bounds.min.x, bounds.max.y);
boundingBoxPath[2] = new Vector2(bounds.max.x, bounds.max.y);
boundingBoxPath[3] = new Vector2(bounds.max.x, bounds.min.y);
result.Add(boundingBoxPath);
return result;
}
// Adjust the detail level based on the setting
float actualTolerance = tolerance;
switch (detailLevel)
{
case 1: // Low
actualTolerance = tolerance * 2.0f;
break;
case 2: // Medium - default
actualTolerance = tolerance;
break;
case 3: // High
actualTolerance = tolerance * 0.5f;
break;
}
// Get all physics shapes from the sprite
for (int i = 0; i < physicsShapeCount; i++)
{
List<Vector2> path = new List<Vector2>();
sprite.GetPhysicsShape(i, path);
// Apply simplification if needed
if (actualTolerance > 0.01f)
{
path = SimplifyPath(path, actualTolerance);
}
if (path.Count >= 3) // Need at least 3 points for a valid polygon
{
result.Add(path.ToArray());
}
}
return result;
}
private List<Vector2> SimplifyPath(List<Vector2> points, float tolerance)
{
if (points.Count <= 3)
return points;
// Implementation of Ramer-Douglas-Peucker algorithm for simplifying a polygon
List<Vector2> result = new List<Vector2>();
List<int> markers = new List<int>(new int[points.Count]);
markers[0] = 1;
markers[points.Count - 1] = 1;
SimplifyDouglasPeucker(points, tolerance, markers, 0, points.Count - 1);
for (int i = 0; i < points.Count; i++)
{
if (markers[i] == 1)
{
result.Add(points[i]);
}
}
return result;
}
private void SimplifyDouglasPeucker(List<Vector2> points, float tolerance, List<int> markers, int start, int end)
{
if (end <= start + 1)
return;
float maxDistance = 0;
int maxIndex = start;
Vector2 startPoint = points[start];
Vector2 endPoint = points[end];
// Find the point furthest from the line segment
for (int i = start + 1; i < end; i++)
{
float distance = PerpendicularDistance(points[i], startPoint, endPoint);
if (distance > maxDistance)
{
maxDistance = distance;
maxIndex = i;
}
}
// If the furthest point is beyond tolerance, mark it for keeping and recurse
if (maxDistance > tolerance)
{
markers[maxIndex] = 1;
SimplifyDouglasPeucker(points, tolerance, markers, start, maxIndex);
SimplifyDouglasPeucker(points, tolerance, markers, maxIndex, end);
}
}
private float PerpendicularDistance(Vector2 point, Vector2 lineStart, Vector2 lineEnd)
{
if (lineStart == lineEnd)
return Vector2.Distance(point, lineStart);
float dx = lineEnd.x - lineStart.x;
float dy = lineEnd.y - lineStart.y;
// Normalize
float norm = Mathf.Sqrt(dx * dx + dy * dy);
if (norm < float.Epsilon)
return Vector2.Distance(point, lineStart);
dx /= norm;
dy /= norm;
// Calculate perpendicular distance
float px = point.x - lineStart.x;
float py = point.y - lineStart.y;
float projectionLength = px * dx + py * dy;
Vector2 projection = new Vector2(
lineStart.x + projectionLength * dx,
lineStart.y + projectionLength * dy);
return Vector2.Distance(point, projection);
}
// Scene view event handling for previewing colliders
[InitializeOnLoadMethod]
static void Initialize()
{
SceneView.duringSceneGui += OnSceneGUI;
}
static void OnSceneGUI(SceneView sceneView)
{
// Find all open collider generator windows
var windows = Resources.FindObjectsOfTypeAll<SpriteColliderGenerator>();
foreach (var window in windows)
{
window.DrawColliderPreviews(sceneView);
}
}
void DrawColliderPreviews(SceneView sceneView)
{
if (!previewColliders || previewMeshes.Count == 0)
return;
// Draw all preview meshes with the selected color
Material previewMaterial = new Material(Shader.Find("Hidden/Internal-Colored"));
previewMaterial.SetPass(0);
previewMaterial.SetColor("_Color", previewColor);
if (Event.current.type == EventType.Repaint)
{
GL.PushMatrix();
GL.MultMatrix(Matrix4x4.identity);
// Enable blending for transparency
GL.Begin(GL.TRIANGLES);
GL.Color(previewColor);
foreach (var mesh in previewMeshes)
{
if (mesh != null)
{
// Draw each triangle in the mesh
for (int i = 0; i < mesh.triangles.Length; i += 3)
{
Vector3 v0 = mesh.vertices[mesh.triangles[i]];
Vector3 v1 = mesh.vertices[mesh.triangles[i + 1]];
Vector3 v2 = mesh.vertices[mesh.triangles[i + 2]];
GL.Vertex(v0);
GL.Vertex(v1);
GL.Vertex(v2);
}
}
}
GL.End();
GL.PopMatrix();
// Also draw the outline
GL.PushMatrix();
GL.MultMatrix(Matrix4x4.identity);
GL.Begin(GL.LINES);
// Set a more visible outline color
Color outlineColor = new Color(previewColor.r, previewColor.g, previewColor.b, 1f);
GL.Color(outlineColor);
foreach (var mesh in previewMeshes)
{
if (mesh != null)
{
// Create a dictionary to track which edges we've drawn
HashSet<string> drawnEdges = new HashSet<string>();
// Draw edges of each triangle
for (int i = 0; i < mesh.triangles.Length; i += 3)
{
DrawEdgeIfNotDrawn(mesh.vertices[mesh.triangles[i]], mesh.vertices[mesh.triangles[i + 1]], drawnEdges);
DrawEdgeIfNotDrawn(mesh.vertices[mesh.triangles[i + 1]], mesh.vertices[mesh.triangles[i + 2]], drawnEdges);
DrawEdgeIfNotDrawn(mesh.vertices[mesh.triangles[i + 2]], mesh.vertices[mesh.triangles[i]], drawnEdges);
}
}
}
GL.End();
GL.PopMatrix();
}
}
private void DrawEdgeIfNotDrawn(Vector3 v1, Vector3 v2, HashSet<string> drawnEdges)
{
// Create a unique key for this edge (order vertices to ensure uniqueness)
string edgeKey;
if (v1.x < v2.x || (v1.x == v2.x && v1.y < v2.y))
edgeKey = $"{v1.x},{v1.y},{v1.z}_{v2.x},{v2.y},{v2.z}";
else
edgeKey = $"{v2.x},{v2.y},{v2.z}_{v1.x},{v1.y},{v1.z}";
// Only draw if we haven't drawn this edge yet
if (!drawnEdges.Contains(edgeKey))
{
GL.Vertex(v1);
GL.Vertex(v2);
drawnEdges.Add(edgeKey);
}
}
}
// Helper class for triangulating polygons
public class Triangulator
{
private List<Vector2> m_points;
public Triangulator(Vector2[] points)
{
m_points = new List<Vector2>(points);
}
public int[] Triangulate()
{
List<int> indices = new List<int>();
int n = m_points.Count;
if (n < 3)
return indices.ToArray();
int[] V = new int[n];
if (Area() > 0)
{
for (int v = 0; v < n; v++)
V[v] = v;
}
else
{
for (int v = 0; v < n; v++)
V[v] = (n - 1) - v;
}
int nv = n;
int count = 2 * nv;
for (int v = nv - 1; nv > 2; )
{
if ((count--) <= 0)
return indices.ToArray();
int u = v;
if (nv <= u)
u = 0;
v = u + 1;
if (nv <= v)
v = 0;
int w = v + 1;
if (nv <= w)
w = 0;
if (Snip(u, v, w, nv, V))
{
int a, b, c, s, t;
a = V[u];
b = V[v];
c = V[w];
indices.Add(a);
indices.Add(b);
indices.Add(c);
for (s = v, t = v + 1; t < nv; s++, t++)
V[s] = V[t];
nv--;
count = 2 * nv;
}
}
indices.Reverse();
return indices.ToArray();
}
private float Area()
{
int n = m_points.Count;
float A = 0.0f;
for (int p = n - 1, q = 0; q < n; p = q++)
{
Vector2 pval = m_points[p];
Vector2 qval = m_points[q];
A += pval.x * qval.y - qval.x * pval.y;
}
return (A * 0.5f);
}
private bool Snip(int u, int v, int w, int n, int[] V)
{
int p;
Vector2 A = m_points[V[u]];
Vector2 B = m_points[V[v]];
Vector2 C = m_points[V[w]];
if (Mathf.Epsilon > (((B.x - A.x) * (C.y - A.y)) - ((B.y - A.y) * (C.x - A.x))))
return false;
for (p = 0; p < n; p++)
{
if ((p == u) || (p == v) || (p == w))
continue;
Vector2 P = m_points[V[p]];
if (InsideTriangle(A, B, C, P))
return false;
}
return true;
}
private bool InsideTriangle(Vector2 A, Vector2 B, Vector2 C, Vector2 P)
{
float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
float cCROSSap, bCROSScp, aCROSSbp;
ax = C.x - B.x; ay = C.y - B.y;
bx = A.x - C.x; by = A.y - C.y;
cx = B.x - A.x; cy = B.y - A.y;
apx = P.x - A.x; apy = P.y - A.y;
bpx = P.x - B.x; bpy = P.y - B.y;
cpx = P.x - C.x; cpy = P.y - C.y;
aCROSSbp = ax * bpy - ay * bpx;
cCROSSap = cx * apy - cy * apx;
bCROSScp = bx * cpy - by * cpx;
return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 420526c0ea5943bb930e3e0913b9dee7
timeCreated: 1758028488

View File

@@ -1,6 +1,7 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
namespace Pathfinding {
using Pathfinding.RVO;
@@ -260,6 +261,12 @@ namespace Pathfinding {
reachedEndOfPath = false;
}
/// <summary>
/// Event triggered when the AI has reached its target.
/// Subscribe to this to get notified when the agent reaches its destination.
/// </summary>
public event Action OnTargetReachedEvent;
/// <summary>
/// The end of the path has been reached.
/// If you want custom logic for when the AI has reached it's destination add it here. You can
@@ -269,6 +276,7 @@ namespace Pathfinding {
/// So when the agent is close to the destination this method will typically be called every <see cref="repathRate"/> seconds.
/// </summary>
public virtual void OnTargetReached () {
OnTargetReachedEvent?.Invoke();
}
/// <summary>

View File

@@ -0,0 +1,3 @@
{
"name": "OptimizedRope"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f7c43f01316c63c43a8b70a1dd6bdfac
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
{
"name": "OptimizedRopeEditor",
"rootNamespace": "",
"references": [
"GUID:f7c43f01316c63c43a8b70a1dd6bdfac"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 57319c21dd728f548b8d33eeb404eb44
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -75,8 +75,20 @@ namespace GogoGaga.OptimizedRopesAndCables
public bool IsPrefab => gameObject.scene.rootCount == 0;
private void Start()
// Track initialization state
private bool isInitialized = false;
/// <summary>
/// Public method to explicitly initialize the rope.
/// Call this after setting up endpoints if creating ropes at runtime.
/// </summary>
/// <returns>True if initialization was successful, false otherwise</returns>
public bool Initialize()
{
// Skip if already initialized
if (isInitialized)
return true;
InitializeLineRenderer();
if (AreEndPointsValid())
{
@@ -84,7 +96,17 @@ namespace GogoGaga.OptimizedRopesAndCables
targetValue = currentValue;
currentVelocity = Vector3.zero;
SetSplinePoint(); // Ensure initial spline point is set correctly
isInitialized = true;
return true;
}
return false;
}
private void Start()
{
// Use the same initialization method to avoid code duplication
Initialize();
}
private void OnValidate()
@@ -208,15 +230,62 @@ namespace GogoGaga.OptimizedRopesAndCables
return point;
}
public Vector3 GetPointAt(float t)
/// <summary>
/// Set the start point of the rope
/// </summary>
public void SetStartPoint(Transform newStartPoint, bool recalculateRope = false)
{
if (!AreEndPointsValid())
{
Debug.LogError("StartPoint or EndPoint is not assigned.", gameObject);
return Vector3.zero;
}
startPoint = newStartPoint;
if (recalculateRope)
RecalculateRope();
}
return GetRationalBezierPoint(startPoint.position, currentValue, endPoint.position, t, StartPointWeight, midPointWeight, EndPointWeight);
/// <summary>
/// Set the end point of the rope
/// </summary>
public void SetEndPoint(Transform newEndPoint, bool recalculateRope = false)
{
endPoint = newEndPoint;
if (recalculateRope)
RecalculateRope();
}
/// <summary>
/// Set the mid point of the rope
/// </summary>
public void SetMidPoint(Transform newMidPoint, bool recalculateRope = false)
{
midPoint = newMidPoint;
if (recalculateRope)
RecalculateRope();
}
/// <summary>
/// Get a point along the rope at the specified position (0-1)
/// </summary>
public Vector3 GetPointAt(float position)
{
position = Mathf.Clamp01(position);
Vector3 mid = GetMidPoint();
return GetRationalBezierPoint(startPoint.position, mid, endPoint.position, position, StartPointWeight, midPointWeight, EndPointWeight);
}
/// <summary>
/// Force recalculation of the rope
/// </summary>
public void RecalculateRope()
{
if (!isInitialized)
{
Initialize();
}
if (AreEndPointsValid())
{
SetSplinePoint();
SimulatePhysics();
NotifyPointsChanged();
}
}
private void FixedUpdate()
@@ -262,61 +331,6 @@ namespace GogoGaga.OptimizedRopesAndCables
// Gizmos.DrawSphere(midPos, 0.2f);
}
// New API methods for setting start and end points
// with instantAssign parameter to recalculate the rope immediately, without
// animating the rope to the new position.
// When newStartPoint or newEndPoint is null, the rope will be recalculated immediately
public void SetStartPoint(Transform newStartPoint, bool instantAssign = false)
{
startPoint = newStartPoint;
prevStartPointPosition = startPoint == null ? Vector3.zero : startPoint.position;
if (instantAssign || newStartPoint == null)
{
RecalculateRope();
}
NotifyPointsChanged();
}
public void SetMidPoint(Transform newMidPoint, bool instantAssign = false)
{
midPoint = newMidPoint;
prevMidPointPosition = midPoint == null ? 0.5f : midPointPosition;
if (instantAssign || newMidPoint == null)
{
RecalculateRope();
}
NotifyPointsChanged();
}
public void SetEndPoint(Transform newEndPoint, bool instantAssign = false)
{
endPoint = newEndPoint;
prevEndPointPosition = endPoint == null ? Vector3.zero : endPoint.position;
if (instantAssign || newEndPoint == null)
{
RecalculateRope();
}
NotifyPointsChanged();
}
public void RecalculateRope()
{
if (!AreEndPointsValid())
{
lineRenderer.positionCount = 0;
return;
}
currentValue = GetMidPoint();
targetValue = currentValue;
currentVelocity = Vector3.zero;
SetSplinePoint();
}
private void NotifyPointsChanged()
{

View File

@@ -0,0 +1,3 @@
{
"name": "PixelplacementAssembly"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: db4a9769b2b9c5a4788bcd189eea1f0b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
{
"name": "PixelplacementEditor",
"rootNamespace": "",
"references": [
"GUID:db4a9769b2b9c5a4788bcd189eea1f0b"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0547315a6b16c1a48bf1db2b83869a5a
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More