Trail improved and pickups complete
This commit is contained in:
parent
1cd3453199
commit
653f70db9e
|
|
@ -25,7 +25,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 218370722472934257}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0.04, y: -0.13, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0.7, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5431987895404559666}
|
||||
|
|
@ -51,7 +51,7 @@ TrailRenderer:
|
|||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a4ba6452393c9934fbda3b88896675cc, type: 2}
|
||||
- {fileID: 2100000, guid: 41e9749fbfcb2214f8ce3b9b2bdca971, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
|
|
@ -75,7 +75,7 @@ TrailRenderer:
|
|||
m_Time: 1
|
||||
m_Parameters:
|
||||
serializedVersion: 3
|
||||
widthMultiplier: 1
|
||||
widthMultiplier: 1.5
|
||||
widthCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
|
|
@ -88,13 +88,31 @@ TrailRenderer:
|
|||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 0.11501191
|
||||
value: 0.8683766
|
||||
inSlope: -3.5738087
|
||||
outSlope: -3.5738087
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.37297413
|
||||
outWeight: 0.07407034
|
||||
- serializedVersion: 3
|
||||
time: 0.95363426
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
colorGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0.779325, b: 1, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key0: {r: 1, g: 0.6725613, b: 0, a: 1}
|
||||
key1: {r: 1, g: 0.8624264, b: 0, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
|
@ -333,6 +351,8 @@ MonoBehaviour:
|
|||
trailTime: 0
|
||||
trailIncrementRate: 0.5
|
||||
dead: 0
|
||||
speed: 0
|
||||
scaleMultiplier: 1
|
||||
pnameTxt: {fileID: 1318931860792545326}
|
||||
body: {fileID: 5431987895376475546}
|
||||
trailMgr: {fileID: 5995183602835295541}
|
||||
|
|
@ -340,6 +360,7 @@ MonoBehaviour:
|
|||
turningSmoothFactor: 0.1
|
||||
joystick: {fileID: 0}
|
||||
joyInput: {x: 0, y: 0}
|
||||
boosting: 0
|
||||
DetourError: {x: 0, y: 0, z: 0}
|
||||
Detour: {x: 0, y: 0, z: 0}
|
||||
RotationDetour: {x: 0, y: 0, z: 0, w: 1}
|
||||
|
|
@ -622,7 +643,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5761916000209272731}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0.7, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5431987895404559666}
|
||||
|
|
@ -667,7 +688,7 @@ LineRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: -1
|
||||
m_SortingOrder: -100
|
||||
m_Positions:
|
||||
- {x: 0, y: 0, z: 0}
|
||||
- {x: 0, y: 0, z: 1}
|
||||
|
|
@ -691,8 +712,8 @@ LineRenderer:
|
|||
m_RotationOrder: 4
|
||||
colorGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 1, g: 1, b: 1, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key0: {r: 1, g: 1, b: 1, a: 0}
|
||||
key1: {r: 1, g: 1, b: 1, a: 0}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
|
|
|||
121
Assets/Game/Prefabs/Minigame/moon.prefab
Normal file
121
Assets/Game/Prefabs/Minigame/moon.prefab
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &5339383961425506408
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5339383961425506410}
|
||||
- component: {fileID: 5339383961425506411}
|
||||
- component: {fileID: 8862726799114382727}
|
||||
- component: {fileID: 7368969607850894879}
|
||||
m_Layer: 0
|
||||
m_Name: moon
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5339383961425506410
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5339383961425506408}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -6.7888474, y: 0.42275238, z: 0}
|
||||
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &5339383961425506411
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5339383961425506408}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 0d366138e9d9db041ae284085f5c9b83, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 16.5, y: 16.5}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &8862726799114382727
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5339383961425506408}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sceneId: 0
|
||||
serverOnly: 0
|
||||
visible: 0
|
||||
m_AssetId: ad54ea1b437d2b344add56c18d1efb3e
|
||||
hasSpawned: 0
|
||||
--- !u!114 &7368969607850894879
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5339383961425506408}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: afb8c8ecfb1028546b4ee5775cc5edfe, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
syncMode: 0
|
||||
syncInterval: 0.1
|
||||
type: 1
|
||||
radius: 1.51
|
||||
gizmoColor: {r: 0, g: 1, b: 0, a: 1}
|
||||
active: 1
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b8f43d6a3a874fe10811a1d270417026
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
fileFormatVersion: 2
|
||||
guid: ad54ea1b437d2b344add56c18d1efb3e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
121
Assets/Game/Prefabs/Minigame/star.prefab
Normal file
121
Assets/Game/Prefabs/Minigame/star.prefab
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &8298505072154104440
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8298505072154104442}
|
||||
- component: {fileID: 8298505072154104443}
|
||||
- component: {fileID: 3666409252232254530}
|
||||
- component: {fileID: 6329334438258147901}
|
||||
m_Layer: 0
|
||||
m_Name: star
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8298505072154104442
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8298505072154104440}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &8298505072154104443
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8298505072154104440}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 8985e9643075caf4fbbbda8f22e5045b, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 3, y: 3}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &3666409252232254530
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8298505072154104440}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sceneId: 0
|
||||
serverOnly: 0
|
||||
visible: 0
|
||||
m_AssetId: 8cfd89c315493e64782e167885b4b498
|
||||
hasSpawned: 0
|
||||
--- !u!114 &6329334438258147901
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8298505072154104440}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: afb8c8ecfb1028546b4ee5775cc5edfe, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
syncMode: 0
|
||||
syncInterval: 0.1
|
||||
type: 0
|
||||
radius: 0.31
|
||||
gizmoColor: {r: 0, g: 1, b: 0, a: 1}
|
||||
active: 1
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bd0a49e5acaf813e8b3617e1d9bec844
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
fileFormatVersion: 2
|
||||
guid: 8cfd89c315493e64782e167885b4b498
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -246,6 +246,36 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 37150596}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &41572334
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 41572335}
|
||||
m_Layer: 0
|
||||
m_Name: Pickups
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &41572335
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 41572334}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.4937299, y: 0.69522977, z: -3.4301062}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 9
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &42724089
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -319,7 +349,9 @@ MonoBehaviour:
|
|||
playerPrefab: {fileID: 5431987895376475548, guid: e811a838f2ebb2f4fb8055331ed295e9, type: 3}
|
||||
autoCreatePlayer: 1
|
||||
playerSpawnMethod: 0
|
||||
spawnPrefabs: []
|
||||
spawnPrefabs:
|
||||
- {fileID: 5339383961425506408, guid: ad54ea1b437d2b344add56c18d1efb3e, type: 3}
|
||||
- {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
||||
--- !u!4 &42724092
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -588,7 +620,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 332697607}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -16.873886, y: 288.569, z: -13.784264}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
|
@ -608,6 +640,14 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
syncMode: 0
|
||||
syncInterval: 0.1
|
||||
mapRadius: 500
|
||||
maxMoons: 700
|
||||
maxStars: 1000
|
||||
pickupItemsParent: {fileID: 41572335}
|
||||
ActiveMoons: []
|
||||
ActiveStars: []
|
||||
moon: {fileID: 5339383961425506408, guid: ad54ea1b437d2b344add56c18d1efb3e, type: 3}
|
||||
star: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
||||
--- !u!114 &332697611
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1388,6 +1428,8 @@ MonoBehaviour:
|
|||
autoOffset: 0
|
||||
offset: {x: 0, y: 0, z: -10}
|
||||
target: {fileID: 0}
|
||||
minFOV: 11
|
||||
FOVmultiplier: 5
|
||||
smoothness: 2.5
|
||||
--- !u!1 &697893402
|
||||
GameObject:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,71 @@ using Mirror;
|
|||
|
||||
public class MinigameManager : NetworkBehaviour
|
||||
{
|
||||
public float mapRadius;
|
||||
public int maxMoons, maxStars = 100;
|
||||
public Transform pickupItemsParent;
|
||||
public List<PickupItem> ActiveMoons = new List<PickupItem>();
|
||||
public List<PickupItem> ActiveStars = new List<PickupItem>();
|
||||
List<PickupItem> MoonPool = new List<PickupItem>();
|
||||
List<PickupItem> StarsPool = new List<PickupItem>();
|
||||
public GameObject moon;
|
||||
public GameObject star;
|
||||
|
||||
private void Awake() {
|
||||
SceneData.GameManager=this;
|
||||
}
|
||||
|
||||
void Update(){
|
||||
|
||||
if(!isServer){return;}
|
||||
|
||||
int moonsNeed = maxMoons - ActiveMoons.Count;
|
||||
int starsNeed = maxStars - ActiveStars.Count;
|
||||
|
||||
if(moonsNeed > 0){ // <-- We need more moons!
|
||||
for(int i =0; i < moonsNeed; i++){
|
||||
if(MoonPool.Count > 0){ // <-- Got some in the pool, no need to spawn new
|
||||
PickupItem pickedMoon = MoonPool[0];
|
||||
pickedMoon.Reposition(getRandomPositionOnMap());
|
||||
|
||||
ActiveMoons.Add(pickedMoon);
|
||||
MoonPool.RemoveAt(0);
|
||||
}else{
|
||||
GameObject newMoon = Instantiate(moon,pickupItemsParent);
|
||||
NetworkServer.Spawn(newMoon);
|
||||
newMoon.GetComponent<PickupItem>().Reposition(getRandomPositionOnMap());
|
||||
ActiveMoons.Add(newMoon.GetComponent<PickupItem>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(starsNeed > 0){ // <-- We need more moons!
|
||||
for(int i =0; i < starsNeed; i++){
|
||||
if(StarsPool.Count > 0){ // <-- Got some in the pool, no need to spawn new
|
||||
PickupItem pickedStar = StarsPool[0];
|
||||
pickedStar.Reposition(getRandomPositionOnMap());
|
||||
|
||||
ActiveStars.Add(pickedStar);
|
||||
StarsPool.RemoveAt(0);
|
||||
}else{
|
||||
GameObject newStar = Instantiate(star,pickupItemsParent);
|
||||
NetworkServer.Spawn(newStar);
|
||||
newStar.GetComponent<PickupItem>().Reposition(getRandomPositionOnMap());
|
||||
ActiveStars.Add(newStar.GetComponent<PickupItem>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DeactivatePickupItem(PickupItem item){
|
||||
if(item.type == PickupItem.PickupType.Moon){
|
||||
ActiveMoons.Remove(item);
|
||||
MoonPool.Add(item);
|
||||
}else if(item.type == PickupItem.PickupType.Star){
|
||||
ActiveStars.Remove(item);
|
||||
StarsPool.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRespawn(GameObject player){
|
||||
StartCoroutine(setRespawn(player));
|
||||
|
|
@ -21,4 +86,12 @@ public class MinigameManager : NetworkBehaviour
|
|||
yield return new WaitForSeconds(1);
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 getRandomPositionOnMap(){
|
||||
return new Vector3(Random.Range(-mapRadius, mapRadius), Random.Range(-mapRadius,mapRadius));
|
||||
}
|
||||
|
||||
void OnDrawGizmos() {
|
||||
Gizmos.DrawWireSphere(transform.position, mapRadius);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
91
Assets/Game/Scripts/Minigame/PickupItem.cs
Normal file
91
Assets/Game/Scripts/Minigame/PickupItem.cs
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Mirror;
|
||||
public class PickupItem : NetworkBehaviour
|
||||
{
|
||||
public PickupType type;
|
||||
public float radius=1;
|
||||
public Color gizmoColor = Color.green;
|
||||
public bool active = true;
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(!isServer){return;}
|
||||
if(!active){return;}
|
||||
|
||||
Collider2D hit = Physics2D.OverlapCircle(transform.position, radius);
|
||||
if(hit!=null && hit.GetComponent<SpaceshipController>()!=null){
|
||||
Debug.Log(hit.GetComponent<SpaceshipController>().pname +$" collected me at {transform.position}");
|
||||
hit.GetComponent<SpaceshipController>().CollectPickup(type);
|
||||
active=false;
|
||||
Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
public void Reposition(Vector3 newPosition){
|
||||
if(isServer){
|
||||
reposition(newPosition);
|
||||
|
||||
RpcReposition(newPosition);
|
||||
}else{
|
||||
CmdReposition(newPosition);
|
||||
}
|
||||
}
|
||||
|
||||
[Command]
|
||||
void CmdReposition(Vector3 newPosition){
|
||||
reposition(newPosition);
|
||||
|
||||
RpcReposition(newPosition);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcReposition(Vector3 newPosition){
|
||||
reposition(newPosition);
|
||||
}
|
||||
|
||||
void reposition(Vector3 newPosition){
|
||||
active=true;
|
||||
transform.position = newPosition;
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Deactivate(){
|
||||
if(isServer){
|
||||
deactivate();
|
||||
RpcDeactivate();
|
||||
}else{
|
||||
CmdDeactivate();
|
||||
}
|
||||
}
|
||||
|
||||
void deactivate(){
|
||||
active=false;
|
||||
gameObject.SetActive(false);
|
||||
SceneData.GameManager.DeactivatePickupItem(this);
|
||||
}
|
||||
|
||||
[Command]
|
||||
void CmdDeactivate(){
|
||||
deactivate();
|
||||
RpcDeactivate();
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcDeactivate(){
|
||||
deactivate();
|
||||
}
|
||||
|
||||
private void OnDrawGizmos() {
|
||||
Gizmos.color = gizmoColor;
|
||||
Gizmos.DrawWireSphere(transform.position,radius);
|
||||
}
|
||||
|
||||
public enum PickupType{
|
||||
Star,
|
||||
Moon
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Game/Scripts/Minigame/PickupItem.cs.meta
Normal file
11
Assets/Game/Scripts/Minigame/PickupItem.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: afb8c8ecfb1028546b4ee5775cc5edfe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -26,6 +26,7 @@ public class SceneDataHolder : MonoBehaviour
|
|||
public static class SceneData{
|
||||
public static GameObject localPlayer;
|
||||
public static SceneDataHolder holder;
|
||||
public static MinigameManager GameManager;
|
||||
public static UnityEvent OnBoostDown = new UnityEvent();
|
||||
public static UnityEvent OnBoostUp = new UnityEvent();
|
||||
}
|
||||
|
|
@ -76,9 +76,6 @@ public class SpaceshipController : NetworkBehaviour
|
|||
}
|
||||
|
||||
void OnScaleChanged(float oldScale, float newScale){
|
||||
transform.localScale = new Vector3(newScale,newScale,newScale);
|
||||
trailMgr.trail.startWidth = trailMgr.trail.endWidth = newScale;
|
||||
|
||||
if(isLocalPlayer){
|
||||
SceneData.holder.boostBtn.gameObject.SetActive(newScale>1);
|
||||
}
|
||||
|
|
@ -122,6 +119,11 @@ public class SpaceshipController : NetworkBehaviour
|
|||
void FixedUpdate()
|
||||
{
|
||||
pnameTxt.rectTransform.rotation = Quaternion.Euler(Vector3.zero);
|
||||
|
||||
//Update size of trail and spaceship
|
||||
transform.localScale = Vector3.Lerp(transform.localScale,new Vector3(scaleMultiplier,scaleMultiplier,scaleMultiplier),0.1f);
|
||||
trailMgr.trail.startWidth = Mathf.Lerp(trailMgr.trail.startWidth,scaleMultiplier,0.1f);
|
||||
|
||||
if(dead){return;}
|
||||
|
||||
if (isLocalPlayer)
|
||||
|
|
@ -305,8 +307,8 @@ public class SpaceshipController : NetworkBehaviour
|
|||
|
||||
if (sentTime < lastRubberBandTime) { Debug.Log("Old rubber band rpc, ignoree..."); return; }
|
||||
//Lag comprehension
|
||||
double delay = timeInMillis - sentTime + 10;
|
||||
int numberOfFrames = (int)((float)(delay) / 20f);
|
||||
double delay = timeInMillis - sentTime;
|
||||
int numberOfFrames = (int)((float)(delay*2) / 20f);
|
||||
Vector3 newPosition = position;
|
||||
Quaternion newRotation = rotation;
|
||||
for (int i = 0; i < numberOfFrames; i++)
|
||||
|
|
@ -386,13 +388,13 @@ public class SpaceshipController : NetworkBehaviour
|
|||
|
||||
|
||||
|
||||
public void TrailCollided(RaycastHit2D hit){
|
||||
public void TrailCollided(Collider2D hit){
|
||||
if(!isServer){
|
||||
// Debug.Log("This cannot run on client, That's illegal!"); // <-- What this log says
|
||||
return;
|
||||
}
|
||||
|
||||
SpaceshipController deadPlayer = hit.collider.GetComponent<SpaceshipController>();
|
||||
SpaceshipController deadPlayer = hit.GetComponent<SpaceshipController>();
|
||||
|
||||
if(deadPlayer!=null && !deadPlayer.dead){ // <-- okay we killed someone | KILLCODE
|
||||
deadPlayer.Die(pname);
|
||||
|
|
@ -406,8 +408,13 @@ public class SpaceshipController : NetworkBehaviour
|
|||
Scores+= 10; //TODO: Need to change Scores on kills?
|
||||
scaleMultiplier+=0.05f;
|
||||
OnScaleChanged(scaleMultiplier,scaleMultiplier);
|
||||
trailTime = trailMgr.trail.time+ trailIncrementRate;
|
||||
IncreaseTrail(trailIncrementRate);
|
||||
}
|
||||
|
||||
void IncreaseTrail(float rate){
|
||||
trailTime = trailMgr.trail.time+ rate;
|
||||
trailMgr.trail.time = trailTime;
|
||||
Debug.Log("Increasing trail of" + pname);
|
||||
}
|
||||
|
||||
[Command]
|
||||
|
|
@ -415,6 +422,19 @@ public class SpaceshipController : NetworkBehaviour
|
|||
OnKill();
|
||||
}
|
||||
|
||||
public void CollectPickup(PickupItem.PickupType type){
|
||||
if(isClient){Debug.Log("Server function ran on client. That's illegal!");} // <-- What this log says
|
||||
switch(type){
|
||||
case PickupItem.PickupType.Moon:
|
||||
IncreaseTrail(trailIncrementRate);
|
||||
break;
|
||||
|
||||
case PickupItem.PickupType.Star:
|
||||
IncreaseTrail(trailIncrementRate/2f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Die(string killer){
|
||||
Debug.Log($"Sending death signal to {pname} by {killer}");
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ public class TrailCollider : MonoBehaviour
|
|||
public TrailMgr trailMgr;
|
||||
public float radius;
|
||||
void Update(){
|
||||
RaycastHit2D hit = Physics2D.CircleCast(transform.position, radius, Vector2.up);
|
||||
if(hit.collider!=null){
|
||||
Collider2D hit = Physics2D.OverlapCircle(transform.position, radius);
|
||||
if(hit!=null){
|
||||
if(hit.transform.root == trailMgr.transform){return;} // <-- avoid eating myself
|
||||
trailMgr.OnColliderHit(hit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class TrailMgr : MonoBehaviour
|
|||
|
||||
|
||||
|
||||
public void OnColliderHit(RaycastHit2D hit){
|
||||
public void OnColliderHit(Collider2D hit){
|
||||
controller.TrailCollided(hit);
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user