feat: Ship rotates towards joystick direction, health property, death match decider, better hit detection

This commit is contained in:
Jakob Feldmann 2024-06-12 13:45:59 +02:00
parent a38acd711f
commit 4745d7fef0
35 changed files with 968 additions and 807 deletions

View File

@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 1030948336149387811}
- component: {fileID: 5960278131317783145}
- component: {fileID: 9020502532674983852}
m_Layer: 0
m_Name: UIManager
m_TagString: Untagged
@ -44,3 +45,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 547ca5863fe736e428968ffbeaddc0f2, type: 3}
m_Name:
m_EditorClassIdentifier:
OffScreenManager: {fileID: 9020502532674983852}
MatchMusic: {fileID: 0}
--- !u!114 &9020502532674983852
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3887031022702914267}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a453b9260772e8488c230aa7eeca5ff, type: 3}
m_Name:
m_EditorClassIdentifier:
Targets: []
IndicatorPrefab: {fileID: 5312737329671837370, guid: fac9d84719a43574f9cfbc19b53aee98, type: 3}

View File

@ -67,6 +67,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tackleKind: 2
hitKind: 1
OwnerId: 0
--- !u!1 &824086104227363207
GameObject:
m_ObjectHideFlags: 0
@ -111,7 +113,7 @@ GameObject:
- component: {fileID: 8073551614022217321}
m_Layer: 6
m_Name: Wing Spike Left
m_TagString: Bumper
m_TagString: Spike
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -165,6 +167,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tackleKind: 3
hitKind: 1
OwnerId: 0
--- !u!1 &1349367779684097889
GameObject:
m_ObjectHideFlags: 0
@ -234,6 +238,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tackleKind: 1
hitKind: 1
OwnerId: 0
--- !u!1 &1372816401649438144
GameObject:
m_ObjectHideFlags: 0
@ -280,6 +286,7 @@ Transform:
- {fileID: 7971143227516595385}
- {fileID: 3078445893664878222}
- {fileID: 6780256004419462580}
- {fileID: 5050929403426359679}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &112616906359525181
@ -294,7 +301,7 @@ Rigidbody:
m_Drag: 0
m_AngularDrag: 1e+38
m_CenterOfMass: {x: 0, y: 1, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaTensor: {x: 0, y: 0, z: 0}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
@ -319,10 +326,10 @@ BoxCollider:
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 8
m_Bits: 9
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 503
m_Bits: 480
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
@ -348,8 +355,9 @@ MonoBehaviour:
GravityEffect: {fileID: 4872706334040053047}
JetFlameEffect: {fileID: 4832079438170929303}
SmokeTrailEffect: {fileID: 3500843490324877803}
FireController: {fileID: 6551228186126772357}
DamageParticleEffect: {fileID: 8926071544545039189}
BodyMeshRenderer: {fileID: 8803443673514485770}
_body: {fileID: 0}
--- !u!114 &6551228186126772357
MonoBehaviour:
m_ObjectHideFlags: 0
@ -365,7 +373,7 @@ MonoBehaviour:
TurretSocket:
- {fileID: 982896938032841241}
ShellParticles: []
DefaultFXType: 4
SelectedWeaponEffect: 0
vulcanProjectile: {fileID: 400000, guid: e496166a742ada640b89650ebebbd052, type: 3}
vulcanMuzzle: {fileID: 400002, guid: ca6dec307275d294ba519247d04b6733, type: 3}
vulcanImpact: {fileID: 400000, guid: bfa7781c328a236468eda51a8ae2be55, type: 3}
@ -375,6 +383,7 @@ MonoBehaviour:
soloGunMuzzle: {fileID: 400000, guid: b16d97c287e513344af2399ff138cd27, type: 3}
soloGunImpact: {fileID: 400004, guid: fd953838f1872d042a334b466e298967, type: 3}
soloGunOffset: 0
SoloGunFireRate: 0.3
sniperBeam: {fileID: 400000, guid: 12e7c1b739173c946b6fa3d40e9f62d1, type: 3}
sniperMuzzle: {fileID: 400004, guid: 43a8e47b31adb9a47b81c4653b412e5c, type: 3}
sniperImpact: {fileID: 400004, guid: a980d2b7788c0ef489f3c79f44da79e1, type: 3}
@ -387,10 +396,12 @@ MonoBehaviour:
seekerMuzzle: {fileID: 400004, guid: 235092330dd93ce4ab3f64b4b4b9c354, type: 3}
seekerImpact: {fileID: 400010, guid: 25381a5e43841e943a27b043442b2b4d, type: 3}
seekerOffset: 0
SeekerFireRate: 0.5
railgunBeam: {fileID: 400000, guid: ec0fb8bef2fb8a5459c55c3700521b70, type: 3}
railgunMuzzle: {fileID: 400000, guid: b16d97c287e513344af2399ff138cd27, type: 3}
railgunImpact: {fileID: 400010, guid: 2e92e894e0311c14c87f9544b2c88693, type: 3}
railgunOffset: 0
RailGunFireRate: 1
plasmagunProjectile: {fileID: 400000, guid: e7b84dec6cdbfb646a33fd06b85cf64e, type: 3}
plasmagunMuzzle: {fileID: 400002, guid: e4aff98840a58c94ea1cec28789d55d6, type: 3}
plasmagunImpact: {fileID: 400004, guid: ec543be1efaafca46aeac6f66e7a5ff0, type: 3}
@ -407,6 +418,7 @@ MonoBehaviour:
laserImpulseMuzzle: {fileID: 400004, guid: 45116fb1512dc704b99d70267628129a, type: 3}
laserImpulseImpact: {fileID: 400010, guid: ce59e020d922ccb43866dee1ba26a673, type: 3}
laserImpulseOffset: 0
LaserImpulseFireRate: 0.08
--- !u!1 &2236297877709258492
GameObject:
m_ObjectHideFlags: 0
@ -476,6 +488,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tackleKind: 1
hitKind: 1
OwnerId: 0
--- !u!1 &5993886774677081169
GameObject:
m_ObjectHideFlags: 0
@ -599,6 +613,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tackleKind: 0
hitKind: 1
OwnerId: 0
--- !u!1 &7841776443744888956
GameObject:
m_ObjectHideFlags: 0
@ -612,7 +628,7 @@ GameObject:
- component: {fileID: 2043393111525899212}
m_Layer: 6
m_Name: Wing Spike Right
m_TagString: Bumper
m_TagString: Spike
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -666,6 +682,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tackleKind: 3
hitKind: 1
OwnerId: 0
--- !u!1001 &123332957444049686
PrefabInstance:
m_ObjectHideFlags: 0
@ -678,6 +696,10 @@ PrefabInstance:
propertyPath: m_Name
value: Gravity Line Particles
objectReference: {fileID: 0}
- target: {fileID: 5747506880537754056, guid: 5075d8b26bc537c439b56964f382020e, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6894558316197621410, guid: 5075d8b26bc537c439b56964f382020e, type: 3}
propertyPath: m_LocalPosition.x
value: 0.21
@ -733,6 +755,124 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6894558316197621410, guid: 5075d8b26bc537c439b56964f382020e, type: 3}
m_PrefabInstance: {fileID: 123332957444049686}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &229984214571457430
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1483206452300237684}
m_Modifications:
- target: {fileID: 100000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Name
value: Explosion_004
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalPosition.x
value: -0.19
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalPosition.y
value: 10
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalPosition.z
value: -2.33
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800006, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800008, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800010, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19900000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19900002, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19900004, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19900006, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19900008, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19900010, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
--- !u!4 &229984214571581718 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: 5c66aaebaed6ae54183b4e93cfbc6397, type: 3}
m_PrefabInstance: {fileID: 229984214571457430}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &754241372986275310
PrefabInstance:
m_ObjectHideFlags: 0
@ -891,7 +1031,11 @@ PrefabInstance:
- target: {fileID: -1642744634756266859, guid: 40527c707fffde84c99533c25bbcd8cd, type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: -876546973899608171, guid: 894e255bca895714c929238ea0e6273f, type: 3}
objectReference: {fileID: 2100000, guid: 639bed6bda2055648971726bd8332cdd, type: 2}
- target: {fileID: -1642744634756266859, guid: 40527c707fffde84c99533c25bbcd8cd, type: 3}
propertyPath: m_Materials.Array.data[2]
value:
objectReference: {fileID: 2100000, guid: 639bed6bda2055648971726bd8332cdd, type: 2}
- target: {fileID: 919132149155446097, guid: 40527c707fffde84c99533c25bbcd8cd, type: 3}
propertyPath: m_Name
value: Spaceship9
@ -914,7 +1058,10 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: 40527c707fffde84c99533c25bbcd8cd, type: 3}
insertIndex: 0
addedObject: {fileID: 229984214571581718}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 40527c707fffde84c99533c25bbcd8cd, type: 3}
--- !u!4 &1483206452300237684 stripped
@ -1061,3 +1208,88 @@ Transform:
m_CorrespondingSourceObject: {fileID: 1163423376577002641, guid: 98bf6d3624da8d54fbe33787e003ef60, type: 3}
m_PrefabInstance: {fileID: 3400143175839768829}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5129966346685213162
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 5042970769659716555}
m_Modifications:
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalPosition.y
value: 0.89
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1433869235799878920, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: InitialModule.startSize.scalar
value: 4
objectReference: {fileID: 0}
- target: {fileID: 1688142635078887856, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_Name
value: Damage Number Particles
objectReference: {fileID: 0}
- target: {fileID: 8942704905475208125, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: m_LocalPosition.x
value: 9.68
objectReference: {fileID: 0}
- target: {fileID: 8998653663058390184, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
propertyPath: orthographic size
value: 1.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
--- !u!4 &5050929403426359679 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 83823186229895317, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
m_PrefabInstance: {fileID: 5129966346685213162}
m_PrefabAsset: {fileID: 0}
--- !u!114 &8926071544545039189 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4390600555810339519, guid: fa6fb11e8d54f60449c0897cec7a4fe1, type: 3}
m_PrefabInstance: {fileID: 5129966346685213162}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7f5b9ad63738dc8438abe06fa4b82dc1, type: 3}
m_Name:
m_EditorClassIdentifier:

File diff suppressed because it is too large Load Diff

View File

@ -591,9 +591,9 @@ MonoBehaviour:
startCamera: {fileID: 1164443743}
CurrentScene: 0
IsTestRun: 1
TestScene: 4
TestScene: 3
TestSceneRule: 0
TestSceneArena: 2
TestSceneArena: 0
--- !u!1 &1342452914 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 9107523058192353959, guid: 804560ce9f2dde14882eb0cc1c63544c, type: 3}

View File

@ -238,17 +238,14 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b0ad2719b50ab2e4fb1a22d64156b9d6, type: 3}
m_Name:
m_EditorClassIdentifier:
boostCapacities:
- {fileID: 1950397573}
- {fileID: 723891192}
- {fileID: 1472618151}
- {fileID: 1501063438}
joinPrompts:
- {fileID: 886944251}
- {fileID: 374405368}
- {fileID: 1686910811}
- {fileID: 630834206}
score: {fileID: 493939005}
LifeMeter: {fileID: 3108671383612270895, guid: 04bfe287c430f3f47b7ccfe564bd9ccd, type: 3}
BoostMeter: {fileID: 4707264354356972470, guid: c916febc93b44af43ab56b8a81680019, type: 3}
--- !u!1 &41121971
GameObject:
m_ObjectHideFlags: 0
@ -1234,17 +1231,17 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 465248643}
m_LocalRotation: {x: -0, y: -0, z: 1.1641532e-10, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1443571007}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 270}
m_SizeDelta: {x: 457, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 441.78}
m_SizeDelta: {x: -75, y: -441.77982}
m_Pivot: {x: 0, y: 0}
--- !u!114 &465248645
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1302,7 +1299,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -1328,7 +1325,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: -0.40989688, w: 0}
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
@ -2198,17 +2195,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7548755371474331641, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 723891190}
m_PrefabAsset: {fileID: 0}
--- !u!114 &723891192 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5281775441835194232, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 723891190}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e3ef46bd7908ba4b8fd45a5572217b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &754823974
GameObject:
m_ObjectHideFlags: 0
@ -2694,7 +2680,7 @@ Camera:
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 511
m_RenderingPath: 1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
@ -3945,17 +3931,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7548755371474331641, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 1472618149}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1472618151 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5281775441835194232, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 1472618149}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e3ef46bd7908ba4b8fd45a5572217b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1501063436
PrefabInstance:
m_ObjectHideFlags: 0
@ -4090,17 +4065,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7548755371474331641, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 1501063436}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1501063438 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5281775441835194232, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 1501063436}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e3ef46bd7908ba4b8fd45a5572217b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1686910807
GameObject:
m_ObjectHideFlags: 0
@ -5440,17 +5404,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7548755371474331641, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 2952306402587041938}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1950397573 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5281775441835194232, guid: ece147409d177604bb59e8bbd21316da, type: 3}
m_PrefabInstance: {fileID: 2952306402587041938}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e3ef46bd7908ba4b8fd45a5572217b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1986215050
GameObject:
m_ObjectHideFlags: 0
@ -5651,7 +5604,7 @@ Camera:
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 511
m_RenderingPath: 1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0

View File

@ -11301,7 +11301,7 @@ Camera:
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 511
m_RenderingPath: 1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0

View File

@ -10,6 +10,9 @@ using UnityEngine;
[CreateAssetMenu(fileName = "BaseShip", menuName = "ScriptableObjects/BaseShip")]
public class BaseShipProperties : ScriptableObject
{
[Header("Life")]
[Tooltip("The lifekind. Perchance.")]
public float MaximumHealth = 1000;
[Header("Basic Movement")]
[Tooltip("The acceleration applied on thrust input.")]
public float ThrustAcceleration = 2000;

View File

@ -19,6 +19,12 @@ public class ShipProperties : ScriptableObject
[Tooltip("The main color of the ship.")]
public Color ShipHullColor = Color.magenta;
[Tooltip("The lifekind. Perchance.")]
[Range(0.0f, 10.0f)]
public float healthModifier = 1;
[HideInInspector]
public float MaximumHealth => BaseProps.MaximumHealth * healthModifier;
[Tooltip("The acceleration applied on thrust input.")]
[Range(0.0f, 10.0f)]
public float thrustAccelerationModifier = 1;

View File

@ -12,6 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d4e63b7217e6a2f499d6da3911f6da33, type: 3}
m_Name: BaseShip
m_EditorClassIdentifier:
MaximumHealth: 1000
ThrustAcceleration: 2000
SteerVelocity: 360
NormalMaxVelocity: 15
@ -31,7 +32,7 @@ MonoBehaviour:
TacklingGraceTime: 0.6
TackledGraceTime: 0.6
TackledCriticalStunTime: 0.6
TackledBodyStunTime: 0.3
CriticalTacklePowerFactor: 60
NormalTacklePowerFactor: 40
TackledBodyStunTime: 0.4
CriticalTacklePowerFactor: 400
NormalTacklePowerFactor: 200
Audio: {fileID: 11400000, guid: 96db7e9f041aed7459cb776fddee1741, type: 2}

View File

@ -1,15 +1,24 @@
using System;
using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// Used on vulnerable trigger zones for ships.
/// </summary>
public class TackleDetection : MonoBehaviour
public class HitDetection : MonoBehaviour
{
[SerializeField] private TackleKind tackleKind;
public Action<TackleKind, Collider> TackledResponse;
public Action TacklingResponse;
[SerializeField] private HitKind hitKind = HitKind.IncomingNormal;
public Action<HitKind, ProjectileDamage> HitResponse;
//ID of Owner GameObject of this hit detecting zone
[HideInInspector]
public int OwnerId = 0;
void Awake()
{
OwnerId = transform.parent.gameObject.GetInstanceID();
}
/// <summary>
/// Invokes the fitting tackle response on trigger entered.
@ -40,8 +49,20 @@ public class TackleDetection : MonoBehaviour
TacklingResponse.Invoke();
break;
}
}
public void RegisterHit(ProjectileDamage damage)
{
HitResponse(hitKind, damage);
}
}
public enum TackleKind { IncomingCritical, IncomingNormal, OutgoingCritical, OutgoingNormal }
public enum TackleKind { IncomingCritical, IncomingNormal, OutgoingCritical, OutgoingNormal }
public enum HitKind { IncomingCritical, IncomingNormal }
public struct ProjectileDamage
{
public float DamageValue;
public float ImpactMagnitude;
public Vector3 ImpactPoint;
public Vector3 ImpactDirection;
}

View File

@ -18,6 +18,10 @@ using FishNet.Transporting;
public class PredictedShip : NetworkBehaviour, IHUDOwner
{
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event Action<float> BoostUpdated;
public event Action<float> LifeUpdated;
public int InstanceID { get; private set; }
public ShipProperties props;
public ShipState state;
@ -36,7 +40,7 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
private AffectingForcesManager forceManager;
// Saves the current input value for thrust
private bool canBoost = true;
private TackleDetection[] tackleDetectors;
private HitDetection[] tackleDetectors;
private bool isCriticalTackle = false;
private bool isTackled = false;
private float tackledTime = 0f;
@ -61,6 +65,7 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
public GameObject smoothedRepresentation;
private Rigidbody body;
void Awake()
{
if (forceManager == null)
@ -86,13 +91,13 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
void Start()
{
InstanceID = gameObject.GetInstanceID();
state.boostCapacity = props.MaxBoostCapacity;
state.BoostCapacity = props.MaxBoostCapacity;
// boostUI.SetMinBoostRatio(props.minBoostCapacity / props.maxBoostCapacity);
// GameManager.GM.RegisterPlayer(this);
cameraOperator.AddCharacter(smoothedRepresentation);
tackleDetectors = GetComponentsInChildren<TackleDetection>();
foreach (TackleDetection td in tackleDetectors)
tackleDetectors = GetComponentsInChildren<HitDetection>();
foreach (HitDetection td in tackleDetectors)
{
td.TackledResponse += TackledResponse;
td.TacklingResponse += TacklingResponse;
@ -114,11 +119,13 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
void OnDestroy()
{
ObjectCaches<PredictionRigidbody>.StoreAndDefault(ref PredictionRigidbody);
foreach (TackleDetection td in tackleDetectors)
foreach (HitDetection td in tackleDetectors)
{
td.TackledResponse = null;
td.TacklingResponse = null;
}
LifeUpdated = null;
BoostUpdated = null;
}
private void TimeManager_OnTick()
@ -145,8 +152,8 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
// // Get and apply the current Gravity
Transform gravitySource = forceManager.GetGravitySourceForInstance(InstanceID);
state.currentGravity = forceManager.GetGravityForInstance(InstanceID)(gravitySource, transform);
PredictionRigidbody.AddForce(state.currentGravity, ForceMode.Acceleration);
state.CurrentGravity = forceManager.GetGravityForInstance(InstanceID)(gravitySource, transform);
PredictionRigidbody.AddForce(state.CurrentGravity, ForceMode.Acceleration);
float stunFactor = isCriticalTackle ? props.StunLooseControlFactor : 1f;
@ -156,7 +163,7 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
Vector3 currentVelocity = body.velocity;
Vector3 boostedAcceleration = BoostAcceleration(acceleration, state.currentGravity);
Vector3 boostedAcceleration = BoostAcceleration(acceleration, state.CurrentGravity);
if (!isCriticalTackle)
{
@ -264,8 +271,8 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
// Get and apply the current Gravity
Transform gravitySource = forceManager.GetGravitySourceForInstance(InstanceID);
state.currentGravity = forceManager.GetGravityForInstance(InstanceID)(gravitySource, transform);
body.AddForce(state.currentGravity, ForceMode.Acceleration);
state.CurrentGravity = forceManager.GetGravityForInstance(InstanceID)(gravitySource, transform);
body.AddForce(state.CurrentGravity, ForceMode.Acceleration);
float stunFactor = isCriticalTackle ? props.StunLooseControlFactor : 1f;
@ -275,7 +282,7 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
Vector3 currentVelocity = body.velocity;
Vector3 boostedAcceleration = BoostAcceleration(acceleration, state.currentGravity);
Vector3 boostedAcceleration = BoostAcceleration(acceleration, state.CurrentGravity);
if (!isCriticalTackle)
{
@ -407,29 +414,29 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
/// <param name="deltaTime">Time delta of the current frame</param>
void BoostStateUpdate(float deltaTime)
{
BoostUI.UpdateFill(Math.Min(state.boostCapacity / props.MaxBoostCapacity, 1));
BoostUI.UpdateFill(Math.Min(state.BoostCapacity / props.MaxBoostCapacity, 1));
if (IsBoosting(input.boostInput))
{
state.boostCapacity -= deltaTime;
state.BoostCapacity -= deltaTime;
}
if (canBoost && zone == Zone.OutsideZone)
{
state.boostCapacity -= deltaTime * props.OutsideBoostRate;
state.BoostCapacity -= deltaTime * props.OutsideBoostRate;
}
if (state.boostCapacity <= 0)
if (state.BoostCapacity <= 0)
{
canBoost = false;
}
if ((input.boostInput <= 0 || !canBoost)
&& zone == Zone.NimbleZone
&& state.boostCapacity <= props.MaxBoostCapacity)
&& state.BoostCapacity <= props.MaxBoostCapacity)
{
state.boostCapacity += deltaTime;
state.BoostCapacity += deltaTime;
}
// When your boost capacity is still critical, you can't start boosting immediately again.
// TODO: This is not tested well enough with players.
if (canBoost == false && state.boostCapacity >= props.MinBoostCapacity)
if (canBoost == false && state.BoostCapacity >= props.MinBoostCapacity)
{
canBoost = true;
}
@ -567,7 +574,7 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
smokeTrailEffect.Play();
if (jetFlameEffect.isPlaying)
jetFlameEffect.transform.localScale = new Vector3(1.3f, 2, 1);
BoosterSound.PlayAudio(false, true);
BoosterSound.PlayAudio(false, 0.1f, true);
}
else
{
@ -577,12 +584,12 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
}
if (isTackled && !isCriticalTackle)
{
BeingTackledSound.PlayAudio(false, true);
BeingTackledSound.PlayAudio(false, 0, true);
cameraOperator.ShakeCam(0.2f);
}
if (isCriticalTackle)
{
BeingCriticallyTackledSound.PlayAudio(false, true);
BeingCriticallyTackledSound.PlayAudio(false, 0, true);
cameraOperator.ShakeCam(0.4f);
}
if (!isTackled)
@ -612,18 +619,18 @@ public class PredictedShip : NetworkBehaviour, IHUDOwner
{
return;
}
if (!gravityEffect.isPlaying && state.currentGravity != Vector3.zero)
if (!gravityEffect.isPlaying && state.CurrentGravity != Vector3.zero)
{
gravityEffect.Play();
}
else if (state.currentGravity == Vector3.zero)
else if (state.CurrentGravity == Vector3.zero)
{
gravityEffect.Stop();
}
if (gravityEffect.isPlaying)
{
float gravityAngle =
Vector3.SignedAngle(transform.parent.up, state.currentGravity, transform.forward);
Vector3.SignedAngle(transform.parent.up, state.CurrentGravity, transform.forward);
gravityEffect.gameObject.transform.localEulerAngles =
new Vector3(0, 0, gravityAngle - transform.localEulerAngles.z);

View File

@ -11,12 +11,15 @@ using System.Reflection;
using System.Collections.Generic;
using static ShipSound;
public class Ship : MonoBehaviour, IHUDOwner
public class Ship : MonoBehaviour, IHUDOwner, IDamageable
{
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event Action<float> BoostUpdated;
public event Action<float> LifeUpdated;
public int InstanceID { get; private set; }
public BoostCapacityUI BoostUI { get; set; }
public ShipProperties Props;
public ShipState State;
public ShipInput Input;
@ -26,23 +29,28 @@ public class Ship : MonoBehaviour, IHUDOwner
public ParticleSystem GravityEffect;
public ParticleSystem JetFlameEffect;
public ParticleSystem SmokeTrailEffect;
public DamageNumberParticles DamageParticleEffect;
public MeshRenderer BodyMeshRenderer;
private F3DFXController _fireController;
private AffectingForcesManager _forceManager;
private Rigidbody _body;
public Rigidbody _body;
// Saves the current input value for thrust
private bool _canBoost = true;
private TackleDetection[] _tackleDetectors;
private HitDetection[] _tackleDetectors;
private bool _isCriticalTackle = false;
private bool _isTackled = false;
private float _tackledTime = 0f;
private Tween _tackleIgnoreTween = new();
private float _lastTackleTime = 0f;
private readonly float _minHitDelay = 0.06f;
private float _lastHitTime = 0f;
// Upcoming zone change
private Zone newZone = Zone.NimbleZone;
private WeaponEffect equippedWeapon = WeaponEffect.None;
private Dictionary<ShipSound, ManageableAudio> sounds = new();
void Awake()
{
if (_forceManager == null)
@ -57,7 +65,8 @@ public class Ship : MonoBehaviour, IHUDOwner
void Start()
{
InstanceID = gameObject.GetInstanceID();
State.boostCapacity = Props.MaxBoostCapacity;
State.BoostCapacity = Props.MaxBoostCapacity;
State.RemainingHealth = Props.MaximumHealth;
// Get manageable audio instances for the ships sounds
foreach (ShipSoundToName stn in Props.Audio.shipSounds)
@ -71,21 +80,28 @@ public class Ship : MonoBehaviour, IHUDOwner
CameraOperator.AddCharacter(gameObject);
// Connect the tackling/tackled logic to the ships detection components
_tackleDetectors = GetComponentsInChildren<TackleDetection>();
foreach (TackleDetection td in _tackleDetectors)
_tackleDetectors = GetComponentsInChildren<HitDetection>();
foreach (HitDetection td in _tackleDetectors)
{
td.TackledResponse += TackledResponse;
td.TacklingResponse += TacklingResponse;
td.HitResponse += HitResponse;
}
LifeUpdated?.Invoke(1);
BoostUpdated?.Invoke(1);
}
void OnDestroy()
{
foreach (TackleDetection td in _tackleDetectors)
foreach (HitDetection td in _tackleDetectors)
{
td.TackledResponse = null;
td.TacklingResponse = null;
td.TackledResponse -= TackledResponse;
td.TacklingResponse -= TacklingResponse;
td.HitResponse -= HitResponse;
}
BoostUpdated = null;
LifeUpdated = null;
}
// Update is called once per frame
@ -97,6 +113,7 @@ public class Ship : MonoBehaviour, IHUDOwner
{
_body.constraints = RigidbodyConstraints.FreezeAll;
UpdateSounds();
UpdateFireWeapon(equippedWeapon);
State.Zone = newZone;
return;
}
@ -109,18 +126,35 @@ public class Ship : MonoBehaviour, IHUDOwner
UpdateMovement();
BoostStateUpdate(Time.deltaTime);
UpdateTackleResponse(_isCriticalTackle);
UpdateFireWeapon(equippedWeapon);
}
void UpdateFireWeapon(WeaponEffect weapon)
{
// Stop firing
if (State.IsFiring && Input.shootInput < 1 ||
State.IsFiring && MatchManager.G.matchState != MatchState.Match)
{
State.IsFiring = false;
_fireController.Stop();
}
if (weapon == WeaponEffect.None)
{
return;
}
if (_fireController.SelectedWeaponEffect != weapon)
{
_fireController.SelectedWeaponEffect = weapon;
}
if (!State.IsFiring && Input.shootInput == 1)
{
State.IsFiring = true;
_fireController.Fire();
}
// Stop firing
if (State.IsFiring && Input.shootInput < 1)
{
State.IsFiring = false;
_fireController.Stop();
}
}
/// <summary>
@ -129,24 +163,43 @@ public class Ship : MonoBehaviour, IHUDOwner
void UpdateMovement()
{
//Debug.Log("inupdatemove " + currentThrustInput);
// Player rotation is always possible and same speed
transform.Rotate(0, 0, -Props.SteerVelocity * Input.steerInput * Time.deltaTime);
float current_angle = transform.localEulerAngles.z;
Vector2 radial = -Input.radialInput;
float goal_angle = Vector2.SignedAngle(Vector2.up, radial) + 180;
float inputThrust = 0;
if (radial.magnitude > 0.05)
{
float angle_difference = ((goal_angle - current_angle + 180) % 360) - 180;
angle_difference = angle_difference < -180 ? angle_difference + 360 : angle_difference;
float sign = math.sign(angle_difference);
float rotation = Mathf.Min(math.abs(angle_difference), Props.SteerVelocity * radial.magnitude * Time.deltaTime);
transform.Rotate(0, 0, sign * rotation);
}
else
{
transform.Rotate(0, 0, Input.steerInput * -Props.SteerVelocity * Time.deltaTime);
}
inputThrust = Input.thrustInput > inputThrust ? Input.thrustInput : inputThrust;
// Get and apply the current Gravity
Transform gravitySource = _forceManager.GetGravitySourceForInstance(InstanceID);
State.currentGravity = _forceManager.GetGravityForInstance(InstanceID)(gravitySource, transform) * Props.GravitStrength;
_body.AddForce(State.currentGravity, ForceMode.Acceleration);
State.CurrentGravity = _forceManager.GetGravityForInstance(InstanceID)(gravitySource, transform) * Props.GravitStrength;
_body.AddForce(State.CurrentGravity, ForceMode.Acceleration);
float stunFactor = _isCriticalTackle ? Props.StunLooseControlFactor : 1f;
float thrust = IsBoosting() ? 1f : Input.thrustInput;
float thrust = IsBoosting() ? 1f : inputThrust;
Vector3 acceleration = Props.ThrustAcceleration * thrust * Time.deltaTime
* transform.up * stunFactor;
Vector3 currentVelocity = _body.velocity;
Vector3 boostedAcceleration = BoostAcceleration(acceleration, State.currentGravity);
Vector3 boostedAcceleration = BoostAcceleration(acceleration, State.CurrentGravity);
if (!_isCriticalTackle)
{
@ -280,29 +333,29 @@ public class Ship : MonoBehaviour, IHUDOwner
/// <param name="deltaTime">Time delta of the current frame</param>
void BoostStateUpdate(float deltaTime)
{
BoostUI.UpdateFill(Math.Min(State.boostCapacity / Props.MaxBoostCapacity, 1));
BoostUpdated?.Invoke(State.BoostCapacity / Props.MaxBoostCapacity);
if (IsBoosting())
{
State.boostCapacity -= deltaTime;
State.BoostCapacity -= deltaTime;
}
if (_canBoost && State.Zone == Zone.OutsideZone)
{
State.boostCapacity -= deltaTime * Props.OutsideBoostRate;
State.BoostCapacity -= deltaTime * Props.OutsideBoostRate;
}
if (State.boostCapacity <= 0)
if (State.BoostCapacity <= 0)
{
_canBoost = false;
}
if ((Input.boostInput <= 0 || !_canBoost)
&& State.Zone == Zone.NimbleZone
&& State.boostCapacity <= Props.MaxBoostCapacity)
&& State.BoostCapacity <= Props.MaxBoostCapacity)
{
State.boostCapacity += deltaTime;
State.BoostCapacity += deltaTime;
}
// When your boost capacity is still critical, you can't start boosting immediately again.
// TODO: This is not tested well enough with players.
if (_canBoost == false && State.boostCapacity >= Props.MinBoostCapacity)
if (_canBoost == false && State.BoostCapacity >= Props.MinBoostCapacity)
{
_canBoost = true;
}
@ -333,31 +386,25 @@ public class Ship : MonoBehaviour, IHUDOwner
}
}
/// <summary>
/// Disable tackle responeses for a given time
/// </summary>
async void TemporarilyIgnoreTackles(float duration)
{
if (_tackleIgnoreTween.isAlive)
return;
_tackleIgnoreTween = Tween.Delay(duration);
await _tackleIgnoreTween;
}
private bool IgnoreTackle()
{
return _tackleIgnoreTween.isAlive;
}
/// <summary>
/// Response logic if the ship is tackling an opponend.
/// </summary>
void TacklingResponse()
{
if (IgnoreTackle())
if (IgnoreTackles())
return;
Log.Debug($"{Props.ShipName} is tackling.");
TemporarilyIgnoreTackles(Props.TacklingGraceTime);
}
bool IgnoreTackles()
{
if (Time.time < _lastTackleTime + Props.TackledGraceTime)
{
return true;
}
_lastTackleTime = Time.time;
return false;
}
/// <summary>
@ -368,41 +415,61 @@ public class Ship : MonoBehaviour, IHUDOwner
/// <param name="collider">Object which has collided with the collision region.</param>
void TackledResponse(TackleKind tackleKind, Collider collider)
{
if (IgnoreTackle())
if (IgnoreTackles())
return;
TemporarilyIgnoreTackles(Props.TackledGraceTime);
float damage = 0;
float tacklePowerFactor = Props.CriticalTacklePowerFactor;
if (tackleKind == TackleKind.IncomingCritical)
{
_isCriticalTackle = true;
damage = 450;
Log.Debug($"{Props.ShipName} has been tackled critically.");
}
else if (tackleKind == TackleKind.IncomingNormal)
{
_isCriticalTackle = false;
damage = 100;
tacklePowerFactor = Props.NormalTacklePowerFactor;
Log.Debug($"{Props.ShipName} has been tackled.");
}
Vector3 colliderVelocity = collider.attachedRigidbody.velocity;
//Log.Debug("velocity " + colliderVelocity);
Vector3 colliderVelocity = collider.attachedRigidbody.velocity - _body.velocity;
//Log.Debug("angle " + angle);
//Log.Debug("outvector " + outVector);
Vector3 force = colliderVelocity * tacklePowerFactor;
Vector3 resultForce = force / Math.Max(force.magnitude / 4000, 1);
resultForce = resultForce / Math.Max(0.001f, Math.Min(resultForce.magnitude / 500, 1));
Log.Debug(resultForce.magnitude);
_body.AddForce(resultForce,
ForceMode.Acceleration);
InflictDamage(damage);
DamageParticleEffect.SpawnDamageNumber((int)damage, colliderVelocity / 2);
UpdateTackleResponse(true);
}
public void HitResponse(HitKind hitKind, ProjectileDamage damage)
{
if (Time.time < _lastHitTime + _minHitDelay)
{
return;
}
_lastHitTime = Time.time;
InflictDamage(damage.DamageValue);
Log.Info("particle spawned");
DamageParticleEffect.SpawnDamageNumber((int)damage.DamageValue, damage.ImpactDirection);
_body.AddForce(damage.ImpactDirection * damage.ImpactMagnitude, ForceMode.Impulse);
if ((this as IDamageable).IsKilled())
{
MatchManager.G.UpdateMatchCondition(new MatchConditionUpdate
{
Condition = WinCondition.Lives,
Ship = this,
Count = -1
});
}
}
void UpdateSounds()
{
if (MatchManager.G.matchState != MatchState.Match || State.IsFrozen)
@ -440,7 +507,7 @@ public class Ship : MonoBehaviour, IHUDOwner
SmokeTrailEffect.Play();
if (JetFlameEffect.isPlaying)
JetFlameEffect.transform.localScale = new Vector3(1.3f, 2, 1);
sounds[Booster].PlayAudio(false, true);
sounds[Booster].PlayAudio(false, 0.1f, true);
}
else
{
@ -450,12 +517,12 @@ public class Ship : MonoBehaviour, IHUDOwner
}
if (_isTackled && !_isCriticalTackle)
{
sounds[Tackling].PlayAudio(false, true);
sounds[Tackling].PlayAudio(false, 0, true);
CameraOperator.ShakeCam(0.2f);
}
if (_isCriticalTackle)
{
sounds[TacklingCritical].PlayAudio(false, true);
sounds[TacklingCritical].PlayAudio(false, 0, true);
CameraOperator.ShakeCam(0.4f);
}
if (!_isTackled)
@ -485,22 +552,58 @@ public class Ship : MonoBehaviour, IHUDOwner
{
return;
}
if (!GravityEffect.isPlaying && State.currentGravity != Vector3.zero)
if (!GravityEffect.isPlaying && State.CurrentGravity != Vector3.zero)
{
GravityEffect.Play();
}
else if (State.currentGravity == Vector3.zero)
else if (State.CurrentGravity == Vector3.zero)
{
GravityEffect.Stop();
}
if (GravityEffect.isPlaying)
{
float gravityAngle =
Vector3.SignedAngle(transform.parent.up, State.currentGravity, transform.forward);
Vector3.SignedAngle(transform.parent.up, State.CurrentGravity, transform.forward);
GravityEffect.gameObject.transform.localEulerAngles =
new Vector3(0, 0, gravityAngle - transform.localEulerAngles.z);
}
}
public void EquipWeapon(WeaponEffect weapon)
{
if (equippedWeapon != WeaponEffect.None)
{
_fireController.Stop();
}
equippedWeapon = weapon;
}
public float CurrentHealth()
{
return State.RemainingHealth;
}
public float MaximumHealth()
{
return Props.MaximumHealth;
}
public void SetHealth(float totalValue)
{
State.RemainingHealth = totalValue;
LifeUpdated?.Invoke(CurrentHealth() / MaximumHealth());
}
public void InflictDamage(float damageValue)
{
SetHealth(CurrentHealth() - damageValue);
}
public void ReplenishHealth(float healValue)
{
SetHealth(CurrentHealth() + healValue);
}
}

View File

@ -1,4 +1,3 @@
using FishNet.Object.Prediction;
using UnityEngine;
namespace ShipHandling
@ -13,5 +12,6 @@ namespace ShipHandling
public float shootInput = 0;
// Saves the current input for steering
public float steerInput = 0;
public Vector2 radialInput = new Vector2();
}
}

View File

@ -9,12 +9,12 @@ namespace ShipHandling
/// </summary>
public class ShipState
{
public float boostCapacity;
public Vector3 currentGravity = new Vector3();
public float BoostCapacity;
public Vector3 CurrentGravity = new Vector3();
public float RemainingHealth = 1;
public bool IsFrozen = false;
public bool IsFiring = false;
public Zone Zone;
public bool reset = false;
}
public struct ReplicateData : IReplicateData

View File

@ -0,0 +1,22 @@
using System;
public interface IDamageable
{
public float CurrentHealth();
public float MaximumHealth();
public void InflictDamage(float damageValue);
public void ReplenishHealth(float healValue);
public void SetHealth(float totalValue);
public bool IsKilled()
{
if (CurrentHealth() <= 0)
{
return true;
}
return false;
}
public void ResetHealth()
{
SetHealth(MaximumHealth());
}
}

View File

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

View File

@ -1,4 +1,7 @@
using System;
public interface IHUDOwner
{
public BoostCapacityUI BoostUI { get; set; }
public event Action<float> BoostUpdated;
public event Action<float> LifeUpdated;
}

View File

@ -1,4 +1,5 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Users;
using static InputActionMaps;
@ -56,6 +57,10 @@ namespace ShipHandling
{
input.shootInput = context.ReadValue<float>();
}
public void OnRadial(InputAction.CallbackContext context)
{
input.radialInput = context.ReadValue<Vector2>();
}
public void Dispose()
{

View File

@ -56,7 +56,7 @@ public class ManageableAudio : MonoBehaviour
/// </summary>
/// <param name="playLooping">Should the sound loop</param>
/// <param name="isOneShot">Play sound only once until reset</param>
public void PlayAudio(bool playLooping, bool isOneShot = false)
public void PlayAudio(bool playLooping, float randomPitchRange = 0f, bool isOneShot = false)
{
if (AudioSource == null
|| IsUpdating
@ -71,6 +71,11 @@ public class ManageableAudio : MonoBehaviour
}
AudioSource.enabled = true;
AudioSource.loop = playLooping;
if (randomPitchRange != 0)
{
AudioSource.pitch =
UnityEngine.Random.Range(initialPitch - randomPitchRange, initialPitch + randomPitchRange);
}
AudioSource.Play();
}

View File

@ -20,7 +20,7 @@ public class AffectingForcesManager : MonoBehaviour
return zoneInhabitants[id];
}
public void IntroduceImpulseForce(int instanceID, Vector3 force)
public void IntroduceForce(int instanceID, Vector3 force)
{
if (!impulseForces.ContainsKey(instanceID))
{
@ -43,7 +43,7 @@ public class AffectingForcesManager : MonoBehaviour
currentGravitySource[instanceID] = gravitySource;
}
public Vector3 GetImpulseForInstance(int instanceID)
public Vector3 GetForceForInstance(int instanceID)
{
if (impulseForces.ContainsKey(instanceID))
{

View File

@ -179,6 +179,11 @@ public class ControlSchemeDetection : IPlayerActions
readControlScheme(context);
}
public void OnRadial(InputAction.CallbackContext context)
{
readControlScheme(context);
}
public void OnSteer(InputAction.CallbackContext context)
{
readControlScheme(context);
@ -205,4 +210,5 @@ public class ControlSchemeDetection : IPlayerActions
ControlSchemeDetected.Invoke(this, new UniqueControl(controlScheme,
context.control.device.deviceId));
}
}

View File

@ -185,7 +185,6 @@ namespace Managers
MatchCamera.GetComponent<CameraOperator>().RemoveCharacter(mps.Key.spawnedCharacter);
mps.Key.spawnedCharacter.TryGetComponent(out Ship ship);
ship.State.IsFrozen = true;
ship.BoostUI.SetIsOut(mps.Key);
}
}
}
@ -444,11 +443,13 @@ namespace Managers
shipGO.TryGetComponent(out Ship ship);
shipGO.TryGetComponent(out Rigidbody body);
ship.BoostUI.SetIsIn(mp);
MatchCamera.GetComponent<CameraOperator>().AddCharacter(shipGO);
ship.State.IsFrozen = false;
ship.State.boostCapacity = ship.Props.MaxBoostCapacity;
ship.State.BoostCapacity = ship.Props.MaxBoostCapacity;
ship.SetHealth(ship.Props.MaximumHealth);
ship.EquipWeapon(FORGE3D.WeaponEffect.None);
body.velocity = Vector3.zero;

View File

@ -29,13 +29,13 @@ namespace Managers
public void AddFreeFlightScore(int score)
{
FreeFlightScore += score;
UIManager.G.hUD.UpdateScore(FreeFlightScore);
UIManager.G.HUD.UpdateScore(FreeFlightScore);
}
public void ResetScore()
{
FreeFlightScore = 0;
UIManager.G.hUD.UpdateScore(FreeFlightScore);
UIManager.G.HUD.UpdateScore(FreeFlightScore);
}
}
}

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Reflection;
using GameKit.Dependencies.Utilities;
using log4net;
using UnityEngine;
@ -12,12 +13,14 @@ namespace Managers
{
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
[SerializeField] public bool IsUIActiveScene { get; set; }
public HUD hUD { get; private set; }
public HUD HUD { get; private set; }
public Announcments Announcments { get; private set; }
public PauseMenu PauseMenu { get; private set; }
public MatchEndMenu MatchEndMenu { get; private set; }
public OffScreenIndicatorManager OffScreenManager;
public ManageableAudio MatchMusic;
/// <summary>
/// Globally accessible member to use manager with.
/// </summary>
@ -42,7 +45,7 @@ namespace Managers
public bool StartManagingHUD()
{
if (hUD == null)
if (HUD == null)
{
GameObject go = GameObject.Find("HUD");
if (go == null)
@ -50,7 +53,7 @@ namespace Managers
Log.Error("Could not find HUD GameObject in loaded scenes!");
return false;
}
hUD = go.GetComponent<HUD>();
HUD = go.GetComponent<HUD>();
}
return true;
}
@ -105,9 +108,34 @@ namespace Managers
foreach (Player p in players)
{
IHUDOwner s = p.spawnedCharacter.GetComponent<IHUDOwner>();
s.BoostUI = hUD.boostCapacities[p.playerNumber - 1].GetComponent<BoostCapacityUI>();
s.BoostUI.SetPlayerName(p);
s.BoostUI.gameObject.SetActive(true);
// var BoostUI = HUD.boostCapacities[p.playerNumber - 1].GetComponent<BoostCapacityUI>();
// BoostUI.SetPlayerName(p);
// BoostUI.gameObject.SetActive(true);
// s.BoostUpdated += BoostUI.UpdateFill;
GameObject lm = Instantiate(HUD.LifeMeter);
Vector3 pos = lm.transform.localPosition;
Vector3 angles = lm.transform.localEulerAngles;
Vector3 scale = lm.transform.localScale;
lm.transform.SetParent(p.spawnedCharacter.transform);
lm.transform.localPosition = pos;
lm.transform.localEulerAngles = angles;
lm.transform.localScale = scale;
var LifeMeter = lm.GetComponent<SegmentIndicator>();
s.LifeUpdated += LifeMeter.SetFill;
GameObject bm = Instantiate(HUD.BoostMeter);
pos = bm.transform.localPosition;
angles = bm.transform.localEulerAngles;
scale = bm.transform.localScale;
bm.transform.SetParent(p.spawnedCharacter.transform);
bm.transform.localPosition = pos;
bm.transform.localEulerAngles = angles;
bm.transform.localScale = scale;
var BoostMeter = bm.GetComponent<SegmentIndicator>();
s.BoostUpdated += BoostMeter.SetFill;
OffScreenManager.AddTarget(p.spawnedCharacter, p.character.ShipHullColor);
}
// TODO: This belongs somewhere?
MatchMusic = AudioManager.G.GetGlobalSoundRandom("match_music", true);
@ -118,7 +146,7 @@ namespace Managers
{
foreach (int playerNumber in unassignedPlayers.Keys)
{
hUD.StartJoinPrompt(unassignedPlayers[playerNumber]);
HUD.StartJoinPrompt(unassignedPlayers[playerNumber]);
}
}
@ -133,34 +161,34 @@ namespace Managers
public void ShowPauseMenu(Transform transform)
{
hUD?.Hide();
HUD?.Hide();
PauseMenu?.Show(transform);
}
public void HidePauseMenu()
{
PauseMenu?.Hide();
hUD?.Show();
HUD?.Show();
}
public void ShowMatchEndMenu(Transform transform)
{
hUD?.Hide();
HUD?.Hide();
MatchEndMenu?.Show(transform);
}
public void HideMatchEndMenu()
{
MatchEndMenu?.Hide();
hUD?.Show();
HUD?.Show();
}
public void ShowHUD()
{
hUD?.Show();
HUD?.Show();
}
public void HideHUD()
{
hUD?.Hide();
HUD?.Hide();
}
}
}

View File

@ -64,7 +64,7 @@ public class MatchEndMenu : MonoBehaviour
public void OnRematch()
{
MatchManager.G.StartRematch();
UIManager.G.hUD?.Show();
UIManager.G.HUD?.Show();
Hide();
}

View File

@ -12,7 +12,7 @@ https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.re
// You can spawn and edit a ripple on the surface manually over the inspector
// or use the properties accessible via script, to spawn and animate up to 5 waves simultaneously.
Shader "CustomShaders/GlossyPBRRipples" {
Shader "CustomShaders/URPLitRipples" {
Properties {
// In the regular URP shaders provided by unity, a custom shader GUI manages

View File

@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1107 &-2602967340271623804
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: 7658566830235223166}
m_Position: {x: 200, y: 0, 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: 7658566830235223166}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Spaceship9_Hull
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -2602967340271623804}
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 &7658566830235223166
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ShipDeath
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: 067a1c656ca2031478f9dcf5add13e8b, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:

View File

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

View File

@ -2,7 +2,7 @@
"dependencies": {
"com.gasgiant.camera-shake": "https://github.com/gasgiant/Camera-Shake.git#upm",
"com.kyrylokuzyk.primetween": "file:../Assets/Plugins/PrimeTween/internal/com.kyrylokuzyk.primetween.tgz",
"com.singularitygroup.hotreload": "git+https://gitlab.hotreload.net/root/hot-reload-releases.git",
"com.singularitygroup.hotreload": "git+https://gitlab.hotreload.net/root/hot-reload-releases.git#1.12.10",
"com.unity.2d.sprite": "1.0.0",
"com.unity.adaptiveperformance": "5.0.2",
"com.unity.cloud.gltfast": "6.0.1",
@ -50,4 +50,4 @@
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
}
}

View File

@ -14,14 +14,14 @@
"dependencies": {}
},
"com.singularitygroup.hotreload": {
"version": "git+https://gitlab.hotreload.net/root/hot-reload-releases.git",
"version": "git+https://gitlab.hotreload.net/root/hot-reload-releases.git#1.12.10",
"depth": 0,
"source": "git",
"dependencies": {
"com.unity.ugui": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0"
},
"hash": "15115347b80179b483f7f4022c18fe48604dee8d"
"hash": "718d71c8e79b15ee45341fe5bc3a24148904f9e9"
},
"com.unity.2d.sprite": {
"version": "1.0.0",

View File

@ -140,7 +140,9 @@ PlayerSettings:
visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0
bundleVersion: 0.1
preloadedAssets: []
preloadedAssets:
- {fileID: 11400000, guid: 7d6dd64b5f2213d4f8cc395ae58ffb43, type: 2}
- {fileID: -4938997134116425971, guid: 4b98f800e99c70140ac675a637d71d3a, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

View File

@ -20,7 +20,7 @@ TagManager:
- Collider
- Detector
- Character
-
- SeperatlyRendered
-
-
-