Jumping animation without sprinting as well

State of the code before and after presentation
This commit is contained in:
Norbi Peti 2020-11-20 15:34:20 +01:00
parent e78ac39841
commit cbabc6e6a2
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
9 changed files with 7 additions and 698 deletions

View file

@ -47,7 +47,7 @@ public class EnemyController : CharacterControllerBase
diff.Normalize();
float sp = ((float) _random.NextDouble() / 2f + 1f) * speed; //1 és 1.5 közötti szorzó
_rb.AddForce(diff * (sp * _rb.mass * _rb.gravityScale));
_rb.AddForce(diff * sp);
if (diff.x * transform.localScale.x < 0) //Ha másfelé néz, mint amerre megy
{
var scale = tr.localScale;

View file

@ -25,7 +25,6 @@ public class EnemySpawner : MonoBehaviour
private void FixedUpdate()
{
//int timeMultiplier = _spawner.maxLevel - _spawner.Level;
int countMultiplier = _spawner.Level + 1;
if (Time.fixedTime - _lastSpawn > timeBetweenSpawns && _random.Next(2) == 1)
{

View file

@ -57,11 +57,8 @@ public class OwnCharacterController : CharacterControllerBase
{
//_rb.AddForce(new Vector2(0, jumpForce), ForceMode2D.Impulse);
_rb.velocity += new Vector2(0, jumpForce);
if (sprinting) //Csak akkor animálja az ugrást, ha fut közben
{
_jumpStatus = JumpStatus.Up;
_animator.SetInteger(Jump, (int) _jumpStatus);
}
_jumpStatus = JumpStatus.Up;
_animator.SetInteger(Jump, (int) _jumpStatus);
}
else if (_jumpStatus == JumpStatus.Up && _rb.velocity.y <= 0)
{

View file

@ -8,12 +8,11 @@ public class Parallaxing : MonoBehaviour
private float _parallaxScale;
public float smoothing = 1f;
private Transform _cam; // reference to the main cameras transform
private Vector3 _previousCamPos; // the position of the camera in the previous frame
private Transform _cam;
private Vector3 _previousCamPos;
// Is called before Start(). Great for references.
void Awake () {
// set up the camera reference
_cam = Camera.main.transform;
_background = transform;
}
@ -21,11 +20,8 @@ public class Parallaxing : MonoBehaviour
// Start is called before the first frame update
void Start()
{
// The previous frame had the current frame's camera position
_previousCamPos = _cam.position;
// asigning coresponding parallaxScale
_parallaxScale = _background.position.z * -1;
_parallaxScale = _background.position.z * -1;
}
// Update is called once per frame

View file

@ -23,11 +23,8 @@ public class WeaponFireController : MonoBehaviour
var theRocket = _pool.GetObject();
var rocketTransform = theRocket.transform;
rocketTransform.position = firePoint.position;
/*var scale = rocketTransform.localScale;
if (transform.localScale.x * scale.x < 0)
scale.x *= -1;
rocketTransform.localScale = scale;*/
//https://forum.unity.com/threads/look-rotation-2d-equivalent.611044/
// vector from this object towards the target location
var vectorToTarget = Camera.main.ScreenToWorldPoint(Input.mousePosition) - rocketTransform.position;
// rotate that vector by 90 degrees around the Z axis
@ -38,10 +35,6 @@ public class WeaponFireController : MonoBehaviour
Quaternion targetRotation = Quaternion.LookRotation(Vector3.forward, rotatedVectorToTarget);
rocketTransform.rotation = targetRotation;
Debug.Log("Rotation: " + rocketTransform.rotation.eulerAngles);
/*Debug.Log("Rocket position: " + rocketTransform.position);
Debug.Log("Target position: " + Camera.main.ScreenToWorldPoint(Input.mousePosition));
Debug.Log("Difference: " + direction);*/
theRocket.SetActive(true);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 KiB

View file

@ -1,584 +0,0 @@
fileFormatVersion: 2
guid: 61ff92a26f8a87b2fbc9f77b236f2b86
TextureImporter:
internalIDToNameTable:
- first:
213: 6215946957151090410
second: 0KPstargate6_0
- first:
213: 1824780703637216034
second: 0KPstargate6_1
- first:
213: -6813554826073840115
second: 0KPstargate6_2
- first:
213: -8714056298488459117
second: 0KPstargate6_3
- first:
213: 6494375952796239117
second: 0KPstargate6_4
- first:
213: -4825160815170893969
second: 0KPstargate6_5
- first:
213: -5837576012356773426
second: 0KPstargate6_6
- first:
213: -609809518553965120
second: 0KPstargate6_7
- first:
213: -4411691492432442427
second: 0KPstargate6_8
- first:
213: 8522341075388805828
second: 0KPstargate6_9
- first:
213: 5976946067820373527
second: 0KPstargate6_10
- first:
213: -1861092953004689142
second: 0KPstargate6_11
- first:
213: 3006149256635726740
second: 0KPstargate6_12
- first:
213: -1287865085953470533
second: 0KPstargate6_13
- first:
213: -6292988333298257048
second: 0KPstargate6_14
- first:
213: 9113365565639785961
second: 0KPstargate6_15
- first:
213: -3022556281364571634
second: 0KPstargate6_16
- first:
213: -3324735633885395859
second: 0KPstargate6_17
- first:
213: 7308581748585440135
second: 0KPstargate6_18
- first:
213: -3714162693339934198
second: 0KPstargate6_19
- first:
213: 8144289205613437099
second: 0KPstargate6_20
- first:
213: 1602311856356736129
second: 0KPstargate6_21
- first:
213: 6665703894995352260
second: 0KPstargate6_22
- first:
213: -3668371684354457943
second: 0KPstargate6_23
- first:
213: -5224975506926056405
second: 0KPstargate6_24
- first:
213: 7251548154718782083
second: 0KPstargate6_25
- first:
213: -764946730860606655
second: 0KPstargate6_26
- first:
213: 1304604802716602244
second: 0KPstargate6_27
- first:
213: 2816224451053404343
second: 0KPstargate6_28
- first:
213: -774980701152297005
second: 0KPstargate6_29
- first:
213: -224649725591867779
second: 0KPstargate6_30
- first:
213: 8016084702566085341
second: 0KPstargate6_31
- first:
213: -352458077375957288
second: 0KPstargate6_32
- first:
213: -8201300173824824328
second: 0KPstargate6_33
- first:
213: -8660537384575390179
second: 0KPstargate6_34
- first:
213: -8737277888886628146
second: 0KPstargate6_35
- first:
213: -3459363461154146056
second: 0KPstargate6_36
- first:
213: -6777667326848552425
second: 0KPstargate6_37
- first:
213: -937947441570556669
second: 0KPstargate6_38
- first:
213: 3261433233939225323
second: 0KPstargate6_39
- first:
213: -2924404044207653851
second: 0KPstargate6_40
- first:
213: 911679391387433149
second: 0KPstargate6_41
- first:
213: 7384767024929548139
second: 0KPstargate6_42
- first:
213: 8027202184726176200
second: 0KPstargate6_43
- first:
213: -6250289638521765274
second: 0KPstargate6_44
- first:
213: -6591356938425936611
second: 0KPstargate6_45
- first:
213: -1151540059867952729
second: 0KPstargate6_46
- first:
213: -8495222491040675302
second: 0KPstargate6_47
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: 0KPstargate6_0
rect:
serializedVersion: 2
x: 0
y: 384
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: ae639a3f2da734650800000000000000
internalID: 6215946957151090410
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_1
rect:
serializedVersion: 2
x: 96
y: 384
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 22b9841c16ce25910800000000000000
internalID: 1824780703637216034
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_2
rect:
serializedVersion: 2
x: 192
y: 384
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: d0668364cf36171a0800000000000000
internalID: -6813554826073840115
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_3
rect:
serializedVersion: 2
x: 288
y: 384
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 39017df27f3711780800000000000000
internalID: -8714056298488459117
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_4
rect:
serializedVersion: 2
x: 0
y: 256
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: d0542483588a02a50800000000000000
internalID: 6494375952796239117
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_5
rect:
serializedVersion: 2
x: 96
y: 256
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: f67ca9badc5990db0800000000000000
internalID: -4825160815170893969
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_6
rect:
serializedVersion: 2
x: 192
y: 256
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: ec9122aab83ccfea0800000000000000
internalID: -5837576012356773426
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_7
rect:
serializedVersion: 2
x: 288
y: 256
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 0cd50f949758987f0800000000000000
internalID: -609809518553965120
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_8
rect:
serializedVersion: 2
x: 0
y: 128
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 5cb83f636f586c2c0800000000000000
internalID: -4411691492432442427
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_9
rect:
serializedVersion: 2
x: 96
y: 128
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 4c235450e00754670800000000000000
internalID: 8522341075388805828
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_10
rect:
serializedVersion: 2
x: 192
y: 128
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 716e91e08c062f250800000000000000
internalID: 5976946067820373527
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_11
rect:
serializedVersion: 2
x: 288
y: 128
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: a093c2ad1d11c26e0800000000000000
internalID: -1861092953004689142
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_12
rect:
serializedVersion: 2
x: 0
y: 0
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 49bb39752dcf7b920800000000000000
internalID: 3006149256635726740
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_13
rect:
serializedVersion: 2
x: 96
y: 0
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: bbf8d191785902ee0800000000000000
internalID: -1287865085953470533
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_14
rect:
serializedVersion: 2
x: 192
y: 0
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 863741ad370daa8a0800000000000000
internalID: -6292988333298257048
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: 0KPstargate6_15
rect:
serializedVersion: 2
x: 288
y: 0
width: 96
height: 128
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 9ed7c3082bd297e70800000000000000
internalID: 9113365565639785961
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 KiB

View file

@ -1,92 +0,0 @@
fileFormatVersion: 2
guid: b7c58d679d4a108e2874b2fa3b5c70e4
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: