Patrollin Enemy Sprites

This commit is contained in:
Syntriax 2022-02-25 12:45:02 +03:00
parent 16be6c18c5
commit 89a057060c
14 changed files with 499 additions and 8 deletions

8
Assets/Animations.meta Normal file
View File

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

View File

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

View File

@ -0,0 +1,80 @@
%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: Basic Patrolling
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: -240337815, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- time: 0.083333336
value: {fileID: -453532579, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- time: 0.16666667
value: {fileID: -1110172175, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- time: 0.25
value: {fileID: 1855587711, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- time: 0.33333334
value: {fileID: 1295632039, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, 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: -240337815, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- {fileID: -453532579, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- {fileID: -1110172175, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- {fileID: 1855587711, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
- {fileID: 1295632039, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.4166667
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: 6cbff4cef0dedd54da8b1b8f70b16d04
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1107 &-8462743447668952890
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: 4633318136352401161}
m_Position: {x: 310, y: 110, 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: 4633318136352401161}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PatrollingEnemy_0
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -8462743447668952890}
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 &4633318136352401161
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Basic Patrolling
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
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: 6cbff4cef0dedd54da8b1b8f70b16d04, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter: IsMovingRight
m_CycleOffsetParameter:
m_TimeParameter:

View File

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

View File

@ -139,9 +139,11 @@ GameObject:
m_Component:
- component: {fileID: 3234632762428300599}
- component: {fileID: 8510568918136408618}
- component: {fileID: 5120716685902934120}
- component: {fileID: 2564862039932993934}
- component: {fileID: 1030411162175245191}
- component: {fileID: 8503951513957676288}
- component: {fileID: 4927926253738514311}
m_Layer: 7
m_Name: Basic Patrolling Enemy
m_TagString: Untagged
@ -157,7 +159,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7391517555913877016}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.4136911, y: 0.5090097, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -206,17 +208,43 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Sprite: {fileID: -240337815, guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_Size: {x: 2, y: 2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &5120716685902934120
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7391517555913877016}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: -0.25}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 2, y: 2}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 0.5}
m_EdgeRadius: 0
--- !u!61 &2564862039932993934
BoxCollider2D:
m_ObjectHideFlags: 0
@ -230,18 +258,18 @@ BoxCollider2D:
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_Offset: {x: 0, y: -0.125}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
newSize: {x: 2, y: 2}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_Size: {x: 0.5, y: 0.75}
m_EdgeRadius: 0
--- !u!50 &1030411162175245191
Rigidbody2D:
@ -276,7 +304,27 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 321c5495f0d597749bf29c3a2966aa4a, type: 3}
m_Name:
m_EditorClassIdentifier:
isMovingRight: 0
isMovingRightInitially: 0
--- !u!95 &4927926253738514311
Animator:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7391517555913877016}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: f2b8d0068be30fd429ca650e7df0c599, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &7883981671222168568
GameObject:
m_ObjectHideFlags: 0

View File

@ -1623,6 +1623,10 @@ PrefabInstance:
propertyPath: m_Name
value: UI
objectReference: {fileID: 0}
- target: {fileID: 7804154879131926840, guid: 4978bf886d6bbe0448d5f68e7eb2b48a, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8835447878742992447, guid: 4978bf886d6bbe0448d5f68e7eb2b48a, type: 3}
propertyPath: m_RootOrder
value: 6

View File

@ -6,9 +6,11 @@ namespace AI
{
public class BasicPatrollingEnemyAI : MonoBehaviour, IPausable
{
[SerializeField] protected bool isMovingRight = false;
[SerializeField] protected bool isMovingRightInitially = false;
protected bool isMovingRight = false;
protected IMovement movement = null;
protected SpriteRenderer spriteRenderer = null;
protected CollisionChecker leftWallChecker = null;
protected CollisionChecker rightWallChecker = null;
@ -32,10 +34,13 @@ namespace AI
protected virtual void Awake()
{
movement = gameObject.AddComponent<EnemyMovement>();
spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
leftWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Wall");
rightWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Wall");
leftGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Ground");
rightGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Ground");
isMovingRight = isMovingRightInitially;
spriteRenderer.flipX = !isMovingRightInitially;
}
protected virtual void FixedUpdate()
@ -44,7 +49,10 @@ namespace AI
return;
if (ShouldChangeDirection)
{
isMovingRight = !isMovingRight;
spriteRenderer.flipX = !isMovingRight;
}
movement.Move(isMovingRight ? 1f : -1f);
}

View File

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

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 74c3616ad78295740a0218530c1ca014
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

View File

@ -0,0 +1,232 @@
fileFormatVersion: 2
guid: 5cd0d5f704bd1e14d9a7e4886a9c7f38
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 16
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: PatrollingEnemy_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 16
height: 16
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 20a3ca4b3771caf4097c6252866b2eb0
internalID: -240337815
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: PatrollingEnemy_1
rect:
serializedVersion: 2
x: 16
y: 0
width: 16
height: 16
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: e006e5198ba70ce42bbce194969dd670
internalID: -453532579
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: PatrollingEnemy_2
rect:
serializedVersion: 2
x: 32
y: 0
width: 16
height: 16
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 2520ce81b450d3c42b66b4c9220f965e
internalID: -1110172175
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: PatrollingEnemy_3
rect:
serializedVersion: 2
x: 48
y: 0
width: 16
height: 16
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: c4084c4df1d3c1c45803f0095098bd42
internalID: 1855587711
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: PatrollingEnemy_4
rect:
serializedVersion: 2
x: 64
y: 0
width: 16
height: 16
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 5fb0441f407b4cf45b0257333dbcd64e
internalID: 1295632039
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable:
PatrollingEnemy_1: -453532579
PatrollingEnemy_2: -1110172175
PatrollingEnemy_0: -240337815
PatrollingEnemy_4: 1295632039
PatrollingEnemy_3: 1855587711
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: