Added A* pathfinding for NPCs #2

Merged
s452753 merged 1 commits from jakszt-astarpathfinding into master 2022-11-07 22:21:34 +01:00
103 changed files with 4155 additions and 726 deletions
Showing only changes of commit 01b0d5ca21 - Show all commits

View File

@ -2,8 +2,10 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<CscToolPath>C:\Program Files\Unity\Hub\Editor\2020.3.32f1\Editor\Data\Tools\RoslynScripts</CscToolPath> <_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package</_TargetFrameworkDirectories>
<CscToolExe>unity_csc.bat</CscToolExe> <_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package</_FullFrameworkReferenceAssemblyPaths>
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
<CodeAnalysisRuleSet></CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -52,9 +54,13 @@
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Scripts\RespawnScript.cs" /> <Compile Include="Assets\Scripts\RespawnScript.cs" />
<Compile Include="Assets\LetterText.cs" /> <Compile Include="Assets\LetterText.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\UnitMovement.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\PathNode.cs" />
<Compile Include="Assets\Scripts\Pathfinding\AStarPathfindingAgent.cs" />
<Compile Include="Assets\Scripts\SceneManager\SceneTaskManager.cs" /> <Compile Include="Assets\Scripts\SceneManager\SceneTaskManager.cs" />
<Compile Include="Assets\Scripts\SettingsButton.cs" /> <Compile Include="Assets\Scripts\SettingsButton.cs" />
<Compile Include="Assets\Scripts\Domain\DialoguePanel\IPanel.cs" /> <Compile Include="Assets\Scripts\Domain\DialoguePanel\IPanel.cs" />
<Compile Include="Assets\Scripts\Pathfinding\NodeMap.cs" />
<Compile Include="Assets\Scripts\SceneManager\MainCharacter\MainCharacterManager.cs" /> <Compile Include="Assets\Scripts\SceneManager\MainCharacter\MainCharacterManager.cs" />
<Compile Include="Assets\Scripts\Domain\DialoguePanel\Enum\PanelButtonEnum.cs" /> <Compile Include="Assets\Scripts\Domain\DialoguePanel\Enum\PanelButtonEnum.cs" />
<Compile Include="Assets\Scripts\UI\ISlot.cs" /> <Compile Include="Assets\Scripts\UI\ISlot.cs" />
@ -63,6 +69,7 @@
<Compile Include="Assets\Scripts\Objects\GoldOre.cs" /> <Compile Include="Assets\Scripts\Objects\GoldOre.cs" />
<Compile Include="Assets\Scripts\Domain\PanelTest.cs" /> <Compile Include="Assets\Scripts\Domain\PanelTest.cs" />
<Compile Include="Assets\Scripts\SceneManager\NPC\NPCManager.cs" /> <Compile Include="Assets\Scripts\SceneManager\NPC\NPCManager.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\GridPathfinding.cs" />
<Compile Include="Assets\OpenSettingsOnESCPress.cs" /> <Compile Include="Assets\OpenSettingsOnESCPress.cs" />
<Compile Include="Assets\closePossibleButtonInfo.cs" /> <Compile Include="Assets\closePossibleButtonInfo.cs" />
<Compile Include="Assets\BreakOre.cs" /> <Compile Include="Assets\BreakOre.cs" />
@ -90,13 +97,16 @@
<Compile Include="Assets\Scripts\PlayerPosition.cs" /> <Compile Include="Assets\Scripts\PlayerPosition.cs" />
<Compile Include="Assets\Scripts\Chest\ChestSlot.cs" /> <Compile Include="Assets\Scripts\Chest\ChestSlot.cs" />
<Compile Include="Assets\Scripts\Domain\Dialogue\Model\DialogueModel.cs" /> <Compile Include="Assets\Scripts\Domain\Dialogue\Model\DialogueModel.cs" />
<Compile Include="Assets\LevelUpPopUp.cs" />
<Compile Include="Assets\ChangeLanguageToEnglish.cs" /> <Compile Include="Assets\ChangeLanguageToEnglish.cs" />
<Compile Include="Assets\Scripts\CamerFollow.cs" /> <Compile Include="Assets\Scripts\CamerFollow.cs" />
<Compile Include="Assets\CloseIfQuestPanel.cs" /> <Compile Include="Assets\CloseIfQuestPanel.cs" />
<Compile Include="Assets\TreeParticleEffect.cs" /> <Compile Include="Assets\TreeParticleEffect.cs" />
<Compile Include="Assets\SaveMusicSettings.cs" /> <Compile Include="Assets\SaveMusicSettings.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\PathRoute.cs" />
<Compile Include="Assets\Scripts\SceneManager\SaveItem\EquippableItemPrefarbAssetData.cs" /> <Compile Include="Assets\Scripts\SceneManager\SaveItem\EquippableItemPrefarbAssetData.cs" />
<Compile Include="Assets\Scripts\Equipment\EquipmentSlot.cs" /> <Compile Include="Assets\Scripts\Equipment\EquipmentSlot.cs" />
<Compile Include="Assets\Scripts\Pathfinding\TileData.cs" />
<Compile Include="Assets\Scripts\DealDamage.cs" /> <Compile Include="Assets\Scripts\DealDamage.cs" />
<Compile Include="Assets\Scripts\LevelBar.cs" /> <Compile Include="Assets\Scripts\LevelBar.cs" />
<Compile Include="Assets\Scripts\Domain\DialoguePanel\Loader\DialoguePanelsPrefabsLoader.cs" /> <Compile Include="Assets\Scripts\Domain\DialoguePanel\Loader\DialoguePanelsPrefabsLoader.cs" />
@ -112,6 +122,7 @@
<Compile Include="Assets\TranslateText.cs" /> <Compile Include="Assets\TranslateText.cs" />
<Compile Include="Assets\Scripts\SceneManager\Teleports\Gateway.cs" /> <Compile Include="Assets\Scripts\SceneManager\Teleports\Gateway.cs" />
<Compile Include="Assets\Scripts\FloatValue.cs" /> <Compile Include="Assets\Scripts\FloatValue.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\LastMoveTo.cs" />
<Compile Include="Assets\Scripts\SceneManager\SaveItem\SaveEquitableItemSystem.cs" /> <Compile Include="Assets\Scripts\SceneManager\SaveItem\SaveEquitableItemSystem.cs" />
<Compile Include="Assets\Scripts\Item\EquippableItem.cs" /> <Compile Include="Assets\Scripts\Item\EquippableItem.cs" />
<Compile Include="Assets\Scripts\SceneManager\SceneEquippableItemManager.cs" /> <Compile Include="Assets\Scripts\SceneManager\SceneEquippableItemManager.cs" />
@ -127,8 +138,12 @@
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\FollowingEnemy.cs" /> <Compile Include="Assets\Scripts\Enemies&apos; Scprits\FollowingEnemy.cs" />
<Compile Include="Assets\Scripts\Domain\Dialogue\DialogueController.cs" /> <Compile Include="Assets\Scripts\Domain\Dialogue\DialogueController.cs" />
<Compile Include="Assets\Scripts\HealthBar.cs" /> <Compile Include="Assets\Scripts\HealthBar.cs" />
<Compile Include="Assets\Scripts\Pathfinding\Node.cs" />
<Compile Include="Assets\Scripts\Pathfinding\Pathfinding.cs" />
<Compile Include="Assets\Scripts\Item\PickableController.cs" /> <Compile Include="Assets\Scripts\Item\PickableController.cs" />
<Compile Include="Assets\Scripts\Chest\ChestController.cs" /> <Compile Include="Assets\Scripts\Chest\ChestController.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\MapPos.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\PathQueue.cs" />
<Compile Include="Assets\Scripts\DoorBehaviour.cs" /> <Compile Include="Assets\Scripts\DoorBehaviour.cs" />
<Compile Include="Assets\Scripts\SceneManager\SaveItem\EquippableItemPrefarbAsset.cs" /> <Compile Include="Assets\Scripts\SceneManager\SaveItem\EquippableItemPrefarbAsset.cs" />
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\PatrollingEnemy.cs" /> <Compile Include="Assets\Scripts\Enemies&apos; Scprits\PatrollingEnemy.cs" />
@ -139,6 +154,7 @@
<Compile Include="Assets\Scripts\Inventory\InventoryPanelController.cs" /> <Compile Include="Assets\Scripts\Inventory\InventoryPanelController.cs" />
<Compile Include="Assets\TakingDamage.cs" /> <Compile Include="Assets\TakingDamage.cs" />
<Compile Include="Assets\StartOnEnter.cs" /> <Compile Include="Assets\StartOnEnter.cs" />
<Compile Include="Assets\_\Stuff\GridPathfinding\BinaryTree.cs" />
<Compile Include="Assets\Scripts\Domain\Npc\NPCDialogue.cs" /> <Compile Include="Assets\Scripts\Domain\Npc\NPCDialogue.cs" />
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\Cave\BossThug.cs" /> <Compile Include="Assets\Scripts\Enemies&apos; Scprits\Cave\BossThug.cs" />
<Compile Include="Assets\Scripts\UI\BaseWarehouseController.cs" /> <Compile Include="Assets\Scripts\UI\BaseWarehouseController.cs" />
@ -737,96 +753,6 @@
<HintPath>C:/Program Files/Unity/Hub/Editor/2020.3.32f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll</HintPath> <HintPath>C:/Program Files/Unity/Hub/Editor/2020.3.32f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.2D.Animation.Editor"> <Reference Include="Unity.2D.Animation.Editor">
<<<<<<< HEAD
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.InternalAPIEngineBridge.001">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEngineBridge.001.dll</HintPath>
</Reference>
<Reference Include="Unity.VSCode.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.VSCode.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.PixelPerfect">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Tilemap.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll</HintPath>
</Reference>
<Reference Include="PsdPlugin">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/PsdPlugin.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.VisualStudio.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.VisualStudio.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.Timeline.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.IK.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Sprite.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Psdimporter.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Psdimporter.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Path.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Path.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.InternalAPIEditorBridge.001">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEditorBridge.001.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.UI">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/UnityEditor.UI.dll</HintPath>
</Reference>
<Reference Include="Unity.PlasticSCM.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Rider.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="Unity.Mathematics">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.IK.Runtime">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Animation.Triangle.Runtime">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Triangle.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Animation.Runtime">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.PixelPerfect.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.Timeline.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Mathematics.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Common.Runtime">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.SpriteShape.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Common.Editor">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.SpriteShape.Runtime">
<HintPath>C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll</HintPath>
=======
<HintPath>C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll</HintPath> <HintPath>C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.InternalAPIEngineBridge.001"> <Reference Include="Unity.InternalAPIEngineBridge.001">
@ -915,7 +841,6 @@
</Reference> </Reference>
<Reference Include="Unity.2D.SpriteShape.Runtime"> <Reference Include="Unity.2D.SpriteShape.Runtime">
<HintPath>C:/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll</HintPath> <HintPath>C:/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll</HintPath>
>>>>>>> jakszt-thuganimations
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugWalkDown
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: -5737209910555243353, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: 5970410323577050059, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: -8438286505667621047, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -5737209910555243353, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 5970410323577050059, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -8438286505667621047, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

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

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugWalkLeft
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 3375708551128050511, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: 475361983993561210, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: -592845421134076894, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 3375708551128050511, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 475361983993561210, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -592845421134076894, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6fc1cf4c2bfe92f4999e9161a8f00df6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugWalkRight
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: -8147506323478610176, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: 7639942379048000754, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: 630885841078028400, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -8147506323478610176, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 7639942379048000754, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 630885841078028400, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5c479d3e932cb5748a7aeaaa7d621251
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugWalkUp
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 7211768901348452491, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: -4449130184925231056, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: -1899329925172714913, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 7211768901348452491, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -4449130184925231056, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -1899329925172714913, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 16ba918a2a6e80b4fb97cf504b1be2a7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,66 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3079617781123838016
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3079617781123838030}
- component: {fileID: 3079617781123838031}
- component: {fileID: 3079617781123838029}
m_Layer: 0
m_Name: GridManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3079617781123838030
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3079617781123838016}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3079617781123838031
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3079617781123838016}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b34c300fab4fcd14c82134577cf22d14, type: 3}
m_Name:
m_EditorClassIdentifier:
mapSize: {x: 144, y: 137}
cellSize: 1
TileDatas:
- {fileID: 11400000, guid: aaa4610d4271c4c4f870a33c04002ea8, type: 2}
tilemap: {fileID: 0}
showIndividualNodes: 0
--- !u!114 &3079617781123838029
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3079617781123838016}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4770c4f9ef5ba784b823d2d2c2327491, type: 3}
m_Name:
m_EditorClassIdentifier:
Player: {fileID: 0}
Map: {fileID: 3079617781123838031}

View File

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

View File

@ -0,0 +1,286 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1107 &-8930954430168798002
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -8316410093360559377}
m_Position: {x: 293.1891, y: 47.39978, z: 0}
- serializedVersion: 1
m_State: {fileID: -6087507706285161766}
m_Position: {x: 290, y: 150, 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_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -8316410093360559377}
--- !u!1102 &-8316410093360559377
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 4768748432751829616}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 6423169707013116926}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-6087507706285161766
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree 0
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 8794286156724747360}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -5588113005279829250}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!206 &-5588113005279829250
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugRunTree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: af96c5abed78d2d4ab98419221e87075, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: -1}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: c09f1d1ac45344d4fa1ee7738a70004e, type: 2}
m_Threshold: 0.33333334
m_Position: {x: 0, y: 1}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 9eaff2bf40dcc8c4aaba1fa29fd65981, type: 2}
m_Threshold: 0.6666667
m_Position: {x: -1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: a5e98f9fb367d6344ab2b3f6c8872949, type: 2}
m_Threshold: 1
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
m_BlendParameter: Xinfo
m_BlendParameterY: Yinfo
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugAnimator
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Blend
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: Xinfo
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: Yinfo
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: isRunning
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -8930954430168798002}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!206 &361070096776021489
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BlendTree
m_Childs: []
m_BlendParameter: Blend
m_BlendParameterY: Blend
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1101 &4768748432751829616
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: isRunning
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -6087507706285161766}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!206 &6423169707013116926
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 5766c4d8a8d409242851cf9be801ef7e, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 1026f6b01b7e14c45b8ea2e9fc0e69de, type: 2}
m_Threshold: 0.33333334
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 7664525aa3a759646adf08465dfbbc16, type: 2}
m_Threshold: 0.6666667
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 13b78ec291fa07f4d937de40ec122acc, type: 2}
m_Threshold: 1
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
m_BlendParameter: Blend
m_BlendParameterY: Blend
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 1
--- !u!1101 &8794286156724747360
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: isRunning
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -8316410093360559377}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e408ead2b862ca4685d5ace7011f083
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,218 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!206 &-8586240220408617014
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: c09f1d1ac45344d4fa1ee7738a70004e, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: -1}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: X
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: af96c5abed78d2d4ab98419221e87075, type: 2}
m_Threshold: 0.25
m_Position: {x: 0, y: 1}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: X
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 9eaff2bf40dcc8c4aaba1fa29fd65981, type: 2}
m_Threshold: 0.5
m_Position: {x: -1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: X
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: a5e98f9fb367d6344ab2b3f6c8872949, type: 2}
m_Threshold: 0.75
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: X
m_Mirror: 0
m_BlendParameter: Xinfo
m_BlendParameterY: Yinfo
m_MinThreshold: 0
m_MaxThreshold: 0.75
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 1
--- !u!1107 &-6323065485593425674
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -182899528967422495}
m_Position: {x: 360, y: 30, z: 0}
- serializedVersion: 1
m_State: {fileID: 1002345273696687695}
m_Position: {x: 360, y: 150, 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_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -182899528967422495}
--- !u!1101 &-1580133079086915621
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: isRunning
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -182899528967422495}
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: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-182899528967422495
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ThugIdle
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 3947640424919397810}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: e77d4d0165ef8734ea3d1031f6cc1946, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ThugAnimator
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Xinfo
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: Yinfo
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: isRunning
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -6323065485593425674}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &1002345273696687695
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ThugTree
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -1580133079086915621}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -8586240220408617014}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &3947640424919397810
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: isRunning
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1002345273696687695}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View File

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

View File

@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: thugIdle
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

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

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: thugWalkDown
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: -6316236072753889025, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: -8067693199416062898, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: 6277737466426161926, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -6316236072753889025, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -8067693199416062898, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 6277737466426161926, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

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

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: thugWalkFront
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: -4721639515439479027, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: -5218287967814079876, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: -3519226670878887508, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -4721639515439479027, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -5218287967814079876, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: -3519226670878887508, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

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

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: thugWalkLeft
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 4309043406242248579, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: 8567144622364816611, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: 3157778096723770166, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 4309043406242248579, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 8567144622364816611, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 3157778096723770166, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

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

View File

@ -0,0 +1,74 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: thugWalkRight
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: -1280912182440070360, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.083333336
value: {fileID: 1971866478061622275, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- time: 0.16666667
value: {fileID: 1151615476209077989, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -1280912182440070360, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 1971866478061622275, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
- {fileID: 1151615476209077989, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

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

View File

@ -226306,6 +226306,67 @@ ParticleSystem:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
vectorLabel1_3: W vectorLabel1_3: W
--- !u!1001 &1734445872
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3079617781123838016, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_Name
value: GridManager
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_RootOrder
value: 17
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838031, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: tilemap
value:
objectReference: {fileID: 1280430028}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6b44df46620f48f41903e7858379f704, type: 3}
--- !u!1 &1736139909 --- !u!1 &1736139909
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -237404,6 +237465,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
mainCh: {fileID: 0} mainCh: {fileID: 0}
maxHealth: {fileID: 0}
--- !u!114 &1938355875 --- !u!114 &1938355875
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -289,9 +289,9 @@ GameObject:
- component: {fileID: 8620307} - component: {fileID: 8620307}
- component: {fileID: 8620306} - component: {fileID: 8620306}
- component: {fileID: 8620308} - component: {fileID: 8620308}
- component: {fileID: 8620310}
- component: {fileID: 8620309} - component: {fileID: 8620309}
- component: {fileID: 8620311} - component: {fileID: 8620311}
- component: {fileID: 8620312}
m_Layer: 0 m_Layer: 0
m_Name: Bat_1 m_Name: Bat_1
m_TagString: Enemy m_TagString: Enemy
@ -409,27 +409,6 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1.2, y: 0.8} m_Size: {x: 1.2, y: 0.8}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!50 &8620310
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8620305}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!114 &8620311 --- !u!114 &8620311
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -445,13 +424,14 @@ MonoBehaviour:
moveSpeed: 3 moveSpeed: 3
enemyName: bat1 enemyName: bat1
maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2}
health: 0 health: 1
baseAttack: 1 baseAttack: 1
path: path:
- {fileID: 652174080} - {fileID: 652174080}
- {fileID: 59883996} - {fileID: 59883996}
currentPoint: 0 currentPoint: 0
currentGoal: {fileID: 0} currentGoal: {fileID: 0}
agent: {fileID: 8620312}
target: {fileID: 0} target: {fileID: 0}
chaseRadius: 6 chaseRadius: 6
attackRadius: 0.55 attackRadius: 0.55
@ -467,6 +447,26 @@ MonoBehaviour:
isKilled: 0 isKilled: 0
isKilled2: 0 isKilled2: 0
expValue: 5 expValue: 5
--- !u!114 &8620312
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8620305}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d622984048644f87804ad1a3f20aa23a, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 1
currentPosition:
GCost: 0
hCost: 0
walkable: 0
worldPosition: {x: 0, y: 0, z: 0}
gridPosition: {x: 0, y: 0}
path: []
--- !u!1 &23852502 --- !u!1 &23852502
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -692,10 +692,10 @@ GameObject:
- component: {fileID: 68076401} - component: {fileID: 68076401}
- component: {fileID: 68076402} - component: {fileID: 68076402}
- component: {fileID: 68076406} - component: {fileID: 68076406}
- component: {fileID: 68076405}
- component: {fileID: 68076404} - component: {fileID: 68076404}
- component: {fileID: 68076403} - component: {fileID: 68076403}
- component: {fileID: 68076407} - component: {fileID: 68076407}
- component: {fileID: 68076408}
m_Layer: 0 m_Layer: 0
m_Name: Skeleton_0 m_Name: Skeleton_0
m_TagString: Enemy m_TagString: Enemy
@ -711,7 +711,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 68076400} m_GameObject: {fileID: 68076400}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 45.84, y: 46.05, z: 10} m_LocalPosition: {x: 45.84, y: 46.12, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 184660453} m_Father: {fileID: 184660453}
@ -812,27 +812,6 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!50 &68076405
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 68076400}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!61 &68076406 --- !u!61 &68076406
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -877,7 +856,7 @@ MonoBehaviour:
health: 0 health: 0
baseAttack: 2 baseAttack: 2
target: {fileID: 0} target: {fileID: 0}
chaseRadius: 5 chaseRadius: 9.99
attackRadius: 0.5 attackRadius: 0.5
homePosition: {fileID: 1928316356} homePosition: {fileID: 1928316356}
speed: 0 speed: 0
@ -898,6 +877,27 @@ MonoBehaviour:
isKilled2: 0 isKilled2: 0
isPanelEnabled: 1 isPanelEnabled: 1
expValue: 20 expValue: 20
agent: {fileID: 68076408}
--- !u!114 &68076408
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 68076400}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d622984048644f87804ad1a3f20aa23a, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 1.2
currentPosition:
GCost: 0
hCost: 0
walkable: 0
worldPosition: {x: 0, y: 0, z: 0}
gridPosition: {x: 0, y: 0}
path: []
--- !u!1 &84519187 --- !u!1 &84519187
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1786,6 +1786,7 @@ GameObject:
- component: {fileID: 242009513} - component: {fileID: 242009513}
- component: {fileID: 242009516} - component: {fileID: 242009516}
- component: {fileID: 242009515} - component: {fileID: 242009515}
- component: {fileID: 242009517}
- component: {fileID: 242009514} - component: {fileID: 242009514}
m_Layer: 0 m_Layer: 0
m_Name: Bat_0 m_Name: Bat_0
@ -1893,13 +1894,14 @@ MonoBehaviour:
moveSpeed: 4 moveSpeed: 4
enemyName: bat0 enemyName: bat0
maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2}
health: 0 health: 1
baseAttack: 1 baseAttack: 1
path: path:
- {fileID: 1474164377} - {fileID: 1474164377}
- {fileID: 2105401425} - {fileID: 2105401425}
currentPoint: 0 currentPoint: 0
currentGoal: {fileID: 0} currentGoal: {fileID: 0}
agent: {fileID: 242009517}
target: {fileID: 0} target: {fileID: 0}
chaseRadius: 6 chaseRadius: 6
attackRadius: 0.55 attackRadius: 0.55
@ -1962,6 +1964,26 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 0.9375782, y: 0.6254711} m_Size: {x: 0.9375782, y: 0.6254711}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!114 &242009517
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 242009510}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d622984048644f87804ad1a3f20aa23a, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 0.5
currentPosition:
GCost: 0
hCost: 0
walkable: 0
worldPosition: {x: 0, y: 0, z: 0}
gridPosition: {x: 0, y: 0}
path: []
--- !u!1 &246924466 --- !u!1 &246924466
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -26054,8 +26076,8 @@ GameObject:
- component: {fileID: 641696207} - component: {fileID: 641696207}
- component: {fileID: 641696206} - component: {fileID: 641696206}
- component: {fileID: 641696205} - component: {fileID: 641696205}
- component: {fileID: 641696204}
- component: {fileID: 641696208} - component: {fileID: 641696208}
- component: {fileID: 641696203}
m_Layer: 0 m_Layer: 0
m_Name: Slime_0 m_Name: Slime_0
m_TagString: Enemy m_TagString: Enemy
@ -26077,27 +26099,26 @@ Transform:
m_Father: {fileID: 184660453} m_Father: {fileID: 184660453}
m_RootOrder: 7 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &641696204 --- !u!114 &641696203
Rigidbody2D: MonoBehaviour:
serializedVersion: 4
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 641696201} m_GameObject: {fileID: 641696201}
m_BodyType: 1 m_Enabled: 1
m_Simulated: 1 m_EditorHideFlags: 0
m_UseFullKinematicContacts: 0 m_Script: {fileID: 11500000, guid: d622984048644f87804ad1a3f20aa23a, type: 3}
m_UseAutoMass: 0 m_Name:
m_Mass: 1 m_EditorClassIdentifier:
m_LinearDrag: 0 speed: 2
m_AngularDrag: 0.05 currentPosition:
m_GravityScale: 1 GCost: 0
m_Material: {fileID: 0} hCost: 0
m_Interpolate: 0 walkable: 0
m_SleepingMode: 1 worldPosition: {x: 0, y: 0, z: 0}
m_CollisionDetection: 0 gridPosition: {x: 0, y: 0}
m_Constraints: 4 path: []
--- !u!61 &641696205 --- !u!61 &641696205
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -26206,7 +26227,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 88d05133b4682194e90a88b0f3c16b70, type: 3} m_Script: {fileID: 11500000, guid: 88d05133b4682194e90a88b0f3c16b70, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
moveSpeed: 2 moveSpeed: 1.5
enemyName: slime0 enemyName: slime0
maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2}
health: 0 health: 0
@ -26233,6 +26254,7 @@ MonoBehaviour:
isKilled2: 0 isKilled2: 0
isPanelEnabled: 1 isPanelEnabled: 1
expValue: 2 expValue: 2
agent: {fileID: 641696203}
--- !u!1 &652174079 --- !u!1 &652174079
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -26349,9 +26371,9 @@ GameObject:
- component: {fileID: 682072030} - component: {fileID: 682072030}
- component: {fileID: 682072035} - component: {fileID: 682072035}
- component: {fileID: 682072034} - component: {fileID: 682072034}
- component: {fileID: 682072033}
- component: {fileID: 682072032} - component: {fileID: 682072032}
- component: {fileID: 682072036} - component: {fileID: 682072036}
- component: {fileID: 682072031}
m_Layer: 0 m_Layer: 0
m_Name: Slime_1 m_Name: Slime_1
m_TagString: Enemy m_TagString: Enemy
@ -26373,6 +26395,26 @@ Transform:
m_Father: {fileID: 184660453} m_Father: {fileID: 184660453}
m_RootOrder: 9 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &682072031
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 682072029}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d622984048644f87804ad1a3f20aa23a, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 2
currentPosition:
GCost: 0
hCost: 0
walkable: 0
worldPosition: {x: 0, y: 0, z: 0}
gridPosition: {x: 0, y: 0}
path: []
--- !u!95 &682072032 --- !u!95 &682072032
Animator: Animator:
serializedVersion: 3 serializedVersion: 3
@ -26392,27 +26434,6 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!50 &682072033
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 682072029}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &682072034 --- !u!61 &682072034
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -26502,13 +26523,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 88d05133b4682194e90a88b0f3c16b70, type: 3} m_Script: {fileID: 11500000, guid: 88d05133b4682194e90a88b0f3c16b70, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
moveSpeed: 1.2 moveSpeed: 1.5
enemyName: slime1 enemyName: slime1
maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2}
health: 0 health: 0
baseAttack: 0.5 baseAttack: 0.5
target: {fileID: 0} target: {fileID: 0}
chaseRadius: 8 chaseRadius: 6
attackRadius: 0.5 attackRadius: 0.5
homePosition: {fileID: 1143151251} homePosition: {fileID: 1143151251}
speed: 0 speed: 0
@ -26529,6 +26550,7 @@ MonoBehaviour:
isKilled2: 0 isKilled2: 0
isPanelEnabled: 1 isPanelEnabled: 1
expValue: 2 expValue: 2
agent: {fileID: 682072031}
--- !u!1 &683424791 --- !u!1 &683424791
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -134581,3 +134603,64 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f284f94fc82ae2b48a2fed669d33ff24, type: 3} m_Script: {fileID: 11500000, guid: f284f94fc82ae2b48a2fed669d33ff24, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!1001 &3079617782338157703
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3079617781123838016, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_Name
value: GridManager
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_RootOrder
value: 23
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838031, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: tilemap
value:
objectReference: {fileID: 1644923233}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6b44df46620f48f41903e7858379f704, type: 3}

View File

@ -24083,6 +24083,67 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 498142310} m_GameObject: {fileID: 498142310}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1001 &501058413
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3079617781123838016, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_Name
value: GridManager
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_RootOrder
value: 12
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838030, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3079617781123838031, guid: 6b44df46620f48f41903e7858379f704, type: 3}
propertyPath: tilemap
value:
objectReference: {fileID: 123966189}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6b44df46620f48f41903e7858379f704, type: 3}
--- !u!1 &505800829 --- !u!1 &505800829
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -24453,6 +24514,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
mainCh: {fileID: 0} mainCh: {fileID: 0}
maxHealth: {fileID: 0}
--- !u!114 &579432195 --- !u!114 &579432195
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -95,7 +95,13 @@ public class FollowingEnemy : Enemy
anim.SetFloat("Yinfo", dir.y); anim.SetFloat("Yinfo", dir.y);
} }
} }
CheckDistance();
if (CheckDistance())
{
MoveCharacter();
}
//CheckDistance();
//StartCoroutine(Timer()); //StartCoroutine(Timer());
//Code below is for dealing damage to player //Code below is for dealing damage to player
@ -136,33 +142,44 @@ public class FollowingEnemy : Enemy
PlayerPrefs.SetInt(enemyName, isKilled); PlayerPrefs.SetInt(enemyName, isKilled);
} }
} }
private void FixedUpdate() private void FixedUpdate()
{ {
if (Physics2D.OverlapCircle(transform.position, chaseRadius, whatisplayer)) /*if (Physics2D.OverlapCircle(transform.position, chaseRadius, whatisplayer))
{ {
MoveCharacter(movement); MoveCharacter();
} }
if (Physics2D.OverlapCircle(transform.position, attackRadius, whatisplayer)) if (Physics2D.OverlapCircle(transform.position, attackRadius, whatisplayer))
{ {
rb.velocity = Vector2.zero; rb.velocity = Vector2.zero;
} }*/
} }
private void MoveCharacter(Vector2 dir) public AStarPathfindingAgent agent;
private void MoveCharacter()
{ {
rb.MovePosition((Vector2)transform.position + (dir * moveSpeed * Time.deltaTime)); StopAllCoroutines();
//rb.MovePosition((Vector2)transform.position + (dir * moveSpeed * Time.deltaTime));
agent.FindPath();
StartCoroutine(agent.FollowPath());
} }
void CheckDistance() bool CheckDistance()
{ {
if(Vector2.Distance(target.position, transform.position) <= chaseRadius && Vector2.Distance(target.position, transform.position) > attackRadius) if(Vector2.Distance(target.position, transform.position) <= chaseRadius && Vector2.Distance(target.position, transform.position) > attackRadius)
{ {
transform.position = Vector2.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime); //transform.position = Vector2.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime);
return true;
} }
return false;
} }
private void OnDrawGizmos()
{
Gizmos.color = Color.magenta;
Gizmos.DrawWireSphere(transform.position,chaseRadius);
}
void OnTriggerEnter2D(Collider2D collision) void OnTriggerEnter2D(Collider2D collision)
{ {
///For attacking player ///For attacking player

View File

@ -8,6 +8,8 @@ public class FollowingPatrollingEnemy : Enemy
public int currentPoint; public int currentPoint;
public Transform currentGoal; public Transform currentGoal;
public AStarPathfindingAgent agent;
public Transform target; public Transform target;
public float chaseRadius; public float chaseRadius;
public float attackRadius; public float attackRadius;
@ -41,6 +43,11 @@ public class FollowingPatrollingEnemy : Enemy
public float expValue; public float expValue;
void Awake()
{
//agent = GetComponent<AStarPathfindingAgent>();
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -100,7 +107,7 @@ public class FollowingPatrollingEnemy : Enemy
TakeDamage(1.0f); TakeDamage(1.0f);
hit = false; hit = false;
timerHit = 0f; timerHit = 0f;
TakeKnockback(); //TakeKnockback();
} }
} }
if (gameObject.active == false) if (gameObject.active == false)
@ -113,15 +120,23 @@ public class FollowingPatrollingEnemy : Enemy
void CheckDistance() void CheckDistance()
{ {
StopAllCoroutines();
if (Vector2.Distance(target.position, transform.position) <= chaseRadius && Vector2.Distance(target.position, transform.position) > attackRadius) if (Vector2.Distance(target.position, transform.position) <= chaseRadius && Vector2.Distance(target.position, transform.position) > attackRadius)
{ {
transform.position = Vector2.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime);
//Debug.Log(agent);
agent.FindPath();
//transform.position = Vector2.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime);
StartCoroutine(agent.FollowPath());
} }
else if (Vector2.Distance(target.position, transform.position) > chaseRadius) else if (Vector2.Distance(target.position, transform.position) > chaseRadius)
{ {
//Debug.Log(Vector2.Distance(transform.position, path[currentPoint].position)); //Debug.Log(Vector2.Distance(transform.position, path[currentPoint].position));
if (Vector2.Distance(transform.position, path[currentPoint].position) > roundingDistance) if (Vector2.Distance(transform.position, path[currentPoint].position) > roundingDistance)
{ {
StopAllCoroutines();
transform.position = Vector2.MoveTowards(transform.position, path[currentPoint].position, moveSpeed * Time.deltaTime); transform.position = Vector2.MoveTowards(transform.position, path[currentPoint].position, moveSpeed * Time.deltaTime);
} }
else else

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9d16fefbe632463bb4c40d4f9177d6f7
timeCreated: 1667773142

View File

@ -0,0 +1,84 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AStarPathfindingAgent : MonoBehaviour
{
public float speed = 0.5f;
private NodeMap Map;
private Pathfinding Pathfinder;
public Node currentPosition;
public List<Node> path;
// Start is called before the first frame update
private void Awake()
{
Map = FindObjectOfType<NodeMap>();
Pathfinder = FindObjectOfType<Pathfinding>();
}
void Start()
{
currentPosition = Map.NodeFromWorldPoint(new Vector2(transform.position.x, transform.position.y));
//Debug.Log("current world position:" + currentPosition.worldPosition + " current transform position:" + transform.position);
Map.TeleportTo(this.gameObject, currentPosition);
}
// Update is called once per frame
void Update()
{
}
public void FindPath()
{
Pathfinder.FindPath(transform.position,Pathfinder.Player.position, this);
}
public IEnumerator FollowPath()
{
int targetIndex = 0;
if (path == null || path.Count == 0)
{
yield break;
}
Vector3 currentWorldPosition;
Node currentWaypoint = path[targetIndex];
while (true)
{
currentWorldPosition = transform.position;
if (transform.position == currentWaypoint.worldPosition)
{
targetIndex++;
bool reachedPosition = targetIndex >= path.Count;
if (reachedPosition)
{
yield break;
}
currentWaypoint = path[targetIndex];
}
Vector3 current = transform.position;
Vector3 target = currentWaypoint.worldPosition;
transform.position = Vector3.MoveTowards(current, target, speed * Time.deltaTime);
yield return null;
}
}
public void OnDrawGizmos()
{
Gizmos.color = Color.red;
Gizmos.DrawCube(currentPosition.worldPosition, Vector3.one);
Gizmos.color = Color.black;
if (path == null) return;
foreach (var n in path)
{
Gizmos.DrawCube(n.worldPosition, Vector3.one);
}
}
}

View File

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

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Build.Content;
using UnityEngine;
[System.Serializable]
public class Node
{
public int GCost;
public int hCost;
public Node parent;
public bool walkable = false;
public int FCost
{
get
{
return GCost + hCost;
}
}
public Vector3 worldPosition;
public Vector2Int gridPosition;
public Node(Vector2Int _gridPosition, Vector3 _worldPosition)
{
worldPosition = _worldPosition;
gridPosition = _gridPosition;
}
}

View File

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

View File

@ -0,0 +1,144 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Tilemaps;
public class NodeMap : MonoBehaviour
{
public Vector2Int mapSize;
public Node[,] nodeGrid = new Node[0,0];
public float cellSize;
public TileData[] TileDatas;
public Dictionary<TileBase, TileData> DataFromTiles = new Dictionary<TileBase, TileData>();
public Tilemap tilemap;
// Start is called before the first frame update
void Awake()
{
DataFromTiles = new Dictionary<TileBase, TileData>();
foreach (var tileData in TileDatas)
{
foreach (var tile in tileData.Tiles)
{
DataFromTiles.Add(tile, tileData);
}
}
CreateNodes();
TileCheck();
}
public void TileCheck()
{
foreach (var n in nodeGrid)
{
Vector2Int gridPosition = n.gridPosition;
Vector3Int TileGridPosition = tilemap.WorldToCell(n.worldPosition);
TileBase Tile = tilemap.GetTile(TileGridPosition);
if (Tile == null) continue;
if (!DataFromTiles.ContainsKey(Tile))
{
continue;
}
n.walkable = DataFromTiles[Tile].walkable;
}
}
// Update is called once per frame
void Update()
{
}
public void TeleportTo(GameObject g, Node node)
{
g.transform.position = node.worldPosition;
}
public List<Node> GetNeighbours(Node node)
{
List<Node> neighbours = new List<Node>();
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
if (x == 0 && y == 0)
continue;
int checkX = node.gridPosition.x + x;
int checkY = node.gridPosition.y + y;
if (checkX >= 0 && checkX < mapSize.x && checkY >= 0 && checkY < mapSize.y)
{
Node item = nodeGrid[checkX, checkY];
neighbours.Add(item);
}
}
}
return neighbours;
}
public void CreateNodes()
{
nodeGrid = new Node[mapSize.x, mapSize.y];
for (int x = 0; x < nodeGrid.GetLength(0); x++)
{
for (int y = 0; y < nodeGrid.GetLength(1); y++)
{
Vector2Int gridPosition = new Vector2Int(x, y);
nodeGrid[x, y] = new Node(gridPosition, GetWorldPosition(gridPosition));
Vector3Int TileGridPosition = tilemap.WorldToCell(nodeGrid[x,y].worldPosition);
TileBase Tile = tilemap.GetTile(TileGridPosition);
//nodeGrid[x, y].walkable = DataFromTiles[Tile].walkable;
}
}
}
public Node NodeFromWorldPoint(Vector2 worldPosition)
{
float percentX = (worldPosition.x + mapSize.x / 2) / mapSize.x;
float percentY = (worldPosition.y + mapSize.y / 2) / mapSize.y;
percentX = Mathf.Clamp01(percentX);
percentY = Mathf.Clamp01(percentY);
int x = Mathf.RoundToInt((mapSize.x - 1) * percentX);
int y = Mathf.RoundToInt((mapSize.y - 1) * percentY);
return nodeGrid[x, y];
}
public Vector3 GetWorldPosition(Vector2Int position)
{
Vector3 worldBottomLeft = transform.position - (Vector3.right * mapSize.x / 2) - (Vector3.up * (mapSize.y/ 2));
Vector3 worldPoint = worldBottomLeft + (Vector3.right * position.x) + (Vector3.up * position.y);
Vector3 cellSizeOffset = new Vector3(cellSize / 2, cellSize / 2, 0);
return worldPoint * cellSize + cellSizeOffset;
}
public bool showIndividualNodes;
public void OnDrawGizmos()
{
Gizmos.DrawWireCube(transform.position,new Vector3(mapSize.x,mapSize.y,1) * cellSize);
if (!showIndividualNodes)
{
return;
}
foreach (var n in nodeGrid)
{
Vector3 size = Vector3.one * cellSize;
Gizmos.DrawWireCube(n.worldPosition, size);
}
}
}

View File

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

View File

@ -0,0 +1,88 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pathfinding : MonoBehaviour
{
public Transform Player;
public NodeMap Map;
// Start is called before the first frame update
void Start()
{
Player = FindObjectOfType<Player>().transform;
}
// Update is called once per frame
void Update()
{
}
public void FindPath(Vector3 startPos, Vector3 targetPos, AStarPathfindingAgent _agent) {
Node startNode = Map.NodeFromWorldPoint(startPos);
Node targetNode = Map.NodeFromWorldPoint(targetPos);
List<Node> openSet = new List<Node>();
HashSet<Node> closedSet = new HashSet<Node>();
openSet.Add(startNode);
while (openSet.Count > 0) {
Node node = openSet[0];
for (int i = 1; i < openSet.Count; i ++) {
if (openSet[i].FCost < node.FCost || openSet[i].FCost == node.FCost) {
if (openSet[i].hCost < node.hCost)
node = openSet[i];
}
}
openSet.Remove(node);
closedSet.Add(node);
if (node == targetNode) {
RetracePath(startNode, targetNode, _agent);
return;
}
foreach (Node neighbour in Map.GetNeighbours(node)) {
if (!neighbour.walkable || closedSet.Contains(neighbour)) {
continue;
}
int newCostToNeighbour = node.GCost + GetDistance(node, neighbour);
if (newCostToNeighbour < neighbour.GCost || !openSet.Contains(neighbour)) {
neighbour.GCost = newCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = node;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
}
}
}
}
int GetDistance(Node nodeA, Node nodeB) {
int dstX = Mathf.Abs(nodeA.gridPosition.x - nodeB.gridPosition.x);
int dstY = Mathf.Abs(nodeA.gridPosition.y - nodeB.gridPosition.y);
if (dstX > dstY)
return 14*dstY + 10* (dstX-dstY);
return 14*dstX + 10 * (dstY-dstX);
}
void RetracePath(Node startNode, Node endNode, AStarPathfindingAgent agent) {
List<Node> path = new List<Node>();
Node currentNode = endNode;
while (currentNode != startNode) {
path.Add(currentNode);
currentNode = currentNode.parent;
}
path.Reverse();
//Debug.Log("I am retracing the path");
agent.path = path;
}
}

View File

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

View File

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
[CreateAssetMenu]
public class TileData : ScriptableObject
{
public TileBase[] Tiles;
public bool walkable;
}

View File

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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 80f0611867a83324c98c57b22ed7b274
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
%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: 9890013e3eb0ea54b90ab8d093688ac6, type: 3}
m_Name: Ground
m_EditorClassIdentifier:
Tiles:
- {fileID: 11400000, guid: c356c8564d98e7d4da396830a28289f7, type: 2}
- {fileID: 11400000, guid: 5b70fbf89fe74ba4899b6d05830a8340, type: 2}
- {fileID: 11400000, guid: 0d3a48c667a39654ba5ef0c86e53bb1d, type: 2}
- {fileID: 11400000, guid: 63fde8bc69e9ec549ac1481ddde6a52f, type: 2}
- {fileID: 11400000, guid: 83fc998975104da4380b8e609392dc0a, type: 2}
- {fileID: 11400000, guid: 12b1acac64313f74aafb538f3c18b705, type: 2}
- {fileID: 11400000, guid: bb360b67722585b4b9a15ab0cbff3cae, type: 2}
- {fileID: 11400000, guid: 870af010f2a7d464d8b9d826d6658662, type: 2}
- {fileID: 11400000, guid: 40a123aa7d753274b92441b3f9069cf3, type: 2}
- {fileID: 11400000, guid: 4dd99e02b286cf1498b94c707bebf696, type: 2}
- {fileID: 11400000, guid: 92c16677888e99b4ea8ac96cd40e31e3, type: 2}
- {fileID: 11400000, guid: e085061ffd4854b469ce233ad8205491, type: 2}
- {fileID: 11400000, guid: 6533141eeb4742146b7069a953c24646, type: 2}
- {fileID: 11400000, guid: a7c746962c470d046a661e5aa67e370a, type: 2}
- {fileID: 11400000, guid: ec8aa2d47c898f84c9cfe58a1386f277, type: 2}
- {fileID: 11400000, guid: 4521f3077dadf48439b0b3b4f964a968, type: 2}
- {fileID: 11400000, guid: f46af8991a2a97b4f97f1c170a5fc11a, type: 2}
walkable: 1

View File

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

View File

@ -0,0 +1,68 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugIdleDown
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 5970410323577050059, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 5970410323577050059, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.083333336
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5766c4d8a8d409242851cf9be801ef7e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugIdleLeft
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 475361983993561210, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 475361983993561210, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.083333336
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7664525aa3a759646adf08465dfbbc16
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugIdleRight
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 7639942379048000754, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 7639942379048000754, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.083333336
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 13b78ec291fa07f4d937de40ec122acc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BossThugIdleUp
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: -4449130184925231056, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -4449130184925231056, guid: 784e15dc3223c6342bbbc79cb202ad71, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.083333336
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1026f6b01b7e14c45b8ea2e9fc0e69de
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
([{〔〈《「『【〘〖〝‘“⦅«$—…‥〳〴〵\{£¥"々〇$¥₩ # ([{〔〈《「『【〘〖〝‘“⦅«$—…‥〳〴〵\{£¥"々〇〉》」¥₩ #

View File

@ -25,7 +25,6 @@ Material:
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_Floats: m_Floats:
- _ColorMask: 15 - _ColorMask: 15
- _CullMode: 0
- _Stencil: 0 - _Stencil: 0
- _StencilComp: 8 - _StencilComp: 8
- _StencilOp: 0 - _StencilOp: 0
@ -51,26 +50,6 @@ MonoBehaviour:
material: {fileID: 2103686} material: {fileID: 2103686}
materialHashCode: 0 materialHashCode: 0
m_Version: 1.1.0 m_Version: 1.1.0
m_FaceInfo:
m_FamilyName:
m_StyleName:
m_PointSize: 0
m_Scale: 0
m_LineHeight: 0
m_AscentLine: 0
m_CapLine: 0
m_MeanLine: 0
m_Baseline: 0
m_DescentLine: 0
m_SuperscriptOffset: 0
m_SuperscriptSize: 0
m_SubscriptOffset: 0
m_SubscriptSize: 0
m_UnderlineOffset: 0
m_UnderlineThickness: 0
m_StrikethroughOffset: 0
m_StrikethroughThickness: 0
m_TabWidth: 0
spriteSheet: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3} spriteSheet: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3}
m_SpriteCharacterTable: m_SpriteCharacterTable:
- m_ElementType: 2 - m_ElementType: 2
@ -146,11 +125,11 @@ MonoBehaviour:
m_Name: 1f609 m_Name: 1f609
m_HashCode: 57188264 m_HashCode: 57188264
- m_ElementType: 2 - m_ElementType: 2
m_Unicode: 0 m_Unicode: 128536
m_GlyphIndex: 12 m_GlyphIndex: 12
m_Scale: 1 m_Scale: 1
m_Name: .notdef m_Name: 1f618
m_HashCode: -600915428 m_HashCode: 57188168
- m_ElementType: 2 - m_ElementType: 2
m_Unicode: 129315 m_Unicode: 129315
m_GlyphIndex: 13 m_GlyphIndex: 13

View File

@ -20,7 +20,7 @@ MonoBehaviour:
m_EnableRaycastTarget: 1 m_EnableRaycastTarget: 1
m_GetFontFeaturesAtRuntime: 1 m_GetFontFeaturesAtRuntime: 1
m_missingGlyphCharacter: 0 m_missingGlyphCharacter: 0
m_warningsDisabled: 0 m_warningsDisabled: 1
m_defaultFontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_defaultFontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_defaultFontAssetPath: Fonts & Materials/ m_defaultFontAssetPath: Fonts & Materials/
m_defaultFontSize: 36 m_defaultFontSize: 36
@ -34,13 +34,10 @@ MonoBehaviour:
m_defaultSpriteAsset: {fileID: 11400000, guid: c41005c129ba4d66911b75229fd70b45, m_defaultSpriteAsset: {fileID: 11400000, guid: c41005c129ba4d66911b75229fd70b45,
type: 2} type: 2}
m_defaultSpriteAssetPath: Sprite Assets/ m_defaultSpriteAssetPath: Sprite Assets/
m_enableEmojiSupport: 1
m_MissingCharacterSpriteUnicode: 0
m_defaultColorGradientPresetsPath: Color Gradient Presets/ m_defaultColorGradientPresetsPath: Color Gradient Presets/
m_enableEmojiSupport: 1
m_defaultStyleSheet: {fileID: 11400000, guid: f952c082cb03451daed3ee968ac6c63e, m_defaultStyleSheet: {fileID: 11400000, guid: f952c082cb03451daed3ee968ac6c63e,
type: 2} type: 2}
m_StyleSheetsResourcePath:
m_leadingCharacters: {fileID: 4900000, guid: d82c1b31c7e74239bff1220585707d2b, type: 3} m_leadingCharacters: {fileID: 4900000, guid: d82c1b31c7e74239bff1220585707d2b, type: 3}
m_followingCharacters: {fileID: 4900000, guid: fade42e8bc714b018fac513c043d323b, m_followingCharacters: {fileID: 4900000, guid: fade42e8bc714b018fac513c043d323b,
type: 3} type: 3}
m_UseModernHangulLineBreakingRules: 0

View File

@ -3,7 +3,7 @@ Shader "TextMeshPro/Bitmap Custom Atlas" {
Properties { Properties {
_MainTex ("Font Atlas", 2D) = "white" {} _MainTex ("Font Atlas", 2D) = "white" {}
_FaceTex ("Font Texture", 2D) = "white" {} _FaceTex ("Font Texture", 2D) = "white" {}
[HDR]_FaceColor ("Text Color", Color) = (1,1,1,1) _FaceColor ("Text Color", Color) = (1,1,1,1)
_VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0
@ -19,14 +19,13 @@ Properties {
_StencilWriteMask("Stencil Write Mask", Float) = 255 _StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255 _StencilReadMask("Stencil Read Mask", Float) = 255
_CullMode("Cull Mode", Float) = 0
_ColorMask("Color Mask", Float) = 15 _ColorMask("Color Mask", Float) = 15
} }
SubShader{ SubShader{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
Stencil Stencil
{ {
Ref[_Stencil] Ref[_Stencil]
@ -35,8 +34,8 @@ SubShader{
ReadMask[_StencilReadMask] ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask] WriteMask[_StencilWriteMask]
} }
Lighting Off Lighting Off
Cull [_CullMode] Cull [_CullMode]
ZTest [unity_GUIZTestMode] ZTest [unity_GUIZTestMode]
@ -115,7 +114,7 @@ SubShader{
// Clamp _ClipRect to 16bit. // Clamp _ClipRect to 16bit.
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy));
return OUT; return OUT;
} }

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 48bb5f55d8670e349b6e614913f9d910 guid: 48bb5f55d8670e349b6e614913f9d910
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -2,7 +2,7 @@ Shader "TextMeshPro/Mobile/Bitmap" {
Properties { Properties {
_MainTex ("Font Atlas", 2D) = "white" {} _MainTex ("Font Atlas", 2D) = "white" {}
[HDR]_Color ("Text Color", Color) = (1,1,1,1) _Color ("Text Color", Color) = (1,1,1,1)
_DiffusePower ("Diffuse Power", Range(1.0,4.0)) = 1.0 _DiffusePower ("Diffuse Power", Range(1.0,4.0)) = 1.0
_VertexOffsetX("Vertex OffsetX", float) = 0 _VertexOffsetX("Vertex OffsetX", float) = 0
@ -18,7 +18,6 @@ Properties {
_StencilWriteMask("Stencil Write Mask", Float) = 255 _StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255 _StencilReadMask("Stencil Read Mask", Float) = 255
_CullMode("Cull Mode", Float) = 0
_ColorMask("Color Mask", Float) = 15 _ColorMask("Color Mask", Float) = 15
} }
@ -37,7 +36,7 @@ SubShader {
Lighting Off Lighting Off
Cull [_CullMode] Cull Off
ZTest [unity_GUIZTestMode] ZTest [unity_GUIZTestMode]
ZWrite Off ZWrite Off
Fog { Mode Off } Fog { Mode Off }
@ -114,11 +113,11 @@ SubShader {
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
color *= m.x * m.y; color *= m.x * m.y;
#endif #endif
#if UNITY_UI_ALPHACLIP #if UNITY_UI_ALPHACLIP
clip(color.a - 0.001); clip(color.a - 0.001);
#endif #endif
return color; return color;
} }
ENDCG ENDCG

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1e3b057af24249748ff873be7fafee47 guid: 1e3b057af24249748ff873be7fafee47
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -3,7 +3,7 @@ Shader "TextMeshPro/Bitmap" {
Properties { Properties {
_MainTex ("Font Atlas", 2D) = "white" {} _MainTex ("Font Atlas", 2D) = "white" {}
_FaceTex ("Font Texture", 2D) = "white" {} _FaceTex ("Font Texture", 2D) = "white" {}
[HDR]_FaceColor ("Text Color", Color) = (1,1,1,1) _FaceColor ("Text Color", Color) = (1,1,1,1)
_VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0
@ -18,14 +18,13 @@ Properties {
_StencilWriteMask("Stencil Write Mask", Float) = 255 _StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255 _StencilReadMask("Stencil Read Mask", Float) = 255
_CullMode("Cull Mode", Float) = 0
_ColorMask("Color Mask", Float) = 15 _ColorMask("Color Mask", Float) = 15
} }
SubShader{ SubShader{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
Stencil Stencil
{ {
Ref[_Stencil] Ref[_Stencil]
@ -34,8 +33,8 @@ SubShader{
ReadMask[_StencilReadMask] ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask] WriteMask[_StencilWriteMask]
} }
Lighting Off Lighting Off
Cull [_CullMode] Cull [_CullMode]
ZTest [unity_GUIZTestMode] ZTest [unity_GUIZTestMode]
@ -114,7 +113,7 @@ SubShader{
// Clamp _ClipRect to 16bit. // Clamp _ClipRect to 16bit.
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy));
return OUT; return OUT;
} }

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 128e987d567d4e2c824d754223b3f3b0 guid: 128e987d567d4e2c824d754223b3f3b0
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -4,10 +4,10 @@ Properties {
_FaceTex ("Face Texture", 2D) = "white" {} _FaceTex ("Face Texture", 2D) = "white" {}
_FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0
_FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0
[HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) _FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineTex ("Outline Texture", 2D) = "white" {} _OutlineTex ("Outline Texture", 2D) = "white" {}
_OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0
_OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0
@ -21,7 +21,7 @@ Properties {
_BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0
_LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416
[HDR]_SpecularColor ("Specular", Color) = (1,1,1,1) _SpecularColor ("Specular", Color) = (1,1,1,1)
_SpecularPower ("Specular", Range(0,4)) = 2.0 _SpecularPower ("Specular", Range(0,4)) = 2.0
_Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10
_Diffuse ("Diffuse", Range(0,1)) = 0.5 _Diffuse ("Diffuse", Range(0,1)) = 0.5
@ -35,15 +35,15 @@ Properties {
_ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1)
_Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ }
_EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0)
_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
[HDR]_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
_UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
_UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
_UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
_UnderlaySoftness ("Border Softness", Range(0,1)) = 0 _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
[HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) _GlowColor ("Color", Color) = (0, 1, 0, 0.5)
_GlowOffset ("Offset", Range(-1,1)) = 0 _GlowOffset ("Offset", Range(-1,1)) = 0
_GlowInner ("Inner", Range(0,1)) = 0.05 _GlowInner ("Inner", Range(0,1)) = 0.05
_GlowOuter ("Outer", Range(0,1)) = 0.05 _GlowOuter ("Outer", Range(0,1)) = 0.05
@ -68,7 +68,7 @@ Properties {
_VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0
_MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767)
_ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
_MaskSoftnessX ("Mask SoftnessX", float) = 0 _MaskSoftnessX ("Mask SoftnessX", float) = 0
@ -80,7 +80,6 @@ Properties {
_StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255
_CullMode ("Cull Mode", Float) = 0
_ColorMask ("Color Mask", Float) = 15 _ColorMask ("Color Mask", Float) = 15
} }
@ -97,7 +96,7 @@ SubShader {
{ {
Ref [_Stencil] Ref [_Stencil]
Comp [_StencilComp] Comp [_StencilComp]
Pass [_StencilOp] Pass [_StencilOp]
ReadMask [_StencilReadMask] ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask] WriteMask [_StencilWriteMask]
} }
@ -146,7 +145,7 @@ SubShader {
float4 param : TEXCOORD1; // alphaClip, scale, bias, weight float4 param : TEXCOORD1; // alphaClip, scale, bias, weight
float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw)
float3 viewDir : TEXCOORD3; float3 viewDir : TEXCOORD3;
#if (UNDERLAY_ON || UNDERLAY_INNER) #if (UNDERLAY_ON || UNDERLAY_INNER)
float4 texcoord2 : TEXCOORD4; // u,v, scale, bias float4 texcoord2 : TEXCOORD4; // u,v, scale, bias
fixed4 underlayColor : COLOR1; fixed4 underlayColor : COLOR1;
@ -187,7 +186,7 @@ SubShader {
float bias =(.5 - weight) + (.5 / scale); float bias =(.5 - weight) + (.5 / scale);
float alphaClip = (1.0 - _OutlineWidth*_ScaleRatioA - _OutlineSoftness*_ScaleRatioA); float alphaClip = (1.0 - _OutlineWidth*_ScaleRatioA - _OutlineSoftness*_ScaleRatioA);
#if GLOW_ON #if GLOW_ON
alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB);
#endif #endif
@ -216,7 +215,7 @@ SubShader {
float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex);
float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex);
output.position = vPosition; output.position = vPosition;
output.color = input.color; output.color = input.color;
output.atlas = input.texcoord0; output.atlas = input.texcoord0;
@ -238,7 +237,7 @@ SubShader {
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
float c = tex2D(_MainTex, input.atlas).a; float c = tex2D(_MainTex, input.atlas).a;
#ifndef UNDERLAY_ON #ifndef UNDERLAY_ON
clip(c - input.param.x); clip(c - input.param.x);
#endif #endif
@ -255,7 +254,7 @@ SubShader {
half4 outlineColor = _OutlineColor; half4 outlineColor = _OutlineColor;
faceColor.rgb *= input.color.rgb; faceColor.rgb *= input.color.rgb;
faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y);
outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y);
@ -304,7 +303,7 @@ SubShader {
#if UNITY_UI_ALPHACLIP #if UNITY_UI_ALPHACLIP
clip(faceColor.a - 0.001); clip(faceColor.a - 0.001);
#endif #endif
return faceColor * input.color.a; return faceColor * input.color.a;
} }

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dd89cf5b9246416f84610a006f916af7 guid: dd89cf5b9246416f84610a006f916af7
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,4 +1,4 @@
// Simplified SDF shader: // Simplified SDF shader:
// - No Shading Option (bevel / bump / env map) // - No Shading Option (bevel / bump / env map)
// - No Glow Option // - No Glow Option
// - Softness is applied on both side of the outline // - Softness is applied on both side of the outline
@ -6,14 +6,14 @@
Shader "TextMeshPro/Mobile/Distance Field - Masking" { Shader "TextMeshPro/Mobile/Distance Field - Masking" {
Properties { Properties {
[HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) _FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineWidth ("Outline Thickness", Range(0,1)) = 0 _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
_OutlineSoftness ("Outline Softness", Range(0,1)) = 0 _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
[HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) _UnderlayColor ("Border Color", Color) = (0,0,0,.5)
_UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
_UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
_UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
@ -47,19 +47,18 @@ Properties {
_MaskEdgeColor ("Edge Color", Color) = (1,1,1,1) _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1)
_MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01 _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01
_MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5 _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5
_StencilComp ("Stencil Comparison", Float) = 8 _StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0 _Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255
_CullMode ("Cull Mode", Float) = 0
_ColorMask ("Color Mask", Float) = 15 _ColorMask ("Color Mask", Float) = 15
} }
SubShader { SubShader {
Tags Tags
{ {
"Queue"="Transparent" "Queue"="Transparent"
"IgnoreProjector"="True" "IgnoreProjector"="True"
@ -71,7 +70,7 @@ SubShader {
{ {
Ref [_Stencil] Ref [_Stencil]
Comp [_StencilComp] Comp [_StencilComp]
Pass [_StencilOp] Pass [_StencilOp]
ReadMask [_StencilReadMask] ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask] WriteMask [_StencilWriteMask]
} }
@ -136,7 +135,7 @@ SubShader {
float2 pixelSize = vPosition.w; float2 pixelSize = vPosition.w;
pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
float scale = rsqrt(dot(pixelSize, pixelSize)); float scale = rsqrt(dot(pixelSize, pixelSize));
scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1);
if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
@ -218,10 +217,10 @@ SubShader {
#endif #endif
// Alternative implementation to UnityGet2DClipping with support for softness. // Alternative implementation to UnityGet2DClipping with support for softness.
//#if UNITY_UI_CLIP_RECT #if UNITY_UI_CLIP_RECT
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
c *= m.x * m.y; c *= m.x * m.y;
//#endif #endif
float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a); float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a);
float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl; float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl;

View File

@ -1,9 +1,9 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bc1ede39bf3643ee8e493720e4259791 guid: bc1ede39bf3643ee8e493720e4259791
timeCreated: 1463704911
licenseType: Pro
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -6,14 +6,14 @@
Shader "TextMeshPro/Mobile/Distance Field Overlay" { Shader "TextMeshPro/Mobile/Distance Field Overlay" {
Properties { Properties {
[HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) _FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineWidth ("Outline Thickness", Range(0,1)) = 0 _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
_OutlineSoftness ("Outline Softness", Range(0,1)) = 0 _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
[HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) _UnderlayColor ("Border Color", Color) = (0,0,0,.5)
_UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
_UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
_UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
@ -42,14 +42,13 @@ Properties {
_ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
_MaskSoftnessX ("Mask SoftnessX", float) = 0 _MaskSoftnessX ("Mask SoftnessX", float) = 0
_MaskSoftnessY ("Mask SoftnessY", float) = 0 _MaskSoftnessY ("Mask SoftnessY", float) = 0
_StencilComp ("Stencil Comparison", Float) = 8 _StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0 _Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255
_CullMode ("Cull Mode", Float) = 0
_ColorMask ("Color Mask", Float) = 15 _ColorMask ("Color Mask", Float) = 15
} }
@ -66,7 +65,7 @@ SubShader {
{ {
Ref [_Stencil] Ref [_Stencil]
Comp [_StencilComp] Comp [_StencilComp]
Pass [_StencilOp] Pass [_StencilOp]
ReadMask [_StencilReadMask] ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask] WriteMask [_StencilWriteMask]
} }
@ -126,7 +125,7 @@ SubShader {
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
float bold = step(input.texcoord1.y, 0); float bold = step(input.texcoord1.y, 0);
float4 vert = input.vertex; float4 vert = input.vertex;
@ -136,7 +135,7 @@ SubShader {
float2 pixelSize = vPosition.w; float2 pixelSize = vPosition.w;
pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
float scale = rsqrt(dot(pixelSize, pixelSize)); float scale = rsqrt(dot(pixelSize, pixelSize));
scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1);
if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
@ -196,7 +195,7 @@ SubShader {
fixed4 PixShader(pixel_t input) : SV_Target fixed4 PixShader(pixel_t input) : SV_Target
{ {
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x;
half4 c = input.faceColor * saturate(d - input.param.w); half4 c = input.faceColor * saturate(d - input.param.w);

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a02a7d8c237544f1962732b55a9aebf1 guid: a02a7d8c237544f1962732b55a9aebf1
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,4 +1,4 @@
// Simplified SDF shader: // Simplified SDF shader:
// - No Shading Option (bevel / bump / env map) // - No Shading Option (bevel / bump / env map)
// - No Glow Option // - No Glow Option
// - Softness is applied on both side of the outline // - Softness is applied on both side of the outline
@ -6,14 +6,14 @@
Shader "TextMeshPro/Mobile/Distance Field" { Shader "TextMeshPro/Mobile/Distance Field" {
Properties { Properties {
[HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) _FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineWidth ("Outline Thickness", Range(0,1)) = 0 _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
_OutlineSoftness ("Outline Softness", Range(0,1)) = 0 _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
[HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) _UnderlayColor ("Border Color", Color) = (0,0,0,.5)
_UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
_UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
_UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
@ -42,19 +42,18 @@ Properties {
_ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
_MaskSoftnessX ("Mask SoftnessX", float) = 0 _MaskSoftnessX ("Mask SoftnessX", float) = 0
_MaskSoftnessY ("Mask SoftnessY", float) = 0 _MaskSoftnessY ("Mask SoftnessY", float) = 0
_StencilComp ("Stencil Comparison", Float) = 8 _StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0 _Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255
_CullMode ("Cull Mode", Float) = 0
_ColorMask ("Color Mask", Float) = 15 _ColorMask ("Color Mask", Float) = 15
} }
SubShader { SubShader {
Tags Tags
{ {
"Queue"="Transparent" "Queue"="Transparent"
"IgnoreProjector"="True" "IgnoreProjector"="True"
@ -66,7 +65,7 @@ SubShader {
{ {
Ref [_Stencil] Ref [_Stencil]
Comp [_StencilComp] Comp [_StencilComp]
Pass [_StencilOp] Pass [_StencilOp]
ReadMask [_StencilReadMask] ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask] WriteMask [_StencilWriteMask]
} }
@ -126,7 +125,7 @@ SubShader {
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
float bold = step(input.texcoord1.y, 0); float bold = step(input.texcoord1.y, 0);
float4 vert = input.vertex; float4 vert = input.vertex;
@ -136,7 +135,7 @@ SubShader {
float2 pixelSize = vPosition.w; float2 pixelSize = vPosition.w;
pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
float scale = rsqrt(dot(pixelSize, pixelSize)); float scale = rsqrt(dot(pixelSize, pixelSize));
scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1);
if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
@ -196,7 +195,7 @@ SubShader {
fixed4 PixShader(pixel_t input) : SV_Target fixed4 PixShader(pixel_t input) : SV_Target
{ {
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x;
half4 c = input.faceColor * saturate(d - input.param.w); half4 c = input.faceColor * saturate(d - input.param.w);

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: fe393ace9b354375a9cb14cdbbc28be4 guid: fe393ace9b354375a9cb14cdbbc28be4
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -7,15 +7,15 @@ Shader "TextMeshPro/Mobile/Distance Field (Surface)" {
Properties { Properties {
_FaceTex ("Fill Texture", 2D) = "white" {} _FaceTex ("Fill Texture", 2D) = "white" {}
[HDR]_FaceColor ("Fill Color", Color) = (1,1,1,1) _FaceColor ("Fill Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineTex ("Outline Texture", 2D) = "white" {} _OutlineTex ("Outline Texture", 2D) = "white" {}
_OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0
_OutlineSoftness ("Outline Softness", Range(0,1)) = 0 _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
[HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) _GlowColor ("Color", Color) = (0, 1, 0, 0.5)
_GlowOffset ("Offset", Range(-1,1)) = 0 _GlowOffset ("Offset", Range(-1,1)) = 0
_GlowInner ("Inner", Range(0,1)) = 0.05 _GlowInner ("Inner", Range(0,1)) = 0.05
_GlowOuter ("Outer", Range(0,1)) = 0.05 _GlowOuter ("Outer", Range(0,1)) = 0.05
@ -41,8 +41,7 @@ Properties {
_VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0
_CullMode ("Cull Mode", Float) = 0
//_MaskCoord ("Mask Coords", vector) = (0,0,0,0) //_MaskCoord ("Mask Coords", vector) = (0,0,0,0)
//_MaskSoftness ("Mask Softness", float) = 0 //_MaskSoftness ("Mask Softness", float) = 0
} }
@ -76,7 +75,7 @@ SubShader {
float2 uv2_FaceTex; float2 uv2_FaceTex;
float2 uv2_OutlineTex; float2 uv2_OutlineTex;
float2 param; // Weight, Scale float2 param; // Weight, Scale
float3 viewDirEnv; float3 viewDirEnv;
}; };
#include "TMPro_Surface.cginc" #include "TMPro_Surface.cginc"

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 85187c2149c549c5b33f0cdb02836b17 guid: 85187c2149c549c5b33f0cdb02836b17
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -4,10 +4,10 @@ Properties {
_FaceTex ("Fill Texture", 2D) = "white" {} _FaceTex ("Fill Texture", 2D) = "white" {}
_FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0
_FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0
[HDR]_FaceColor ("Fill Color", Color) = (1,1,1,1) _FaceColor ("Fill Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineTex ("Outline Texture", 2D) = "white" {} _OutlineTex ("Outline Texture", 2D) = "white" {}
_OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0
_OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0
@ -24,16 +24,16 @@ Properties {
_BumpOutline ("Bump Outline", Range(0,1)) = 0.5 _BumpOutline ("Bump Outline", Range(0,1)) = 0.5
_BumpFace ("Bump Face", Range(0,1)) = 0.5 _BumpFace ("Bump Face", Range(0,1)) = 0.5
_ReflectFaceColor ("Face Color", Color) = (0,0,0,1) _ReflectFaceColor ("Face Color", Color) = (0,0,0,1)
_ReflectOutlineColor ("Outline Color", Color) = (0,0,0,1) _ReflectOutlineColor ("Outline Color", Color) = (0,0,0,1)
_Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ }
_EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0)
[HDR]_SpecColor ("Specular Color", Color) = (0,0,0,1) _SpecColor ("Specular Color", Color) = (0,0,0,1)
_FaceShininess ("Face Shininess", Range(0,1)) = 0 _FaceShininess ("Face Shininess", Range(0,1)) = 0
_OutlineShininess ("Outline Shininess", Range(0,1)) = 0 _OutlineShininess ("Outline Shininess", Range(0,1)) = 0
[HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) _GlowColor ("Color", Color) = (0, 1, 0, 0.5)
_GlowOffset ("Offset", Range(-1,1)) = 0 _GlowOffset ("Offset", Range(-1,1)) = 0
_GlowInner ("Inner", Range(0,1)) = 0.05 _GlowInner ("Inner", Range(0,1)) = 0.05
_GlowOuter ("Outer", Range(0,1)) = 0.05 _GlowOuter ("Outer", Range(0,1)) = 0.05
@ -59,15 +59,13 @@ Properties {
_VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0
_CullMode ("Cull Mode", Float) = 0
//_MaskCoord ("Mask Coords", vector) = (0,0,0,0) //_MaskCoord ("Mask Coords", vector) = (0,0,0,0)
//_MaskSoftness ("Mask Softness", float) = 0 //_MaskSoftness ("Mask Softness", float) = 0
} }
SubShader { SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 300 LOD 300
Cull [_CullMode] Cull [_CullMode]
@ -91,10 +89,10 @@ SubShader {
float2 uv2_FaceTex; float2 uv2_FaceTex;
float2 uv2_OutlineTex; float2 uv2_OutlineTex;
float2 param; // Weight, Scale float2 param; // Weight, Scale
float3 viewDirEnv; float3 viewDirEnv;
}; };
#define BEVEL_ON 1 #define BEVEL_ON 1
#include "TMPro_Surface.cginc" #include "TMPro_Surface.cginc"

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f7ada0af4f174f0694ca6a487b8f543d guid: f7ada0af4f174f0694ca6a487b8f543d
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -4,10 +4,10 @@ Properties {
_FaceTex ("Face Texture", 2D) = "white" {} _FaceTex ("Face Texture", 2D) = "white" {}
_FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0
_FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0
[HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) _FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0 _FaceDilate ("Face Dilate", Range(-1,1)) = 0
[HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineTex ("Outline Texture", 2D) = "white" {} _OutlineTex ("Outline Texture", 2D) = "white" {}
_OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0
_OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0
@ -21,7 +21,7 @@ Properties {
_BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0
_LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416
[HDR]_SpecularColor ("Specular", Color) = (1,1,1,1) _SpecularColor ("Specular", Color) = (1,1,1,1)
_SpecularPower ("Specular", Range(0,4)) = 2.0 _SpecularPower ("Specular", Range(0,4)) = 2.0
_Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10
_Diffuse ("Diffuse", Range(0,1)) = 0.5 _Diffuse ("Diffuse", Range(0,1)) = 0.5
@ -35,15 +35,15 @@ Properties {
_ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1)
_Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ }
_EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0)
_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
[HDR]_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
_UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
_UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
_UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
_UnderlaySoftness ("Border Softness", Range(0,1)) = 0 _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
[HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) _GlowColor ("Color", Color) = (0, 1, 0, 0.5)
_GlowOffset ("Offset", Range(-1,1)) = 0 _GlowOffset ("Offset", Range(-1,1)) = 0
_GlowInner ("Inner", Range(0,1)) = 0.05 _GlowInner ("Inner", Range(0,1)) = 0.05
_GlowOuter ("Outer", Range(0,1)) = 0.05 _GlowOuter ("Outer", Range(0,1)) = 0.05
@ -68,7 +68,7 @@ Properties {
_VertexOffsetX ("Vertex OffsetX", float) = 0 _VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0 _VertexOffsetY ("Vertex OffsetY", float) = 0
_MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767)
_ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
_MaskSoftnessX ("Mask SoftnessX", float) = 0 _MaskSoftnessX ("Mask SoftnessX", float) = 0
@ -80,7 +80,6 @@ Properties {
_StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255
_CullMode ("Cull Mode", Float) = 0
_ColorMask ("Color Mask", Float) = 15 _ColorMask ("Color Mask", Float) = 15
} }
@ -97,7 +96,7 @@ SubShader {
{ {
Ref [_Stencil] Ref [_Stencil]
Comp [_StencilComp] Comp [_StencilComp]
Pass [_StencilOp] Pass [_StencilOp]
ReadMask [_StencilReadMask] ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask] WriteMask [_StencilWriteMask]
} }
@ -146,7 +145,7 @@ SubShader {
float4 param : TEXCOORD1; // alphaClip, scale, bias, weight float4 param : TEXCOORD1; // alphaClip, scale, bias, weight
float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw)
float3 viewDir : TEXCOORD3; float3 viewDir : TEXCOORD3;
#if (UNDERLAY_ON || UNDERLAY_INNER) #if (UNDERLAY_ON || UNDERLAY_INNER)
float4 texcoord2 : TEXCOORD4; // u,v, scale, bias float4 texcoord2 : TEXCOORD4; // u,v, scale, bias
fixed4 underlayColor : COLOR1; fixed4 underlayColor : COLOR1;
@ -187,7 +186,7 @@ SubShader {
float bias =(.5 - weight) + (.5 / scale); float bias =(.5 - weight) + (.5 / scale);
float alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA); float alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA);
#if GLOW_ON #if GLOW_ON
alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB);
#endif #endif
@ -216,7 +215,7 @@ SubShader {
float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex);
float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex);
output.position = vPosition; output.position = vPosition;
output.color = input.color; output.color = input.color;
output.atlas = input.texcoord0; output.atlas = input.texcoord0;
@ -228,7 +227,7 @@ SubShader {
output.underlayColor = underlayColor; output.underlayColor = underlayColor;
#endif #endif
output.textures = float4(faceUV, outlineUV); output.textures = float4(faceUV, outlineUV);
return output; return output;
} }
@ -238,7 +237,7 @@ SubShader {
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
float c = tex2D(_MainTex, input.atlas).a; float c = tex2D(_MainTex, input.atlas).a;
#ifndef UNDERLAY_ON #ifndef UNDERLAY_ON
clip(c - input.param.x); clip(c - input.param.x);
#endif #endif
@ -255,7 +254,7 @@ SubShader {
half4 outlineColor = _OutlineColor; half4 outlineColor = _OutlineColor;
faceColor.rgb *= input.color.rgb; faceColor.rgb *= input.color.rgb;
faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y);
outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y);

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 68e6db2ebdc24f95958faec2be5558d6 guid: 68e6db2ebdc24f95958faec2be5558d6
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -2,7 +2,7 @@ Shader "TextMeshPro/Sprite"
{ {
Properties Properties
{ {
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1) _Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8 _StencilComp ("Stencil Comparison", Float) = 8
@ -10,8 +10,7 @@ Shader "TextMeshPro/Sprite"
_StencilOp ("Stencil Operation", Float) = 0 _StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255 _StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255 _StencilReadMask ("Stencil Read Mask", Float) = 255
_CullMode ("Cull Mode", Float) = 0
_ColorMask ("Color Mask", Float) = 15 _ColorMask ("Color Mask", Float) = 15
_ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
@ -38,7 +37,7 @@ Shader "TextMeshPro/Sprite"
WriteMask [_StencilWriteMask] WriteMask [_StencilWriteMask]
} }
Cull [_CullMode] Cull Off
Lighting Off Lighting Off
ZWrite Off ZWrite Off
ZTest [unity_GUIZTestMode] ZTest [unity_GUIZTestMode]
@ -47,60 +46,58 @@ Shader "TextMeshPro/Sprite"
Pass Pass
{ {
Name "Default"
CGPROGRAM CGPROGRAM
#pragma vertex vert #pragma vertex vert
#pragma fragment frag #pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc" #include "UnityCG.cginc"
#include "UnityUI.cginc" #include "UnityUI.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT #pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP #pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata_t struct appdata_t
{ {
float4 vertex : POSITION; float4 vertex : POSITION;
float4 color : COLOR; float4 color : COLOR;
float2 texcoord : TEXCOORD0; float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
}; };
struct v2f struct v2f
{ {
float4 vertex : SV_POSITION; float4 vertex : SV_POSITION;
fixed4 color : COLOR; fixed4 color : COLOR;
float2 texcoord : TEXCOORD0; half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1; float4 worldPosition : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
}; };
sampler2D _MainTex;
fixed4 _Color; fixed4 _Color;
fixed4 _TextureSampleAdd; fixed4 _TextureSampleAdd;
float4 _ClipRect; float4 _ClipRect;
float4 _MainTex_ST;
v2f vert(appdata_t v) v2f vert(appdata_t IN)
{ {
v2f OUT; v2f OUT;
UNITY_SETUP_INSTANCE_ID(v); OUT.worldPosition = IN.vertex;
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = v.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); OUT.texcoord = IN.texcoord;
OUT.color = v.color * _Color; #ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
OUT.color = IN.color * _Color;
return OUT; return OUT;
} }
sampler2D _MainTex;
fixed4 frag(v2f IN) : SV_Target fixed4 frag(v2f IN) : SV_Target
{ {
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
#ifdef UNITY_UI_CLIP_RECT #if UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif #endif

View File

@ -1,9 +1,9 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cf81c85f95fe47e1a27f6ae460cf182c guid: cf81c85f95fe47e1a27f6ae460cf182c
timeCreated: 1450517184
licenseType: Pro
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 407bc68d299748449bbf7f48ee690f8d guid: 407bc68d299748449bbf7f48ee690f8d
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3997e2241185407d80309a82f9148466 guid: 3997e2241185407d80309a82f9148466
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -25,6 +25,8 @@ void VertShader(inout appdata_full v, out Input data)
data.param.y = scale; data.param.y = scale;
#endif #endif
//float opacity = v.color.a;
data.param.x = (lerp(_WeightNormal, _WeightBold, bold) / 4.0 + _FaceDilate) * _ScaleRatioA * 0.5; // data.param.x = (lerp(_WeightNormal, _WeightBold, bold) / 4.0 + _FaceDilate) * _ScaleRatioA * 0.5; //
v.texcoord1.xy = UnpackUV(v.texcoord1.x); v.texcoord1.xy = UnpackUV(v.texcoord1.x);
@ -34,10 +36,26 @@ void VertShader(inout appdata_full v, out Input data)
void PixShader(Input input, inout SurfaceOutput o) void PixShader(Input input, inout SurfaceOutput o)
{ {
#if USE_DERIVATIVE | BEVEL_ON
float3 delta = float3(1.0 / _TextureWidth, 1.0 / _TextureHeight, 0.0);
float4 smp4x = { tex2D(_MainTex, input.uv_MainTex - delta.xz).a,
tex2D(_MainTex, input.uv_MainTex + delta.xz).a,
tex2D(_MainTex, input.uv_MainTex - delta.zy).a,
tex2D(_MainTex, input.uv_MainTex + delta.zy).a };
#endif
#if USE_DERIVATIVE #if USE_DERIVATIVE
float2 pixelSize = float2(ddx(input.uv_MainTex.y), ddy(input.uv_MainTex.y)); // Screen space scaling reciprocal with anisotropic correction
pixelSize *= _TextureWidth * .75; float2 edgeNormal = Normalize(float2(smp4x.x - smp4x.y, smp4x.z - smp4x.w));
float scale = rsqrt(dot(pixelSize, pixelSize)) * _GradientScale * (_Sharpness + 1); float2 res = float2(_TextureWidth * input.param.y, _TextureHeight);
float2 tdx = ddx(input.uv_MainTex)*res;
float2 tdy = ddy(input.uv_MainTex)*res;
float lx = length(tdx);
float ly = length(tdy);
float s = sqrt(min(lx, ly) / max(lx, ly));
s = lerp(1, s, abs(dot(normalize(tdx + tdy), edgeNormal)));
float scale = rsqrt(abs(tdx.x * tdy.y - tdx.y * tdy.x)) * (_GradientScale * 2) * s;
#else #else
float scale = input.param.y; float scale = input.param.y;
#endif #endif
@ -58,14 +76,8 @@ void PixShader(Input input, inout SurfaceOutput o)
faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
faceColor.rgb /= max(faceColor.a, 0.0001); faceColor.rgb /= max(faceColor.a, 0.0001);
#if BEVEL_ON #if BEVEL_ON
float3 delta = float3(1.0 / _TextureWidth, 1.0 / _TextureHeight, 0.0);
float4 smp4x = {tex2D(_MainTex, input.uv_MainTex - delta.xz).a,
tex2D(_MainTex, input.uv_MainTex + delta.xz).a,
tex2D(_MainTex, input.uv_MainTex - delta.zy).a,
tex2D(_MainTex, input.uv_MainTex + delta.zy).a };
// Face Normal // Face Normal
float3 n = GetSurfaceNormal(smp4x, input.param.x); float3 n = GetSurfaceNormal(smp4x, input.param.x);
@ -82,7 +94,9 @@ void PixShader(Input input, inout SurfaceOutput o)
float3 n = float3(0, 0, -1); float3 n = float3(0, 0, -1);
float3 emission = float3(0, 0, 0); float3 emission = float3(0, 0, 0);
#endif #endif
#if GLOW_ON #if GLOW_ON
float4 glowColor = GetGlowColor(sd, scale); float4 glowColor = GetGlowColor(sd, scale);
glowColor.a *= input.color.a; glowColor.a *= input.color.a;

View File

@ -1,9 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d930090c0cd643c7b55f19a38538c162 guid: d930090c0cd643c7b55f19a38538c162
ShaderImporter: ShaderImporter:
externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: []
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 72 KiB

10
Assets/_.meta Normal file
View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4ad70f11d566df74ea78e615ab4e6803
folderAsset: yes
timeCreated: 1526456054
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/_/Stuff.meta Normal file
View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5a1f5de3e19072249a9182176764c31e
folderAsset: yes
timeCreated: 1526278638
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 195b2f3b3faa2ff4fa4e89d879e79def
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,285 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using UnityEngine;
using System.Collections;
namespace GridPathfindingSystem {
public class BinaryTree {
private class BinaryNode {
//public static int nextId = 0;
//public int id;
public PathNode pathNode;
public BinaryNode left;
public BinaryNode right;
public BinaryNode(PathNode _pathNode, BinaryNode _left, BinaryNode _right) {
//id = nextId++;
pathNode = _pathNode;
left = _left;
right = _right;
}
/*public override string ToString() {
return "n_" + id;
}*/
}
private BinaryNode root;
public int totalNodes = 0;
//private string debugString;
//private string debugCodePath;
public BinaryTree() {
//BinaryNode.nextId = 0;
root = null;
//debugCodePath = "NEW: ";
}
public void AddNode(PathNode pathNode) {
//debugCodePath += "AD; ";
if (root == null) {
root = new BinaryNode(pathNode, null, null);
totalNodes++;
} else {
// Has root
//debugString = "";
try {
addNode(root, pathNode, pathNode.fValue);
} catch (System.Exception e) {
Debug.Log(e);
//Debug.LogError("Error: "+debugString);
//Debug.LogError(debugCodePath);
}
totalNodes++;
}
}
private void addNode(BinaryNode node, PathNode pathNode, int pathFvalue) {
//debugString += node.id + " " + ((node.left == null) ? "-1" : ""+node.left.id) + " " + (node.right == null ? "-1" : ""+node.right.id) + " ";
if (pathFvalue <= node.pathNode.fValue) {
// Left
if (node.left == null) {
// Become left
//debugString += " LEFT" + "; \n";
node.left = new BinaryNode(pathNode, null, null);
//debugCodePath += "AD" + node.left + "; ";
} else {
// Check left
//debugString += "L; \n";
//debugString += node.id + " " + (node == (node.left));
addNode(node.left, pathNode, pathFvalue);
}
} else {
// Right
if (node.right == null) {
// Become right
//debugString += " RIGHT" + "; \n";
node.right = new BinaryNode(pathNode, null, null);
//debugCodePath += "AD" + node.right + "; ";
} else {
// Check right
//debugString += node.id + " ";
//debugString += "R; \n";
addNode(node.right, pathNode, pathFvalue);
}
}
}
public void RemoveNode(PathNode pathNode) {
if (root.pathNode == pathNode) {
// It's the root
//debugCodePath += "RR" + root + "; ";
BinaryNode prevRoot = root;
if (root.left == null && root.right == null) {
// Both are null
root = null;
// Tree is dead
} else {
// Atleast one has something
if (root.left == null && root.right != null) {
// Has right but no left
root = root.right;
} else {
if (root.right == null && root.left != null) {
// Has left but no right
root = root.left;
} else {
// Has both right and left
if (root.left.right == null) {
// Root left has no right
root.left.right = root.right;
root = root.left;
} else {
// Root left has a right
BinaryNode leafRight = getLeafRight(root.left);
root = leafRight.right;
if (leafRight.right.left != null) {
// This leaf has a left
leafRight.right = leafRight.right.left;
}
leafRight.right = null;
root.left = leafRight;
root.right = prevRoot.right;
}
}
}
}
} else {
int pathFvalue = pathNode.fValue;
removeNode(root, pathNode, pathFvalue);
}
totalNodes--;
}
private void removeNode(BinaryNode node, PathNode pathNode, int pathFvalue) {
if (pathFvalue <= node.pathNode.fValue) {
// Check left
// Is it this left?
if (node.left != null) {
if (node.left.pathNode == pathNode) {
// It's this left one!
BinaryNode del = node.left;
//debugCodePath += "RNL" + del + "; ";
if (del.left == null && del.right == null) {
// Both are null
node.left = null;
} else {
// Atleast one has something
if (del.left == null && del.right != null) {
// Has right but no left
node.left = del.right;
} else {
if (del.right == null && del.left != null) {
// Has left but no right
node.left = del.left;
} else {
// Has both right and left
if (del.left.right == null) {
// Root left has no right
del.left.right = del.right;
node.left = del.left;
} else {
// Root left has a right
BinaryNode leafRight = getLeafRight(del.left);
node.left = leafRight.right;
if (leafRight.right.left != null) {
// This leaf has a left
leafRight.right = leafRight.right.left;
}
leafRight.right = null;
node.left.left = leafRight;
node.left.right = del.right;
}
}
}
}
} else {
// Not this left
// Check next one
removeNode(node.left, pathNode, pathFvalue);
}
}
} else {
// Check right
// Is it this right?
if (node.right != null) {
if (node.right.pathNode == pathNode) {
// It's this right one!
BinaryNode del = node.right;
//debugCodePath += "RNR" + del + "; ";
if (del.left == null && del.right == null) {
// Both are null
node.right = null;
} else {
// Atleast one has something
if (del.left == null && del.right != null) {
// Has right but no left
node.right = del.right;
} else {
if (del.right == null && del.left != null) {
// Has left but no right
node.right = del.left;
} else {
// Has both right and left
if (del.left.right == null) {
// Root left has no right
del.left.right = del.right;
node.right = del.left;
} else {
// Root left has a right
BinaryNode leafRight = getLeafRight(del.left);
node.right = leafRight.right;
if (leafRight.right.left != null) {
// This leaf has a left
leafRight.right = leafRight.right.left;
}
leafRight.right = null;
node.right.left = leafRight;
node.right.right = del.right;
}
}
}
}
} else {
// Not this right
// Check next one
removeNode(node.right, pathNode, pathFvalue);
}
}
}
}
private BinaryNode getLeafRight(BinaryNode node) {
if (node.right.right == null)
return node;
else
return getLeafRight(node.right);
}
public int getTotalHeight() {
return getHeight(root);
}
private int getHeight(BinaryNode node) {
if (node == null) return 0;
else {
return 1 + (int)Mathf.Max(getHeight(node.left), getHeight(node.right));
}
}
public PathNode GetSmallest() {
PathNode pathNode = null;
int count = 0;
try {
pathNode = getSmallest(root, ref count);
} catch {
Debug.LogError("GetSmallest: " + count);
}
return pathNode;
//return getSmallest(root, 0);
}
private PathNode getSmallest(BinaryNode node, ref int count) {
if (node == null) return null;
if (node.left != null) {
count++;
return getSmallest(node.left, ref count);
} else {
// No more left nodes
return node.pathNode;
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5021e6dce69bb414c9edbaf785dc6f64
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,673 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
namespace GridPathfindingSystem {
public class GridPathfinding {
public static GridPathfinding instance;
public const int WALL_WEIGHT = 56000;
public enum UnitMovementCallbackType {
Simple,
}
//private List<PathNode> openList;
private BinaryTree binaryTree;
private int openListCount;
private PathNode[][] mapNodes;
private int widthMax, heightMax;
private float nodeSize;
private Vector3 worldOrigin;
private bool foundTarget;
private int movementCost = 10;
private float timer;
public delegate void OnPathCallback(List<PathNode> path, MapPos finalPos);
public delegate void OnVoidDelegate();
public OnVoidDelegate callbacks;
public GridPathfinding(Vector3 worldLowerLeft, Vector3 worldUpperRight, float nodeSize) {
instance = this;
worldOrigin = worldLowerLeft;
this.nodeSize = nodeSize;
float worldWidth = worldUpperRight.x - worldLowerLeft.x;
float worldHeight = worldUpperRight.y - worldLowerLeft.y;
int mapWidth = Mathf.RoundToInt(worldWidth / nodeSize);
int mapHeight = Mathf.RoundToInt(worldHeight / nodeSize);
mapNodes = new PathNode[mapWidth][];
for (int i = 0; i < mapWidth; i++) {
mapNodes[i] = new PathNode[mapHeight];
}
widthMax = mapWidth;
heightMax = mapHeight;
Initialize(mapWidth, mapHeight);
}
public GridPathfinding(int mapWidth, int mapHeight, float nodeSize, Vector3 worldOrigin) {//, Texture2D map) {
this.nodeSize = nodeSize;
this.worldOrigin = worldOrigin;
mapNodes = new PathNode[mapWidth][];
for (int i = 0; i < mapWidth; i++) {
mapNodes[i] = new PathNode[mapHeight];
}
widthMax = mapWidth;
heightMax = mapHeight;
Initialize(mapWidth, mapHeight);
}
public void RaycastWalkable() {
for (int i = 0; i < widthMax; i++) {
for (int j = 0; j < heightMax; j++) {
Vector3 nodeWorldPosition = mapNodes[i][j].GetWorldVector(worldOrigin, nodeSize);
RaycastHit2D raycastHit = Physics2D.Raycast(nodeWorldPosition, Vector2.zero, 0f);
if (raycastHit.collider != null) {
mapNodes[i][j].SetWalkable(false);
}
}
}
}
public void ModifySize(int modifyX, int modifyY, int newPathNodeWeight) {
if (modifyX == 0 && modifyY == 0) {
return;
}
int newWidth = widthMax + modifyX;
int newHeight = heightMax + modifyY;
PathNode[][] newMapNodes = new PathNode[newWidth][];
for (int i = 0; i < newWidth; i++) {
newMapNodes[i] = new PathNode[newHeight];
for (int j = 0; j < newHeight; j++) {
if (i < mapNodes.Length && j < mapNodes[0].Length) {
newMapNodes[i][j] = mapNodes[i][j];
} else {
newMapNodes[i][j] = new PathNode(i, j);
newMapNodes[i][j].SetWeight(newPathNodeWeight);
}
}
}
widthMax = newWidth;
heightMax = newHeight;
mapNodes = newMapNodes;
UpdateNodeConnections();
//if (OnSizeModified != null) OnSizeModified(this, EventArgs.Empty);
}
public Vector3 GetWorldOffset() {
return worldOrigin;
}
public float GetNodeSize() {
return nodeSize;
}
public void SetWalkable(int x, int y, bool walkable) {
mapNodes[x][y].SetWalkable(walkable);
}
public void SetAllWalkable(bool walkable) {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
mapNodes[x][y].SetWalkable(walkable);
}
}
}
public void SetWeight(int x, int y, int weight) {
mapNodes[x][y].SetWeight(weight);
}
public void SetAllWeight(int weight) {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
mapNodes[x][y].SetWeight(weight);
}
}
}
public int GetMapWidth() {
return widthMax;
}
public int GetMapHeight() {
return heightMax;
}
public void Initialize(int mapWidth, int mapHeight) {
// Creates PathNodes
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
mapNodes[x][y] = new PathNode(x, y);
}
}
UpdateNodeConnections();
}
private void UpdateNodeConnections() {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
if (y < mapNodes[x].Length - 1)
mapNodes[x][y].north = mapNodes[x][y + 1];
if (y > 0)
mapNodes[x][y].south = mapNodes[x][y - 1];
if (x < mapNodes.Length - 1)
mapNodes[x][y].east = mapNodes[x + 1][y];
if (x > 0)
mapNodes[x][y].west = mapNodes[x - 1][y];
}
}
}
public void PrintMap(Transform prefabWalkable, Transform prefabUnwalkable) {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
PathNode pathNode = mapNodes[x][y];
UnityEngine.Object.Instantiate(pathNode.IsWalkable() ? prefabWalkable : prefabUnwalkable, new Vector3(x * nodeSize, y * nodeSize), Quaternion.identity);
}
}
}
public void PrintMap(Action<int, int> printNode) {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
printNode(x, y);
}
}
}
public void PrintMap(Action<int, int, Vector3> printNode) {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
printNode(x, y, worldOrigin + new Vector3(x * nodeSize, y * nodeSize));
}
}
}
public void PrintMap(Action<int, int> printWalkable, Action<int, int> printUnwalkable) {
for (int x = 0; x < mapNodes.Length; x++) {
for (int y = 0; y < mapNodes[x].Length; y++) {
PathNode pathNode = mapNodes[x][y];
if (pathNode.IsWalkable()) {
printWalkable(x, y);
} else {
printUnwalkable(x, y);
}
}
}
}
public void PrintMap(Action<Vector3, Vector3, Color> createSprite) {
PrintMap(
(int x, int y) => {
createSprite(worldOrigin + new Vector3(x * nodeSize, y * nodeSize), new Vector3(2, 2), Color.green);
//MyUtils.World_Sprite.Create(worldOrigin + new Vector3(x * nodeSize, y * nodeSize), new Vector3(2, 2), SpriteHolder.instance.s_White, Color.green);
},
(int x, int y) => {
createSprite(worldOrigin + new Vector3(x * nodeSize, y * nodeSize), new Vector3(2, 2), Color.red);
//MyUtils.World_Sprite.Create(worldOrigin + new Vector3(x * nodeSize, y * nodeSize), new Vector3(2, 2), SpriteHolder.instance.s_White, Color.red);
}
);
}
/*public void PrintMapUpdateable() {
}*/
private bool IsValidShortcut(int startX, int startY, int endX, int endY) {
//Debug.Log("Testing Shortcut: " + startX + ", " + startY + " -> " + endX + ", " + endY);
int shortcutWeight = mapNodes[startX][startY].weight;
Vector3 dir = (new Vector3(endX, endY) - new Vector3(startX, startY)).normalized;
Vector3 test = new Vector3(startX, startY) + dir;
int testX = Mathf.RoundToInt(test.x);
int testY = Mathf.RoundToInt(test.y);
// Check if shortcut is walkable
//Debug.Log("Testing: "+testX+","+testY);
while (!(testX == endX && testY == endY)) {
if (!IsWalkable(testX, testY) || mapNodes[testX][testY].weight != shortcutWeight) {
// Not walkable
//Debug.Log("Shortcut invalid!");
return false;
} else {
test += dir;
testX = Mathf.RoundToInt(test.x);
testY = Mathf.RoundToInt(test.y);
//Debug.Log("Testing: "+testX+","+testY);
}
}
// Shortcut walkable
//Debug.Log("Shortcut valid!");
return true;
}
public List<PathNode> GetFindPath(MapPos startPos, MapPos finalPos) {
int width = widthMax;
int height = heightMax;
startPos = GetClosestValidPos(startPos.x, startPos.y);
if (startPos.x < 0 || startPos.y < 0 || finalPos.x < 0 || finalPos.y < 0 ||
startPos.x >= width || finalPos.x >= width ||
startPos.y >= height || finalPos.y >= height) {
return null; //Out of bounds!
}
if (mapNodes[finalPos.x][finalPos.y].weight == WALL_WEIGHT ||
mapNodes[startPos.x][startPos.y].weight == WALL_WEIGHT)
return null; //Wall
return findPath(startPos.x, startPos.y, finalPos.x, finalPos.y);
}
public List<PathNode> GetFindPathClosest(MapPos startPos, List<MapPos> allFinalPos) {
List<PathNode> closest = null;
for (int i = 0; i < allFinalPos.Count; i++) {
List<PathNode> path = GetFindPath(startPos, allFinalPos[i]);
if (path != null) {
if (closest == null)
closest = path;
else {
if (path.Count < closest.Count) {
closest = path;
}
}
}
}
return closest;
}
public bool FindPath(int startX, int startY, MapPos finalPos, OnPathCallback callback) {
return FindPath(startX, startY, new List<MapPos>() { finalPos }, callback);
}
public bool FindPath(int startX, int startY, List<MapPos> finalPositions, OnPathCallback callback) {
int width = widthMax;
int height = heightMax;
MapPos start = GetClosestValidPos(startX, startY);
startX = start.x;
startY = start.y;
List<PathRoute> paths = new List<PathRoute>();
foreach (MapPos finalPos in finalPositions) {
if (startX < 0 || startY < 0 || finalPos.x < 0 || finalPos.y < 0 ||
startX >= width || finalPos.x >= width ||
startY >= height || finalPos.y >= height) {
continue; // Out of bounds!
}
if (mapNodes[finalPos.x][finalPos.y].weight == WALL_WEIGHT ||
mapNodes[startX][startY].weight == WALL_WEIGHT) {
// Find close non-wall start/end
continue; // Wall
}
List<PathNode> currentPath = findPath(startX, startY, finalPos.x, finalPos.y);
if (currentPath.Count <= 0 && (startX != finalPos.x || startY != finalPos.y)) {
// Don't add path if there's no path
} else {
if (!finalPos.straightToOffset) {
// Don't go straight to offset, add dummy
currentPath.Add(currentPath[currentPath.Count - 1]);
}
paths.Add(new PathRoute(currentPath, worldOrigin, nodeSize, finalPos));
}
}
int smallest = 0;
for (int i = 1; i < paths.Count; i++) {
if (paths[i].pathNodeList.Count < paths[smallest].pathNodeList.Count)
smallest = i;
}
if (paths.Count <= 0 || (paths.Count > 0 && paths[smallest].pathNodeList.Count <= 0)) {
// No path
return false;
} else {
callback(paths[smallest].pathNodeList, paths[smallest].finalPos);
}
return true;
}
public Vector3 GetClosestValidPosition(Vector3 position) {
int mapX, mapY;
ConvertVectorPositionValidate(position, out mapX, out mapY);
MapPos closestValidMapPos = GetClosestValidPos(mapX, mapY);
PathNode pathNode = mapNodes[closestValidMapPos.x][closestValidMapPos.y];
return pathNode.GetWorldVector(worldOrigin, nodeSize);
}
private MapPos GetClosestValidPos(int mapX, int mapY) {
int width = widthMax;
int height = heightMax;
// Inside bounds
while (mapX < 0) mapX++;
while (mapY < 0) mapY++;
while (mapX >= width) mapX--;
while (mapY >= height) mapY--;
// Check inside walls
if (mapNodes[mapX][mapY].weight == WALL_WEIGHT) {
int radius = 1;
MapPos valid = null;
do {
valid = GetValidPosRadius(mapX, mapY, radius);
radius++;
} while (valid == null && radius < 100);
if (radius == 100) return new MapPos(0, 0);
return valid;
}
return new MapPos(mapX, mapY);
}
private MapPos GetValidPosRadius(int mapX, int mapY, int radius) {
int width = widthMax;
int height = heightMax;
int endX = mapX + radius;
for (int i = mapX - radius; i <= endX; i++) {
int j = mapY + radius;
if (i < 0 || i >= width || j < 0 || j >= height) {
//Out of bounds
} else {
if (mapNodes[i][j].weight != WALL_WEIGHT)
return new MapPos(i, j);
}
j = mapY - radius;
if (i < 0 || i >= width || j < 0 || j >= height) {
//Out of bounds
} else {
if (mapNodes[i][j].weight != WALL_WEIGHT)
return new MapPos(i, j);
}
}
int endY = mapY + radius;
for (int j = mapY - radius + 1; j < endY; j++) {
int i = mapX - radius;
if (i < 0 || i >= width || j < 0 || j >= height) {
//Out of bounds
} else {
if (mapNodes[i][j].weight != WALL_WEIGHT)
return new MapPos(i, j);
}
i = mapX + radius;
if (i < 0 || i >= width || j < 0 || j >= height) {
//Out of bounds
} else {
if (mapNodes[i][j].weight != WALL_WEIGHT)
return new MapPos(i, j);
}
}
return null;
}
public void ApplyShortcuts(ref List<PathNode> pathNodeList) {
if (pathNodeList.Count > 1) {
int testStartNodeIndex = 1;
while (testStartNodeIndex < pathNodeList.Count - 2) { // Only test untils there's 3 nodes left
PathNode testStartNode = pathNodeList[testStartNodeIndex];
int testEndNodeIndex = testStartNodeIndex + 2;
// Test start node with node 2 indexes in front
PathNode testEndNode = pathNodeList[testEndNodeIndex];
while (IsValidShortcut(testStartNode.xPos, testStartNode.yPos, testEndNode.xPos, testEndNode.yPos)) {
// Valid shortcut
// Remove in between node
pathNodeList.RemoveAt(testStartNodeIndex + 1);
if (testEndNodeIndex >= pathNodeList.Count - 1) {
// No more nodes
break;
} else {
// Test next node
testEndNode = pathNodeList[testEndNodeIndex];
}
}
// Start next shortcut test from this end node
testStartNodeIndex = testEndNodeIndex;
}
}
}
public PathRoute GetPathRouteWithShortcuts(Vector3 start, Vector3 end) {
List<PathNode> pathNodeList = GetPath(start, end);
ApplyShortcuts(ref pathNodeList);
return new PathRoute(pathNodeList, worldOrigin, nodeSize, null);
}
public PathRoute GetPathRoute(Vector3 start, Vector3 end) {
List<PathNode> pathNodeList = GetPath(start, end);
return new PathRoute(pathNodeList, worldOrigin, nodeSize, null);
}
public List<PathNode> GetPath(Vector3 start, Vector3 end) {
start = start - worldOrigin;
end = end - worldOrigin;
start = start / nodeSize;
end = end / nodeSize;
MapPos startMapPos = GetClosestValidPos(Mathf.RoundToInt(start.x), Mathf.RoundToInt(start.y));
MapPos endMapPos = GetClosestValidPos(Mathf.RoundToInt(end.x), Mathf.RoundToInt(end.y));
return findPath(startMapPos.x, startMapPos.y, endMapPos.x, endMapPos.y);
}
public List<PathNode> findPath(int startX, int startY, int endX, int endY) {
List<PathNode> ret = new List<PathNode>();
// Calculate H for all nodes
CalculateAllHeuristics(endX, endY);
// Start finding target
foundTarget = false;
binaryTree = new BinaryTree();
openListCount = 1;
PathNode currentNode = mapNodes[startX][startY];
PathNode targetNode = mapNodes[endX][endY];
if (currentNode == targetNode) {
return new List<PathNode> { currentNode };
}
int iterations = 0;
do {
iterations++;
currentNode = FindTarget(currentNode, targetNode);
} while (!foundTarget && openListCount > 0 && iterations < 60000);
if (iterations >= 60000) UnityEngine.Debug.Log("iteration overload");
if (foundTarget) {
// Get path
currentNode = targetNode;
ret.Add(currentNode);
while (currentNode.parent != null && currentNode.parent != currentNode) {
ret.Add(currentNode.parent);
currentNode = currentNode.parent;
}
if (currentNode.parent == currentNode) UnityEngine.Debug.Log("parent == child");
} else {
// No path possible
}
ret.Reverse();
return ret;
}
private PathNode FindTarget(PathNode currentNode, PathNode targetNode) {
// Check the north node
if (currentNode.moveNorth) DetermineNodeValues(currentNode, currentNode.north, targetNode);
// Check the east node
if (currentNode.moveEast) DetermineNodeValues(currentNode, currentNode.east, targetNode);
// Check the south node
if (currentNode.moveSouth) DetermineNodeValues(currentNode, currentNode.south, targetNode);
// Check the west node
if (currentNode.moveWest) DetermineNodeValues(currentNode, currentNode.west, targetNode);
if (!foundTarget) {
// Once done checking add to the closed list and remove from the open list
AddToClosedList(currentNode);
RemoveFromOpenList(currentNode);
// Get the next node with the smallest F value
return GetSmallestFValueNode();
} else {
return null;
}
}
private void DetermineNodeValues(PathNode currentNode, PathNode testing, PathNode targetNode) {
// Dont work on null nodes
if (testing == null)
return;
// Check to see if the node is the target
if (testing == targetNode) {
targetNode.parent = currentNode;
foundTarget = true;
return;
}
// Ignore Walls
if (currentNode.weight == WALL_WEIGHT || testing.weight == WALL_WEIGHT)
return;
// While the node has not already been tested
if (!testing.isOnClosedList) {
// Check to see if the node is already on the open list
if (testing.isOnOpenList) {
// Get a Gcost to move from this node to the testing node
int newGcost = currentNode.gValue + currentNode.weight + movementCost;
// If the G cost is better then change the nodes parent and update its costs.
if (newGcost < testing.gValue) {
testing.parent = currentNode;
testing.gValue = newGcost;
binaryTree.RemoveNode(testing);
testing.CalculateFValue();
binaryTree.AddNode(testing);
}
} else {
// Set the testing nodes parent to the current location, calculate its costs, and add it to the open list
testing.parent = currentNode;
testing.gValue = currentNode.gValue + currentNode.weight + movementCost;
testing.CalculateFValue();
AddToOpenList(testing);
}
}
}
private void AddToOpenList(PathNode node) {
binaryTree.AddNode(node);
openListCount++;
node.isOnOpenList = true;
}
private void AddToClosedList(PathNode currentNode) {
currentNode.isOnClosedList = true;
}
private void RemoveFromOpenList(PathNode currentNode) {
binaryTree.RemoveNode(currentNode);
openListCount--;
currentNode.isOnOpenList = false;
}
private PathNode GetSmallestFValueNode() {
return binaryTree.GetSmallest();
}
private void CalculateManhattanDistance(PathNode currentNode, int currX, int currY, int targetX, int targetY) {
currentNode.parent = null;
currentNode.hValue = (Mathf.Abs(currX - targetX) + Mathf.Abs(currY - targetY));
currentNode.isOnOpenList = false;
currentNode.isOnClosedList = false;
}
private void CalculateAllHeuristics(int endX, int endY) {
int rows = heightMax;
int cols = widthMax;
for (int x = 0; x < cols; x++) {
for (int y = 0; y < rows; y++) {
CalculateManhattanDistance(mapNodes[x][y], x, y, endX, endY);
}
}
}
public void ResetRestrictions() {
for (int i = 0; i < GetMapWidth(); i++) {
for (int j = 0; j < GetMapHeight(); j++) {
mapNodes[i][j].ResetRestrictions();
}
}
}
public void RefreshAllHitboxes() {
for (int x = 0; x < widthMax; x++) {
for (int y = 0; y < heightMax; y++) {
mapNodes[x][y].TestHitbox();
}
}
//Event_Speaker.Broadcast(Event_Trigger.Pathfinding_Refresh);
}
public void RefreshHitbox(MapPos mapPos) {
mapNodes[mapPos.x][mapPos.y].TestHitbox();
//Event_Speaker.Broadcast(Event_Trigger.Pathfinding_Refresh);
}
public bool IsWalkable(MapPos mapPos) {
return mapNodes[mapPos.x][mapPos.y].weight != WALL_WEIGHT;
}
public bool IsWalkable(int x, int y) {
return mapNodes[x][y].weight != WALL_WEIGHT;
}
public bool IsWall(int x, int y) {
return mapNodes[x][y].weight == WALL_WEIGHT;
}
public bool HasWeight(int x, int y) {
return mapNodes[x][y].weight > 0;
}
private void ConvertVectorPosition(Vector3 position, out int x, out int y) {
x = (int)((position.x - worldOrigin.x) / nodeSize);
y = (int)((position.y - worldOrigin.y) / nodeSize);
}
private void ConvertVectorPositionValidate(Vector3 position, out int x, out int y) {
ConvertVectorPosition(position, out x, out y);
if (x < 0) x = 0;
if (y < 0) y = 0;
if (x >= widthMax) x = widthMax - 1;
if (y >= heightMax) y = heightMax - 1;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eace4f719d58cb648a489e77d2f64e7f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,41 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//using myNameSpace;
namespace GridPathfindingSystem {
public class LastMoveTo {
public List<MapPos> mapPos;
public GridPathfinding.UnitMovementCallbackType callbackType;
public object obj;
public UnitMovement.PathCallback callback;
public LastMoveTo(List<MapPos> _mapPos, GridPathfinding.UnitMovementCallbackType _callbackType, object _obj, UnitMovement.PathCallback _callback) {
mapPos = _mapPos;
callbackType = _callbackType;
obj = _obj;
callback = _callback;
}
public LastMoveTo(MapPos _mapPos, GridPathfinding.UnitMovementCallbackType _callbackType, object _obj, UnitMovement.PathCallback _callback) {
mapPos = new List<MapPos>() { _mapPos };
callbackType = _callbackType;
obj = _obj;
callback = _callback;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 82477c170e8678441ac7c96ea78318ee
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,96 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using System.Collections.Generic;
namespace GridPathfindingSystem {
public class MapPos {
public int x;
public int y;
public float offsetX;
public float offsetY;
public bool straightToOffset = true;
public MapPos(int _x, int _y, float _offsetX = 0f, float _offsetY = 0f, bool _straightToOffset = true) {
x = _x;
y = _y;
offsetX = _offsetX;
offsetY = _offsetY;
straightToOffset = _straightToOffset;
}
public bool Equals(MapPos p2) {
// Check if this one equals that one
return x == p2.x && y == p2.y;
}
public bool EqualsDeep(MapPos p2) {
// Check if this one equals that one
return x == p2.x && y == p2.y && offsetX == p2.offsetX && offsetY == p2.offsetY && straightToOffset == p2.straightToOffset;
}
public override string ToString() {
return "x:" + x + ", y:" + y;
}
public string ToStringThorough() {
return "x:" + x + ", y:" + y + "; ox:" + offsetX + ", oy:" + offsetY + ", s: " + straightToOffset;
}
public void ResetOffset() {
offsetX = 0f;
offsetY = 0f;
}
public MapPos ClearOffset() {
return new MapPos(x, y);
}
public MapPos Clone() {
return new MapPos(x, y, offsetX, offsetY, straightToOffset);
}
public MapPos AddPosCopy(int x, int y) {
return new MapPos(this.x + x, this.y + y);
}
public static int Distance(MapPos p1, MapPos p2) {
return System.Math.Abs(p1.x - p2.x) + System.Math.Abs(p1.y - p2.y);
}
public static bool ListContains(List<MapPos> list, MapPos mapPos) {
// Check if map pos is in list
foreach (MapPos pos in list)
if (pos.Equals(mapPos))
return true;
return false;
}
public string Save() {
// Returns a string to be used in savefiles
string[] content = new string[]{
""+x,
""+y,
""+offsetX,
""+offsetY,
""+straightToOffset,
};
return string.Join("#MAPPOS#", content);
}
public static MapPos Load(string save) {
return new MapPos(save);
}
public MapPos(string save) {
// Loads a MapPos object form a given savefile string
string[] content = save.Split(new string[] { "#MAPPOS#" }, System.StringSplitOptions.None);
x = int.Parse(content[0]);
y = int.Parse(content[1]);
offsetX = float.Parse(content[2]);
offsetY = float.Parse(content[3]);
straightToOffset = bool.Parse(content[4]);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: af7b62dd0b271c6449459b06c6ac897a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,91 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using System;
using UnityEngine;
using System.Collections;
namespace GridPathfindingSystem {
public class PathNode {
public event EventHandler OnWalkableChanged;
public int xPos;
public int yPos;
public PathNode parent;
public PathNode north;
public PathNode south;
public PathNode west;
public PathNode east;
public bool moveNorth;
public bool moveSouth;
public bool moveWest;
public bool moveEast;
public bool isOnOpenList = false;
public bool isOnClosedList = false;
public int weight = 0;
public int gValue = 0;
public int hValue;
public int fValue;
//public Transform trans;
//public int layerMask = 1 << 9;
public PathNode(int _xPos, int _yPos) {
xPos = _xPos;
yPos = _yPos;
moveNorth = true;
moveSouth = true;
moveWest = true;
moveEast = true;
//trans = ((GameObject) Object.Instantiate(Resources.Load("pfPathNode"), new Vector3(xPos*10, 0, zPos*10), Quaternion.identity)).transform;
TestHitbox();
}
public void ResetRestrictions() {
moveNorth = true;
moveSouth = true;
moveWest = true;
moveEast = true;
}
public override string ToString() {
return "x: " + xPos + ", y:" + yPos;
}
public void SetWalkable(bool walkable) {
weight = walkable ? 0 : GridPathfinding.WALL_WEIGHT;
if (OnWalkableChanged != null) OnWalkableChanged(this, EventArgs.Empty);
}
public void SetWeight(int weight) {
this.weight = weight;
}
public bool IsWalkable() {
return weight < GridPathfinding.WALL_WEIGHT;
}
public void TestHitbox() {
weight = 0;
}
public MapPos GetMapPos() {
return new MapPos(xPos, yPos);
}
public void CalculateFValue() {
fValue = gValue + hValue;
}
public Vector3 GetWorldVector(Vector3 worldOrigin, float nodeSize) {
return worldOrigin + new Vector3(xPos * nodeSize, yPos * nodeSize);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a4734582c1b75204b8e0d988a68c69fa
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,35 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using UnityEngine;
using System.Collections;
namespace GridPathfindingSystem {
public class PathQueue {
public int startX;
public int startY;
public int endX;
public int endY;
public GridPathfinding.OnPathCallback callback;
public PathQueue(int _startX, int _startY, int _endX, int _endY, GridPathfinding.OnPathCallback _callback) {
startX = _startX;
startY = _startY;
endX = _endX;
endY = _endY;
callback = _callback;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: be5654ed6c4e7d04a80a23cacd4284ca
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,46 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace GridPathfindingSystem {
public class PathRoute {
public List<PathNode> pathNodeList;
public List<Vector3> pathVectorList;
public MapPos finalPos;
public PathRoute(List<PathNode> pathNodeList, List<Vector3> pathVectorList, MapPos finalPos) {
this.pathNodeList = pathNodeList;
this.pathVectorList = pathVectorList;
this.finalPos = finalPos;
}
public PathRoute(List<PathNode> pathNodeList, Vector3 worldOrigin, float nodeSize, MapPos finalPos) {
this.pathNodeList = pathNodeList;
pathVectorList = new List<Vector3>();
foreach (PathNode pathNode in pathNodeList) {
pathVectorList.Add(pathNode.GetWorldVector(worldOrigin, nodeSize));
}
this.finalPos = finalPos;
}
public void AddVector(Vector3 vector) {
pathVectorList.Add(vector);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c49d6b0e0cdcbdd4192999d5dc56793f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

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