Shooting Animations Added

This commit is contained in:
Syntriax 2022-02-25 23:36:20 +03:00
parent 3b8cee973f
commit f338283adb
13 changed files with 532 additions and 2 deletions

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: Shooting Patrolling Attack
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: a19cbb84a96566a46b1f1fe22265331b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
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: Shooting 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: []
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: 5d5c3517990910d4b80e8c4c92b28458
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ShootingPatrollingEnemy_0
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers: []

View File

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

View File

@ -63,6 +63,14 @@ PrefabInstance:
propertyPath: m_CollisionDetection propertyPath: m_CollisionDetection
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2564862039932993934, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_SpriteTilingProperty.newSize.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2564862039932993934, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_SpriteTilingProperty.newSize.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3} - target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 0 value: 0
@ -107,10 +115,34 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4927926253738514311, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: a5f8ced7a993ac240887b1f90e5e97e9, type: 2}
- target: {fileID: 5120716685902934120, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_SpriteTilingProperty.newSize.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5120716685902934120, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_SpriteTilingProperty.newSize.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3} - target: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Basic Shooting Patrolling Enemy Variant value: Basic Shooting Patrolling Enemy Variant
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8510568918136408618, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_Size.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8510568918136408618, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_Size.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8510568918136408618, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: -1349788792, guid: 1efadb39977408e45afdf46717553bba, type: 3}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c0a2079a443363b4da73a0d425221f6c, type: 3} m_SourcePrefab: {fileID: 100100000, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
--- !u!4 &2215831379607469555 stripped --- !u!4 &2215831379607469555 stripped

View File

@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 5084819958108693599} - component: {fileID: 5084819958108693599}
- component: {fileID: 6837629660644296000} - component: {fileID: 6837629660644296000}
- component: {fileID: 2154021251853475818} - component: {fileID: 2154021251853475818}
m_Layer: 0 m_Layer: 9
m_Name: Basic Projectile m_Name: Basic Projectile
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}

View File

@ -20,6 +20,8 @@ namespace AI
protected Transform target = null; protected Transform target = null;
protected bool isShooting = false; protected bool isShooting = false;
protected IMovement movement = null; protected IMovement movement = null;
protected Animator animator = null;
protected int layerMask = ~(1 << 9);
protected bool canShoot => target != null && (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared; protected bool canShoot => target != null && (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared;
@ -41,6 +43,7 @@ namespace AI
protected virtual void Start() protected virtual void Start()
{ {
movement = transform.GetComponentInParent<IMovement>(); movement = transform.GetComponentInParent<IMovement>();
animator = transform.GetComponentInParent<Animator>();
UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform); UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform);
} }
@ -57,8 +60,11 @@ namespace AI
isShooting = true; isShooting = true;
float movementBaseSpeed = movement.BaseSpeed; float movementBaseSpeed = movement.BaseSpeed;
movement.BaseSpeed = 0f; movement.BaseSpeed = 0f;
animator.SetBool("isAttacking", true);
animator.speed = 0f;
yield return new WaitForSeconds(focusingTime); yield return new WaitForSeconds(focusingTime);
animator.speed = 1f;
while (canShoot) while (canShoot)
{ {
@ -67,6 +73,7 @@ namespace AI
yield return null; yield return null;
} }
movement.BaseSpeed = movementBaseSpeed; movement.BaseSpeed = movementBaseSpeed;
animator.SetBool("isAttacking", false);
isShooting = false; isShooting = false;
} }
@ -77,7 +84,7 @@ namespace AI
Vector3 velocity = GetVelocityForProjectile(timeForProjectileToHit); Vector3 velocity = GetVelocityForProjectile(timeForProjectileToHit);
RaycastHit2D raycastHit2D = Physics2D.Raycast(transform.position, target.position - transform.position, attackRange); RaycastHit2D raycastHit2D = Physics2D.Raycast(transform.position, target.position - transform.position, attackRange, layerMask);
if (raycastHit2D.transform != target) if (raycastHit2D.transform != target)
velocity = GetVelocityForProjectile(timeForProjectileToHit * 2); velocity = GetVelocityForProjectile(timeForProjectileToHit * 2);

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,342 @@
fileFormatVersion: 2
guid: 1efadb39977408e45afdf46717553bba
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: ShootingPatrollingEnemy_0
rect:
serializedVersion: 2
x: 0
y: 16
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: bd1f94180e7c7f04d9b4f1b4e156eec9
internalID: -1349788792
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_1
rect:
serializedVersion: 2
x: 16
y: 16
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: a52ec89157be83f4e8b9385dce76af88
internalID: 126039133
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_2
rect:
serializedVersion: 2
x: 32
y: 16
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: 793b019b852724e4da3c84c2ec956df7
internalID: 1248009340
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_3
rect:
serializedVersion: 2
x: 48
y: 16
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: 92b8a4d1a29cbe94697388f145b4d554
internalID: 223013045
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_4
rect:
serializedVersion: 2
x: 64
y: 16
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: e7c87a2ad9085ee4284153d1cf60d4b9
internalID: 1054640101
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_5
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: b4baf778e45b8624a80043b163351daf
internalID: 743132909
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_6
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: 902ed1d96d9a163449dde80bb2c9434d
internalID: -2076608484
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_7
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: a79bf3b05a3d2bc439237380b08b2474
internalID: -1235347885
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_8
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: 3bf782dc62b42f44aa32df7b3b794363
internalID: -1157838632
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: ShootingPatrollingEnemy_9
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: 6faa67c4f4439e345add69f053c50c29
internalID: -462201011
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable:
ShootingPatrollingEnemy_2: 1248009340
ShootingPatrollingEnemy_6: -2076608484
ShootingPatrollingEnemy_9: -462201011
ShootingPatrollingEnemy_1: 126039133
ShootingPatrollingEnemy_4: 1054640101
ShootingPatrollingEnemy_8: -1157838632
ShootingPatrollingEnemy_0: -1349788792
ShootingPatrollingEnemy_5: 743132909
ShootingPatrollingEnemy_7: -1235347885
ShootingPatrollingEnemy_3: 223013045
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: