Entity Spawning & Rendering
Entity rendering now fully supports dynamic entities from game context Entity children now displayed underneath icon GameContext can spawn entities by loadout Selected corporation's initial fleet is spawned in parent corp's home sector Properties panel API is now unified with context menu API Properties panel labels now update dynamically
This commit is contained in:
parent
604acd80b5
commit
110ff883b8
25 changed files with 1019 additions and 165 deletions
|
|
@ -1769,6 +1769,7 @@
|
|||
<e p="TabGroup.cs" t="Include" />
|
||||
<e p="TechArrow.cs" t="Include" />
|
||||
<e p="TechNode.cs" t="Include" />
|
||||
<e p="ZoneGravityObject.cs" t="Include" />
|
||||
<e p="ZoneObject.cs" t="Include" />
|
||||
<e p="ZoneRenderer.cs" t="Include" />
|
||||
<e p="ZoneShip.cs" t="Include" />
|
||||
|
|
|
|||
|
|
@ -890,6 +890,7 @@
|
|||
<Compile Include="Assets\Scripts\UI\TabGroup.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\TechArrow.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\TechNode.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\ZoneGravityObject.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\ZoneObject.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\ZoneRenderer.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\ZoneShip.cs" />
|
||||
|
|
|
|||
107
Assets/Prefabs/Child.prefab
Normal file
107
Assets/Prefabs/Child.prefab
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7411673047664575939
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8582307304163871840}
|
||||
- component: {fileID: 1433927532033689244}
|
||||
- component: {fileID: 1757477368280699322}
|
||||
- component: {fileID: 8954320188269079158}
|
||||
- component: {fileID: 7783581834528059211}
|
||||
m_Layer: 0
|
||||
m_Name: Child
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8582307304163871840
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7411673047664575939}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.6599999, z: 0}
|
||||
m_LocalScale: {x: 0.25000015, y: 0.25000015, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &1433927532033689244
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7411673047664575939}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1757477368280699322
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7411673047664575939}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 658219dea0cf83049b6ab46c2f3436ed, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!64 &8954320188269079158
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7411673047664575939}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 14
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!114 &7783581834528059211
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7411673047664575939}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52538a3309c36fc4583c964a1c0b705f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
7
Assets/Prefabs/Child.prefab.meta
Normal file
7
Assets/Prefabs/Child.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dfe057045c1f88945ae9256f34d7c8e6
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
359
Assets/Prefabs/Entity.prefab
Normal file
359
Assets/Prefabs/Entity.prefab
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7667578565016065614
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7667578565016065613}
|
||||
- component: {fileID: 7667578565016065611}
|
||||
- component: {fileID: 7667578565016065612}
|
||||
- component: {fileID: 7667578565016065609}
|
||||
- component: {fileID: 7667578565016065610}
|
||||
m_Layer: 0
|
||||
m_Name: Icon
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7667578565016065613
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565016065614}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0.05}
|
||||
m_LocalScale: {x: 0.75, y: 0.75, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7667578565413050542}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &7667578565016065611
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565016065614}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &7667578565016065612
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565016065614}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 524c72939685743438cb17ce839664e7, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!64 &7667578565016065609
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565016065614}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 14
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!114 &7667578565016065610
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565016065614}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52538a3309c36fc4583c964a1c0b705f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &7667578565413050543
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7667578565413050542}
|
||||
- component: {fileID: 5800314421439145179}
|
||||
m_Layer: 0
|
||||
m_Name: Entity
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7667578565413050542
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565413050543}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 5.38, y: 0.81, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 7667578565016065613}
|
||||
- {fileID: 7667578566386612334}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5800314421439145179
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578565413050543}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4d8b39205d8cd404bae28355b1ed1596, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Icon: {fileID: 7667578565016065612}
|
||||
Label: {fileID: 7667578566386612333}
|
||||
--- !u!1 &7667578566386612335
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7667578566386612334}
|
||||
- component: {fileID: 7667578566386612330}
|
||||
- component: {fileID: 7667578566386612331}
|
||||
- component: {fileID: 7667578566386612332}
|
||||
- component: {fileID: 7667578566386612333}
|
||||
m_Layer: 0
|
||||
m_Name: Label
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7667578566386612334
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578566386612335}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7667578565413050542}
|
||||
m_RootOrder: 1
|
||||
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: 0}
|
||||
m_SizeDelta: {x: 1, y: 1}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!23 &7667578566386612330
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578566386612335}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 21677577810600300, guid: ef74c4c30ca5ced4489f28b914006aad, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &7667578566386612331
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578566386612335}
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!222 &7667578566386612332
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578566386612335}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &7667578566386612333
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7667578566386612335}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 'Regular Name
|
||||
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: ef74c4c30ca5ced4489f28b914006aad, type: 2}
|
||||
m_sharedMaterial: {fileID: 21677577810600300, guid: ef74c4c30ca5ced4489f28b914006aad,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_outlineColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4278190080
|
||||
m_fontSize: 2
|
||||
m_fontSizeBase: 2
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_textAlignment: 258
|
||||
m_characterSpacing: 1.38
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 0
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_firstOverflowCharacterIndex: -1
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
m_isLinkedTextComponent: 0
|
||||
m_isTextTruncated: 0
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 0
|
||||
m_isCullingEnabled: 0
|
||||
m_ignoreRectMaskCulling: 0
|
||||
m_ignoreCulling: 1
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_VertexBufferAutoSizeReduction: 1
|
||||
m_firstVisibleCharacter: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_textInfo:
|
||||
textComponent: {fileID: 7667578566386612333}
|
||||
characterCount: 13
|
||||
spriteCount: 0
|
||||
spaceCount: 2
|
||||
wordCount: 2
|
||||
linkCount: 0
|
||||
lineCount: 1
|
||||
pageCount: 1
|
||||
materialCount: 1
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_spriteAnimator: {fileID: 0}
|
||||
m_hasFontAssetChanged: 0
|
||||
m_renderer: {fileID: 7667578566386612330}
|
||||
m_subTextObjects:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
m_maskType: 0
|
||||
7
Assets/Prefabs/Entity.prefab.meta
Normal file
7
Assets/Prefabs/Entity.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6aa81281891c79e4dabe3be35be479cd
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -11186,16 +11186,22 @@ MonoBehaviour:
|
|||
TechTabButton: {fileID: 1250888060}
|
||||
GalaxyZonePrototype: {fileID: 559120531}
|
||||
GalaxyZoneLinkPrototype: {fileID: 899487252}
|
||||
ZoneObjectPrefab: {fileID: 5321404118521994133, guid: f9521191d31952a42a76632d158de0d3,
|
||||
ZoneGravityObjectPrefab: {fileID: 5321404118521994133, guid: f9521191d31952a42a76632d158de0d3,
|
||||
type: 3}
|
||||
ZoneObjectPrefab: {fileID: 5800314421439145179, guid: 6aa81281891c79e4dabe3be35be479cd,
|
||||
type: 3}
|
||||
ZoneShipPrefab: {fileID: 795352744099449573, guid: 7c1524f8ce57a9943920988eae00c86e,
|
||||
type: 3}
|
||||
BeltPrefab: {fileID: 349597964696402918, guid: 1f1bfa2175a13b647888e2949e0cb138,
|
||||
type: 3}
|
||||
ChildEntityPrefab: {fileID: 1757477368280699322, guid: dfe057045c1f88945ae9256f34d7c8e6,
|
||||
type: 3}
|
||||
PlanetoidSprite: {fileID: 2800000, guid: 823d8a1c4e071994087624c39f62b319, type: 3}
|
||||
PlanetSprite: {fileID: 2800000, guid: 0d2acbd593b7fd349b0b26b4844733ef, type: 3}
|
||||
GasGiantSprite: {fileID: 2800000, guid: 39505115515c61f4db3c5c5397a5ba49, type: 3}
|
||||
OrbitalSprite: {fileID: 2800000, guid: 97bce58bfe43bfa40870ca062cfb7ec1, type: 3}
|
||||
ShipSprite: {fileID: 2800000, guid: 4eee2b60a0b77e248885aed0587c6329, type: 3}
|
||||
TurretSprite: {fileID: 2800000, guid: 4eee2b60a0b77e248885aed0587c6329, type: 3}
|
||||
SunSprite: {fileID: 2800000, guid: 6ca81c82c86205648a1a243805aae5c9, type: 3}
|
||||
WormholeSprite: {fileID: 2800000, guid: 6d0b27330fdcc8347b1e09a2d17a0673, type: 3}
|
||||
SelectedColor: {r: 1, g: 0.44583336, b: 0.050000012, a: 1}
|
||||
|
|
@ -11206,6 +11212,9 @@ MonoBehaviour:
|
|||
ZoneMassPower: 0.25
|
||||
AsteroidSpritesheetWidth: 4
|
||||
AsteroidSpritesheetHeight: 4
|
||||
ChildEntityDistance: 0.66
|
||||
ChildEntityScale: 0.25
|
||||
ChildEntityOffsetDegrees: 30
|
||||
--- !u!4 &1126386501
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1181,7 +1181,7 @@ public class DatabaseInspector : EditorWindow
|
|||
(currentEventType == EventType.DragUpdated || currentEventType == EventType.DragPerform))
|
||||
{
|
||||
var guid = (Guid) DragAndDrop.GetGenericData("Item");
|
||||
var dragItem = DatabaseCache.Get(guid) as ItemData;
|
||||
var dragItem = DatabaseCache.Get(guid) as CraftedItemData;
|
||||
if (currentEventType == EventType.DragUpdated)
|
||||
DragAndDrop.visualMode = dragItem != null ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected;
|
||||
else if (currentEventType == EventType.DragPerform && dragItem != null)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class Galaxy : ScriptableObject
|
|||
[Serializable]
|
||||
public class GalaxyMapData
|
||||
{
|
||||
public GlobalData GlobalData = new GlobalData() {ID = Guid.NewGuid()};
|
||||
public GlobalData GlobalData = new GlobalData();
|
||||
|
||||
[HideInInspector]
|
||||
public GalaxyMapLayerData StarDensity;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
{
|
||||
Context = Context,
|
||||
Data = blueprintItemData.ID,
|
||||
ID = Guid.NewGuid(),
|
||||
Ingredients = _reservedStock.Select(ii=>ii.ID).ToList(),
|
||||
Quality = quality,
|
||||
Blueprint = _blueprint
|
||||
|
|
@ -98,7 +97,6 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
{
|
||||
Context = Context,
|
||||
Data = blueprintItemData.ID,
|
||||
ID = Guid.NewGuid(),
|
||||
Ingredients = _reservedStock.Select(ii=>ii.ID).ToList(),
|
||||
Quality = quality,
|
||||
Blueprint = _blueprint
|
||||
|
|
@ -118,7 +116,6 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
{
|
||||
Context = Context,
|
||||
Data = simpleCommodityData.ID,
|
||||
ID = Guid.NewGuid(),
|
||||
Quantity = blueprint.Quantity
|
||||
};
|
||||
Context.Cache.Add(newSimpleCommodity);
|
||||
|
|
@ -181,7 +178,6 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
{
|
||||
Context = Context,
|
||||
Data = simpleCommodity.Data,
|
||||
ID = Guid.NewGuid(),
|
||||
Quantity = blueprintQuantity
|
||||
};
|
||||
simpleCommodity.Quantity -= blueprintQuantity;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ public class TowingController : IBehavior, IPersistentBehavior, IController, IIn
|
|||
|
||||
public bool Update(float delta)
|
||||
{
|
||||
var towingTask = _context.Cache.Get<StationTowing>(_towingTask);
|
||||
if (towingTask == null)
|
||||
return false;
|
||||
|
||||
if (_path.Any())
|
||||
{
|
||||
_locomotion.Update(delta);
|
||||
|
|
@ -64,7 +68,6 @@ public class TowingController : IBehavior, IPersistentBehavior, IController, IIn
|
|||
}
|
||||
else
|
||||
{
|
||||
var towingTask = _context.Cache.Get<StationTowing>(_towingTask);
|
||||
var destination = float2(0);
|
||||
var velocity = float2(0);
|
||||
if (_towingPhase == TowingPhase.Pickup)
|
||||
|
|
@ -97,19 +100,17 @@ public class TowingController : IBehavior, IPersistentBehavior, IController, IIn
|
|||
_velocityMatch.OnMatch += () =>
|
||||
{
|
||||
var target = _context.ZoneEntities[_entity.Zone][towingTask.Station];
|
||||
_entity.Children.Add(towingTask.Station);
|
||||
target.Parent = _entity.ID;
|
||||
_context.SetParent(target, _entity);
|
||||
_towingPhase = TowingPhase.Delivery;
|
||||
_movementPhase = MovementPhase.Locomotion;
|
||||
};
|
||||
else
|
||||
_velocityMatch.OnMatch += () =>
|
||||
{
|
||||
var orbit = _context.CreateOrbit(towingTask.OrbitParent, _entity.Position);
|
||||
|
||||
var target = _context.ZoneEntities[_entity.Zone][towingTask.Station] as OrbitalEntity;
|
||||
_entity.Children.Remove(towingTask.Station);
|
||||
target.Parent = Guid.Empty;
|
||||
_context.RemoveParent(target);
|
||||
|
||||
var orbit = _context.CreateOrbit(towingTask.OrbitParent, _entity.Position);
|
||||
target.OrbitData = orbit.ID;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ public class LoadoutData : DatabaseEntry, INamedEntry
|
|||
[JsonProperty("items"), Key(3)]
|
||||
public List<Guid> Items = new List<Guid>();
|
||||
|
||||
[InspectableDatabaseLink(typeof(SimpleCommodityData)), JsonProperty("resourceRequirements"), Key(4)]
|
||||
public Dictionary<Guid, int> SimpleCargo = new Dictionary<Guid, int>();
|
||||
|
||||
[IgnoreMember] public string EntryName
|
||||
{
|
||||
get => Name;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using static Unity.Mathematics.math;
|
|||
Union(0, typeof(Ship)),
|
||||
Union(1, typeof(OrbitalEntity)),
|
||||
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<Entity>))]
|
||||
public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackReceiver
|
||||
public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackReceiver, INamedEntry
|
||||
{
|
||||
[JsonProperty("temperature"), Key(1)] public float Temperature;
|
||||
[JsonProperty("energy"), Key(2)] public float Energy;
|
||||
|
|
@ -27,6 +27,7 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
|
|||
[JsonProperty("hull"), Key(10)] public Guid Hull; // Type: Gear
|
||||
[JsonProperty("persistedBehaviorData"), Key(11)] public Dictionary<Guid, PersistentBehaviorData[]> PersistedBehaviors;
|
||||
[JsonProperty("corporation"), Key(12)] public Guid Corporation;
|
||||
[JsonProperty("name"), Key(13)] public string Name;
|
||||
|
||||
// [IgnoreMember] protected List<IBehavior> Behaviors;
|
||||
[IgnoreMember] public Guid Zone;
|
||||
|
|
@ -44,10 +45,15 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
|
|||
[IgnoreMember] public float SpecificHeat { get; private set; }
|
||||
[IgnoreMember] public float Visibility => VisibilitySources.Values.Sum();
|
||||
|
||||
[IgnoreMember] public string EntryName
|
||||
{
|
||||
get => Name;
|
||||
set => Name = value;
|
||||
}
|
||||
|
||||
|
||||
public Entity(GameContext context, Guid hull, IEnumerable<Guid> items, IEnumerable<Guid> cargo, Guid zone)
|
||||
{
|
||||
ID = Guid.NewGuid();
|
||||
Context = context;
|
||||
Zone = zone;
|
||||
|
||||
|
|
@ -120,7 +126,8 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
|
|||
|
||||
SpecificHeat = Context.Cache.Get<Gear>(Hull).HeatCapacity +
|
||||
EquippedItems.Select(i => Context.Cache.Get<Gear>(i)).Sum(i => i.HeatCapacity) +
|
||||
Cargo.Select(i => Context.Cache.Get<ItemInstance>(i)).Sum(ii => ii.HeatCapacity);
|
||||
Cargo.Select(i => Context.Cache.Get<ItemInstance>(i)).Sum(ii => ii.HeatCapacity) +
|
||||
Children.Select(i => Context.Cache.Get<Entity>(i)).Sum(c=>c.SpecificHeat);
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetBehaviors<T>() where T : class, IBehavior
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public class GameContext
|
|||
private Dictionary<Guid, float2> _orbitVelocities = new Dictionary<Guid, float2>();
|
||||
private Dictionary<Guid, float2> _orbitPositions = new Dictionary<Guid, float2>();
|
||||
private Dictionary<Guid, float2> _previousOrbitPositions = new Dictionary<Guid, float2>();
|
||||
private Dictionary<Guid, float3[]> _asteroidPositions = new Dictionary<Guid, float3[]>();
|
||||
private Dictionary<Guid, bool> _asteroidPositionsUpdated = new Dictionary<Guid, bool>();
|
||||
private Guid _forceLoadZone;
|
||||
private Type[] _statObjects;
|
||||
|
||||
|
|
@ -102,6 +104,9 @@ public class GameContext
|
|||
: float2.zero;
|
||||
}
|
||||
|
||||
foreach (var asteroids in _asteroidPositions.Keys)
|
||||
_asteroidPositionsUpdated[asteroids] = false;
|
||||
|
||||
foreach (var corporation in Cache.GetAll<Corporation>())
|
||||
{
|
||||
foreach (var tasks in corporation.Tasks
|
||||
|
|
@ -222,6 +227,28 @@ public class GameContext
|
|||
return _orbitVelocities.ContainsKey(orbit) ? _orbitVelocities[orbit] : float2.zero;
|
||||
}
|
||||
|
||||
public float3[] GetAsteroidTransforms(Guid planetDataID)
|
||||
{
|
||||
var planetData = Cache.Get<PlanetData>(planetDataID);
|
||||
if (!_asteroidPositions.ContainsKey(planetDataID))
|
||||
{
|
||||
_asteroidPositions[planetDataID] = new float3[planetData.Asteroids.Length];
|
||||
_asteroidPositionsUpdated[planetDataID] = false;
|
||||
}
|
||||
|
||||
if (_asteroidPositionsUpdated[planetDataID])
|
||||
return _asteroidPositions[planetDataID];
|
||||
for (var i = 0; i < planetData.Asteroids.Length; i++)
|
||||
{
|
||||
_asteroidPositions[planetDataID][i] = float3(
|
||||
OrbitData.Evaluate((float) frac(Time / -OrbitalPeriod(planetData.Asteroids[i].x) * GlobalData.OrbitSpeedMultiplier +
|
||||
planetData.Asteroids[i].y)) * planetData.Asteroids[i].x,
|
||||
(float) (Time * planetData.Asteroids[i].w % 360.0));
|
||||
}
|
||||
|
||||
return _asteroidPositions[planetDataID];
|
||||
}
|
||||
|
||||
public OrbitData CreateOrbit(Guid parent, float2 position)
|
||||
{
|
||||
var parentOrbit = Cache.Get<OrbitData>(parent);
|
||||
|
|
@ -236,7 +263,6 @@ public class GameContext
|
|||
{
|
||||
Context = this,
|
||||
Distance = distance,
|
||||
ID = Guid.NewGuid(),
|
||||
Parent = parent,
|
||||
Period = period,
|
||||
Phase = storedPhase,
|
||||
|
|
@ -511,6 +537,138 @@ public class GameContext
|
|||
return stat.Min;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Entity CreateEntity(Guid zone, Guid corporation, Guid loadout)
|
||||
{
|
||||
if (!(Cache.Get(loadout) is LoadoutData loadoutData))
|
||||
{
|
||||
_logger("Attempted to spawn invalid loadout ID");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(Cache.Get(loadoutData.Hull) is HullData hullData))
|
||||
{
|
||||
_logger("Attempted to spawn loadout with invalid hull ID");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(Cache.Get(zone) is ZoneData zoneData))
|
||||
{
|
||||
_logger("Attempted to spawn entity with invalid zone ID");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(Cache.Get(corporation) is Corporation corpData))
|
||||
{
|
||||
_logger("Attempted to spawn entity with invalid corporation ID");
|
||||
return null;
|
||||
}
|
||||
|
||||
var gearData = loadoutData.Items
|
||||
.Take(hullData.Hardpoints.Count)
|
||||
.Where(id => id != Guid.Empty)
|
||||
.Select(id => Cache.Get<GearData>(id))
|
||||
.ToArray();
|
||||
|
||||
if (gearData.Any(g=>g==null))
|
||||
{
|
||||
_logger("Attempted to spawn loadout with invalid gear ID");
|
||||
return null;
|
||||
}
|
||||
|
||||
var cargoData = loadoutData.Items
|
||||
.Skip(hullData.Hardpoints.Count)
|
||||
.Where(id => id != Guid.Empty)
|
||||
.Select(id => Cache.Get<CraftedItemData>(id))
|
||||
.ToArray();
|
||||
|
||||
if (cargoData.Any(g=>g==null))
|
||||
{
|
||||
_logger("Attempted to spawn loadout with invalid cargo ID");
|
||||
return null;
|
||||
}
|
||||
|
||||
var gear = gearData
|
||||
.Select(gd => CreateInstance(gd.ID, GlobalData.StartingGearQualityMin, GlobalData.StartingGearQualityMax))
|
||||
.ToArray();
|
||||
|
||||
if (gear.Any(g=>g==null))
|
||||
return null;
|
||||
|
||||
foreach(var g in gear)
|
||||
Cache.Add(g);
|
||||
|
||||
var cargo = cargoData
|
||||
.Select(gd => CreateInstance(gd.ID, GlobalData.StartingGearQualityMin, GlobalData.StartingGearQualityMax))
|
||||
.ToArray();
|
||||
|
||||
if (cargo.Any(g=>g==null))
|
||||
return null;
|
||||
|
||||
foreach(var c in cargo)
|
||||
Cache.Add(c);
|
||||
|
||||
var simpleCargo = loadoutData.SimpleCargo?
|
||||
.Select(x => CreateInstance(x.Key, x.Value))
|
||||
.ToArray() ?? new SimpleCommodity[0];
|
||||
|
||||
if (simpleCargo.Any(g=>g==null))
|
||||
return null;
|
||||
|
||||
foreach(var c in simpleCargo)
|
||||
Cache.Add(c);
|
||||
|
||||
var hull = CreateInstance(loadoutData.Hull, GlobalData.StartingGearQualityMin, GlobalData.StartingGearQualityMax);
|
||||
|
||||
if(hull==null)
|
||||
return null;
|
||||
|
||||
// Load target zone if not yet loaded
|
||||
if (!_loadedZones.Contains(zone))
|
||||
LoadZone(zone);
|
||||
|
||||
if (hullData.HullType == HullType.Ship)
|
||||
{
|
||||
var entity = new Ship(this, hull.ID, gear.Select(g => g.ID),
|
||||
cargo.Select(c => c.ID).Concat(simpleCargo.Select(c => c.ID)), zone)
|
||||
{
|
||||
Name = $"{loadoutData.Name} {Random.NextInt(1,255):X}"
|
||||
};
|
||||
Cache.Add(entity);
|
||||
|
||||
ZoneEntities[zone][entity.ID] = entity;
|
||||
return entity;
|
||||
}
|
||||
|
||||
if (hullData.HullType == HullType.Station)
|
||||
{
|
||||
var distance = lerp(.2f, .8f, Random.NextFloat()) * zoneData.Radius;
|
||||
var orbit = new OrbitData
|
||||
{
|
||||
Context = this,
|
||||
Distance = distance,
|
||||
Parent = _orbits
|
||||
.Select(id => Cache.Get<OrbitData>(id))
|
||||
.First(orbitData => orbitData.Zone == zone && orbitData.Parent == Guid.Empty).ID,
|
||||
Period = OrbitalPeriod(distance),
|
||||
Phase = Random.NextFloat(),
|
||||
Zone = zone
|
||||
};
|
||||
Cache.Add(orbit);
|
||||
|
||||
var entity = new OrbitalEntity(this, hull.ID, gear.Select(g => g.ID),
|
||||
cargo.Select(c => c.ID).Concat(simpleCargo.Select(c => c.ID)), orbit.ID, zone)
|
||||
{
|
||||
Name = $"{loadoutData.Name} {Random.NextInt(1,255):X}"
|
||||
};
|
||||
Cache.Add(entity);
|
||||
|
||||
ZoneEntities[zone][entity.ID] = entity;
|
||||
return entity;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SimpleCommodity CreateInstance(Guid data, int count)
|
||||
{
|
||||
|
|
@ -519,15 +677,14 @@ public class GameContext
|
|||
return new SimpleCommodity
|
||||
{
|
||||
Data = data,
|
||||
Quantity = count,
|
||||
ID = Guid.NewGuid()
|
||||
Quantity = count
|
||||
};
|
||||
|
||||
_logger("Attempted to create Simple Commodity instance using missing or incorrect item id");
|
||||
return null;
|
||||
}
|
||||
|
||||
public CraftedItemInstance CreateInstance(Guid data, float quality)
|
||||
public CraftedItemInstance CreateInstance(Guid data, float qualityMin, float qualityMax)
|
||||
{
|
||||
var item = Cache.Get<CraftedItemData>(data);
|
||||
if (item == null)
|
||||
|
|
@ -548,7 +705,7 @@ public class GameContext
|
|||
var ingredient = Cache.Get(ci.Key);
|
||||
return ingredient is SimpleCommodityData
|
||||
? (IEnumerable<ItemInstance>) new[] {CreateInstance(ci.Key, ci.Value)}
|
||||
: Enumerable.Range(0, ci.Value).Select(i => CreateInstance(ci.Key, quality));
|
||||
: Enumerable.Range(0, ci.Value).Select(i => CreateInstance(ci.Key, qualityMin, qualityMax));
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
|
@ -560,9 +717,8 @@ public class GameContext
|
|||
{
|
||||
Context = this,
|
||||
Data = data,
|
||||
ID = Guid.NewGuid(),
|
||||
Ingredients = ingredients.Select(i=>i.ID).ToList(),
|
||||
Quality = quality,
|
||||
Quality = Random.NextFloat(qualityMin, qualityMax),
|
||||
Blueprint = blueprint.ID
|
||||
};
|
||||
newGear.Durability = Evaluate(equippableItemData.Durability, newGear);
|
||||
|
|
@ -574,9 +730,8 @@ public class GameContext
|
|||
{
|
||||
Context = this,
|
||||
Data = data,
|
||||
ID = Guid.NewGuid(),
|
||||
Ingredients = ingredients.Select(i=>i.ID).ToList(),
|
||||
Quality = quality,
|
||||
Quality = Random.NextFloat(qualityMin, qualityMax),
|
||||
Blueprint = blueprint.ID
|
||||
};
|
||||
Cache.Add(newCommodity);
|
||||
|
|
@ -615,4 +770,21 @@ public class GameContext
|
|||
searched.Add(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParent(Entity child, Entity parent)
|
||||
{
|
||||
child.Parent = parent.ID;
|
||||
parent.Children.Add(child.ID);
|
||||
parent.RecalculateMass();
|
||||
}
|
||||
|
||||
public void RemoveParent(Entity child)
|
||||
{
|
||||
if (child.Parent == Guid.Empty)
|
||||
return;
|
||||
|
||||
var parent = Cache.Get<Entity>(child.Parent);
|
||||
parent.Children.Remove(child.ID);
|
||||
child.Parent = Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -133,6 +133,12 @@ public class GlobalData : DatabaseEntry
|
|||
|
||||
[InspectableField, JsonProperty("resourceDensityMaximum"), Key(41)]
|
||||
public float ResourceDensityMaximum = 1.5f;
|
||||
|
||||
[InspectableField, JsonProperty("startingGearQualityMin"), Key(42)]
|
||||
public float StartingGearQualityMin = .1f;
|
||||
|
||||
[InspectableField, JsonProperty("startingGearQualityMax"), Key(43)]
|
||||
public float StartingGearQualityMax = .5f;
|
||||
|
||||
public float PlanetRadius(float mass)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,9 +54,8 @@ public class ZoneGenerator
|
|||
// Create orbit database entries
|
||||
orbitData = planets.Select(planet =>
|
||||
{
|
||||
var data = new OrbitData()
|
||||
var data = new OrbitData
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
Distance = planet.Distance,
|
||||
Period = planet.Period,
|
||||
Phase = planet.Phase,
|
||||
|
|
@ -95,7 +94,6 @@ public class ZoneGenerator
|
|||
var planetData = new PlanetData
|
||||
{
|
||||
Mass = planet.Mass,
|
||||
ID = Guid.NewGuid(),
|
||||
Orbit = orbitMap[planet].ID,
|
||||
Zone = zone.ID,
|
||||
Belt = planet.Belt,
|
||||
|
|
|
|||
|
|
@ -43,15 +43,19 @@ public class StrategyGameManager : MonoBehaviour
|
|||
[Section("Prefabs & Prototypes")]
|
||||
public Prototype GalaxyZonePrototype;
|
||||
public Prototype GalaxyZoneLinkPrototype;
|
||||
public ZoneGravityObject ZoneGravityObjectPrefab;
|
||||
public ZoneObject ZoneObjectPrefab;
|
||||
public ZoneShip ZoneShipPrefab;
|
||||
public MeshFilter BeltPrefab;
|
||||
public MeshRenderer ChildEntityPrefab;
|
||||
|
||||
[Section("Textures")]
|
||||
public Texture2D PlanetoidSprite;
|
||||
public Texture2D PlanetSprite;
|
||||
public Texture2D GasGiantSprite;
|
||||
public Texture2D OrbitalSprite;
|
||||
public Texture2D ShipSprite;
|
||||
public Texture2D TurretSprite;
|
||||
public Texture2D SunSprite;
|
||||
public Texture2D WormholeSprite;
|
||||
|
||||
|
|
@ -64,6 +68,9 @@ public class StrategyGameManager : MonoBehaviour
|
|||
public float ZoneMassPower = .5f;
|
||||
public int AsteroidSpritesheetWidth = 4;
|
||||
public int AsteroidSpritesheetHeight = 4;
|
||||
public float ChildEntityDistance = .66f;
|
||||
public float ChildEntityScale = .25f;
|
||||
public float ChildEntityOffsetDegrees = 30f;
|
||||
|
||||
private DatabaseCache _cache;
|
||||
private GameContext _context;
|
||||
|
|
@ -74,10 +81,11 @@ public class StrategyGameManager : MonoBehaviour
|
|||
private Guid _selectedZone;
|
||||
private GalaxyZone _selectedGalaxyZone;
|
||||
private Dictionary<Guid, GalaxyZone> _galaxyZoneObjects = new Dictionary<Guid, GalaxyZone>();
|
||||
private Dictionary<Guid, ZoneObject> _zoneObjects = new Dictionary<Guid, ZoneObject>(); // Key is Orbit
|
||||
private Dictionary<Guid, ZoneGravityObject> _zoneGravityObjects = new Dictionary<Guid, ZoneGravityObject>(); // Key is Orbit
|
||||
private Dictionary<Guid, AsteroidBelt> _zoneBelts = new Dictionary<Guid, AsteroidBelt>();
|
||||
private Dictionary<Ship, ZoneShip> _zoneShips = new Dictionary<Ship, ZoneShip>();
|
||||
private List<ZoneObject> _wormholes = new List<ZoneObject>();
|
||||
private Dictionary<OrbitalEntity, ZoneObject> _zoneOrbitals = new Dictionary<OrbitalEntity, ZoneObject>();
|
||||
private List<ZoneGravityObject> _wormholes = new List<ZoneGravityObject>();
|
||||
private Vector3 _galaxyCameraPos = -Vector3.forward;
|
||||
private float _galaxyOrthoSize = 50;
|
||||
private Material _boundaryMaterial;
|
||||
|
|
@ -88,6 +96,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
private Guid _playerCorporation;
|
||||
private Dictionary<CorporationMenuItem, Guid> _corpOptionMap = new Dictionary<CorporationMenuItem, Guid>();
|
||||
private CorporationMenuItem _selectedParent;
|
||||
private Dictionary<int, float2[]> _childEntityPositions = new Dictionary<int, float2[]>();
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
|
@ -124,7 +133,6 @@ public class StrategyGameManager : MonoBehaviour
|
|||
player = new Player
|
||||
{
|
||||
Context = _context,
|
||||
ID = Guid.NewGuid(),
|
||||
Username = Environment.UserName
|
||||
};
|
||||
_cache.Add(player);
|
||||
|
|
@ -171,7 +179,6 @@ public class StrategyGameManager : MonoBehaviour
|
|||
var newCorp = new Corporation
|
||||
{
|
||||
Context = _context,
|
||||
ID = Guid.NewGuid(),
|
||||
Name = CorpNameInputField.text,
|
||||
Parent = _corpOptionMap[_selectedParent]
|
||||
};
|
||||
|
|
@ -181,8 +188,17 @@ public class StrategyGameManager : MonoBehaviour
|
|||
GameMenuRoot.gameObject.SetActive(true);
|
||||
CorpMenuRoot.gameObject.SetActive(false);
|
||||
|
||||
_selectedZone = _cache.Get<MegaCorporation>(newCorp.Parent).HomeZone;
|
||||
var parentCorp = _cache.Get<MegaCorporation>(newCorp.Parent);
|
||||
_selectedZone = parentCorp.HomeZone;
|
||||
ZoneTabButton.OnPointerClick(null);
|
||||
|
||||
var entities = new List<Entity>();
|
||||
foreach(var loadout in parentCorp.InitialFleet)
|
||||
for(int i=0; i<loadout.Value; i++)
|
||||
entities.Add(_context.CreateEntity(_selectedZone, newCorp.ID, loadout.Key));
|
||||
var colony = entities.First(e => e is OrbitalEntity);
|
||||
foreach (var ship in entities.Where(e => e is Ship))
|
||||
_context.SetParent(ship, colony);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -277,7 +293,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = _context.GlobalData.GalaxyName;
|
||||
PropertiesPanel.AddSection("Galaxy");
|
||||
PropertiesPanel.AddProperty("Sectors", $"{_context.GalaxyZones.Count}");
|
||||
PropertiesPanel.AddProperty("Sectors", () => $"{_context.GalaxyZones.Count}");
|
||||
}
|
||||
|
||||
private void PopulateZoneProperties(Guid zone)
|
||||
|
|
@ -286,7 +302,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
var zoneData = _cache.Get<ZoneData>(zone);
|
||||
PropertiesPanel.Title.text = zoneData.Name;
|
||||
PropertiesPanel.AddSection("Sector");
|
||||
PropertiesPanel.AddProperty("Planets", $"{zoneData.Planets.Length}");
|
||||
PropertiesPanel.AddProperty("Planets", () => $"{zoneData.Planets.Length}");
|
||||
}
|
||||
|
||||
private void PopulateTechProperties()
|
||||
|
|
@ -294,9 +310,9 @@ public class StrategyGameManager : MonoBehaviour
|
|||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = "Technologies";
|
||||
var count = _context.Cache.GetAll<BlueprintData>().Count();
|
||||
PropertiesPanel.AddProperty("Discovered Techs", $"{count}");
|
||||
PropertiesPanel.AddProperty("Available Techs", $"{count}");
|
||||
PropertiesPanel.AddProperty("Researched Techs", $"{count}");
|
||||
PropertiesPanel.AddProperty("Discovered Techs", () => $"{count}");
|
||||
PropertiesPanel.AddProperty("Available Techs", () => $"{count}");
|
||||
PropertiesPanel.AddProperty("Researched Techs", () => $"{count}");
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
|
@ -314,7 +330,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
}
|
||||
if (_currentTab == ZoneTabButton && _populatedZone == _selectedZone)
|
||||
{
|
||||
foreach (var planet in _zoneObjects)
|
||||
foreach (var planet in _zoneGravityObjects)
|
||||
{
|
||||
planet.Value.transform.position = float3(_context.GetOrbitPosition(planet.Key) * ZoneSizeScale, .1f);
|
||||
}
|
||||
|
|
@ -333,9 +349,135 @@ public class StrategyGameManager : MonoBehaviour
|
|||
thrusterScale.x = ship.Key.Axes[ship.Key.GetAxis<Thruster>()].Value;
|
||||
ship.Value.Thruster.localScale = thrusterScale;
|
||||
}
|
||||
|
||||
var entities = _context.GetEntities(_populatedZone);
|
||||
var shipGameObjects = _zoneShips.Keys.ToList();
|
||||
var orbitalGameObjects = _zoneOrbitals.Keys.ToList();
|
||||
var zoneShips = entities.Where(e => e is Ship && e.Parent == Guid.Empty).Cast<Ship>();
|
||||
var zoneOrbitals = entities.Where(e => e is OrbitalEntity && e.Parent == Guid.Empty).Cast<OrbitalEntity>();
|
||||
|
||||
void PopulateChildObjects(ZoneObject zoneObject, Entity entity)
|
||||
{
|
||||
if (zoneObject.Children.Count != entity.Children.Count)
|
||||
{
|
||||
foreach(var child in zoneObject.Children)
|
||||
Destroy(child.gameObject);
|
||||
zoneObject.Children.Clear();
|
||||
var positions = GetChildEntityPositions(entity.Children.Count);
|
||||
foreach (var child in entity.Children)
|
||||
{
|
||||
var childEntity = _context.Cache.Get(child);
|
||||
var childGameObject = Instantiate(ChildEntityPrefab, zoneObject.transform);
|
||||
childGameObject.material.SetTexture("_MainTex", childEntity is Ship ? ShipSprite : OrbitalSprite );
|
||||
childGameObject.GetComponent<ClickableCollider>().OnClick += (collider, data) =>
|
||||
{
|
||||
if (data.button == PointerEventData.InputButton.Left)
|
||||
PopulatePropertiesPanel(child);
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
ShowContextMenu(child);
|
||||
};
|
||||
zoneObject.Children.Add(childGameObject);
|
||||
}
|
||||
|
||||
for (int i = 0; i < entity.Children.Count; i++)
|
||||
zoneObject.Children[i].transform.localPosition = (Vector2) positions[i];
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var ship in zoneShips)
|
||||
{
|
||||
if (!_zoneShips.ContainsKey(ship))
|
||||
{
|
||||
var zoneShip = Instantiate(ZoneShipPrefab, ZoneRoot);
|
||||
zoneShip.Icon.GetComponent<ClickableCollider>().OnClick += (collider, data) =>
|
||||
{
|
||||
if (data.button == PointerEventData.InputButton.Left)
|
||||
PopulatePropertiesPanel(ship.ID);
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
ShowContextMenu(ship.ID);
|
||||
};
|
||||
zoneShip.Label.text = ship.Name;
|
||||
_zoneShips[ship] = zoneShip;
|
||||
}
|
||||
|
||||
_zoneShips[ship].transform.position = float3(ship.Position * ZoneSizeScale, .05f);
|
||||
_zoneShips[ship].Icon.transform.up = (Vector2) ship.Direction;
|
||||
var thrusterScale = _zoneShips[ship].Thruster.localScale;
|
||||
thrusterScale.x = ship.Axes[ship.GetAxis<Thruster>()].Value;
|
||||
_zoneShips[ship].Thruster.localScale = thrusterScale;
|
||||
|
||||
PopulateChildObjects(_zoneShips[ship], ship);
|
||||
|
||||
shipGameObjects.Remove(ship);
|
||||
}
|
||||
|
||||
// We have removed all game objects which are associated with active entities
|
||||
// Any game objects remaining are orphans and must be executed
|
||||
foreach(var ship in shipGameObjects)
|
||||
{
|
||||
Destroy(_zoneShips[ship].gameObject);
|
||||
_zoneShips.Remove(ship);
|
||||
}
|
||||
|
||||
foreach (var orbital in zoneOrbitals)
|
||||
{
|
||||
if (!_zoneOrbitals.ContainsKey(orbital))
|
||||
{
|
||||
var zoneOrbital = Instantiate(ZoneObjectPrefab, ZoneRoot);
|
||||
zoneOrbital.Icon.material.SetTexture("_MainTex", OrbitalSprite );
|
||||
zoneOrbital.Icon.GetComponent<ClickableCollider>().OnClick += (collider, data) =>
|
||||
{
|
||||
if (data.button == PointerEventData.InputButton.Left)
|
||||
PopulatePropertiesPanel(orbital.ID);
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
ShowContextMenu(orbital.ID);
|
||||
};
|
||||
zoneOrbital.Label.text = orbital.Name;
|
||||
_zoneOrbitals[orbital] = zoneOrbital;
|
||||
}
|
||||
|
||||
_zoneOrbitals[orbital].transform.position = float3(orbital.Position * ZoneSizeScale, .05f);
|
||||
_zoneOrbitals[orbital].Icon.transform.up = (Vector2) orbital.Direction;
|
||||
|
||||
PopulateChildObjects(_zoneOrbitals[orbital], orbital);
|
||||
|
||||
orbitalGameObjects.Remove(orbital);
|
||||
}
|
||||
|
||||
foreach(var orbital in orbitalGameObjects)
|
||||
{
|
||||
Destroy(_zoneOrbitals[orbital].gameObject);
|
||||
_zoneOrbitals.Remove(orbital);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float2[] GetChildEntityPositions(int count)
|
||||
{
|
||||
if (!_childEntityPositions.ContainsKey(count))
|
||||
{
|
||||
var down = float2(0, -ChildEntityDistance);
|
||||
var positions = new float2[count];
|
||||
if (count % 2 == 1)
|
||||
{
|
||||
positions[0] = down;
|
||||
for (int i = 1; i < count; i++)
|
||||
positions[i] = mul(float3(down, 1), Unity.Mathematics.float3x3.RotateZ(
|
||||
Mathf.Deg2Rad * ChildEntityOffsetDegrees * ((i - 1) / 2 + 1) * (i % 2 == 1 ? 1 : -1))).xy;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
positions[i] = mul(float3(down, 1), Unity.Mathematics.float3x3.RotateZ(
|
||||
Mathf.Deg2Rad * ((ChildEntityOffsetDegrees * (i / 2 + 1) - ChildEntityOffsetDegrees/2) * (i % 2 == 1 ? 1 : -1)))).xy;
|
||||
}
|
||||
|
||||
_childEntityPositions[count] = positions;
|
||||
}
|
||||
|
||||
return _childEntityPositions[count];
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
if (TestMode)
|
||||
|
|
@ -344,11 +486,12 @@ public class StrategyGameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
void ShowContextMenu(object clickTarget)
|
||||
void ShowContextMenu(Guid clickTarget)
|
||||
{
|
||||
var targetObject = _context.Cache.Get(clickTarget);
|
||||
ContextMenu.gameObject.SetActive(true);
|
||||
ContextMenu.Clear();
|
||||
if (clickTarget is PlanetData planet)
|
||||
if (targetObject is PlanetData planet)
|
||||
{
|
||||
ContextMenu.AddOption("Test Option 1", () => Debug.Log("Test Option 1 Selected"));
|
||||
ContextMenu.AddOption("Test Option 2", () => Debug.Log("Test Option 2 Selected"));
|
||||
|
|
@ -360,9 +503,38 @@ public class StrategyGameManager : MonoBehaviour
|
|||
});
|
||||
ContextMenu.AddOption("Test Option 3", () => Debug.Log("Test Option 3 Selected"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextMenu.gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
ContextMenu.Show();
|
||||
}
|
||||
|
||||
void PopulatePropertiesPanel(Guid clickTarget)
|
||||
{
|
||||
var targetObject = _context.Cache.Get(clickTarget);
|
||||
|
||||
if (targetObject is PlanetData planet)
|
||||
{
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = planet.Name;
|
||||
if(planet.Belt)
|
||||
PropertiesPanel.AddSection("Asteroid Belt");
|
||||
else
|
||||
PropertiesPanel.AddSection(planet.Mass > _context.GlobalData.SunMass ? "Star" :
|
||||
planet.Mass > _context.GlobalData.GasGiantMass ? "Gas Giant" :
|
||||
planet.Mass > _context.GlobalData.PlanetMass ? "Planet" :
|
||||
"Planetoid");
|
||||
PropertiesPanel.AddProperty("Mass", () => $"{planet.Mass}");
|
||||
PropertiesPanel.AddList("Resources", planet.Resources.Select(resource =>
|
||||
{
|
||||
var itemData = _context.Cache.Get<SimpleCommodityData>(resource.Key);
|
||||
return new Tuple<string, string>(itemData.Name, $"{resource.Value:0}");
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateGalaxy()
|
||||
{
|
||||
_galaxyPopulated = true;
|
||||
|
|
@ -463,8 +635,8 @@ public class StrategyGameManager : MonoBehaviour
|
|||
void PopulateZone()
|
||||
{
|
||||
// Delete all the existing zone contents
|
||||
foreach (var zoneObject in _zoneObjects.Values) Destroy(zoneObject.gameObject);//zoneObject.GetComponent<Prototype>().ReturnToPool();
|
||||
_zoneObjects.Clear();
|
||||
foreach (var zoneObject in _zoneGravityObjects.Values) Destroy(zoneObject.gameObject);//zoneObject.GetComponent<Prototype>().ReturnToPool();
|
||||
_zoneGravityObjects.Clear();
|
||||
foreach (var zoneObject in _wormholes) Destroy(zoneObject.gameObject); //zoneObject.GetComponent<Prototype>().ReturnToPool();
|
||||
_wormholes.Clear();
|
||||
foreach (var belt in _zoneBelts.Values) Destroy(belt.Transform.gameObject);
|
||||
|
|
@ -490,8 +662,8 @@ public class StrategyGameManager : MonoBehaviour
|
|||
var planetData = _cache.Get<PlanetData>(planet);
|
||||
if (!planetData.Belt)
|
||||
{
|
||||
var planetObject = Instantiate(ZoneObjectPrefab, ZoneRoot);
|
||||
_zoneObjects[planetData.Orbit] = planetObject;
|
||||
var planetObject = Instantiate(ZoneGravityObjectPrefab, ZoneRoot);
|
||||
_zoneGravityObjects[planetData.Orbit] = planetObject;
|
||||
planetObject.Label.text = planetData.Name;
|
||||
planetObject.GravityMesh.gameObject.SetActive(true);
|
||||
planetObject.GravityMesh.transform.localScale =
|
||||
|
|
@ -509,50 +681,23 @@ public class StrategyGameManager : MonoBehaviour
|
|||
planetObject.Icon.GetComponent<ClickableCollider>().OnClick += (collider, data) =>
|
||||
{
|
||||
if (data.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = planetData.Name;
|
||||
PropertiesPanel.AddSection(planetData.Mass > _context.GlobalData.SunMass ? "Star" :
|
||||
planetData.Mass > _context.GlobalData.GasGiantMass ? "Gas Giant" :
|
||||
planetData.Mass > _context.GlobalData.PlanetMass ? "Planet" :
|
||||
"Planetoid");
|
||||
PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
|
||||
PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
|
||||
{
|
||||
var itemData = _context.Cache.Get<SimpleCommodityData>(resource.Key);
|
||||
return new Tuple<string, string>(itemData.Name, $"{resource.Value:0}");
|
||||
}));
|
||||
}
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
{
|
||||
ShowContextMenu(planetData);
|
||||
}
|
||||
PopulatePropertiesPanel(planetData.ID);
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
ShowContextMenu(planetData.ID);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var beltObject = Instantiate(BeltPrefab, ZoneRoot);
|
||||
var collider = beltObject.GetComponent<MeshCollider>();
|
||||
var belt = new AsteroidBelt(_context, beltObject, collider, planetData, AsteroidSpritesheetWidth, AsteroidSpritesheetHeight, ZoneSizeScale);
|
||||
var belt = new AsteroidBelt(_context, beltObject, collider, planetData.ID, AsteroidSpritesheetWidth, AsteroidSpritesheetHeight, ZoneSizeScale);
|
||||
_zoneBelts[_cache.Get<OrbitData>(planetData.Orbit).Parent] = belt;
|
||||
beltObject.GetComponent<ClickableCollider>().OnClick += (_, data) =>
|
||||
{
|
||||
if (data.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = planetData.Name;
|
||||
PropertiesPanel.AddSection("Asteroid Belt");
|
||||
PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
|
||||
PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
|
||||
{
|
||||
var itemData = _context.Cache.Get<SimpleCommodityData>(resource.Key);
|
||||
return new Tuple<string, string>(itemData.Name, $"{resource.Value:0}");
|
||||
}));
|
||||
}
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
{
|
||||
ShowContextMenu(planetData);
|
||||
}
|
||||
PopulatePropertiesPanel(planetData.ID);
|
||||
else if (data.button == PointerEventData.InputButton.Right)
|
||||
ShowContextMenu(planetData.ID);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -565,7 +710,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
foreach (var wormhole in zoneData.Wormholes)
|
||||
{
|
||||
var otherZone = _context.GalaxyZones[wormhole];
|
||||
var wormholeObject = Instantiate(ZoneObjectPrefab, ZoneRoot);
|
||||
var wormholeObject = Instantiate(ZoneGravityObjectPrefab, ZoneRoot);
|
||||
_wormholes.Add(wormholeObject);
|
||||
wormholeObject.transform.position = (Vector2) (_context.WormholePosition(zoneData.ID, wormhole) * ZoneSizeScale);
|
||||
wormholeObject.GravityMesh.gameObject.SetActive(false);
|
||||
|
|
@ -603,62 +748,71 @@ public class StrategyGameManager : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
|
||||
var loadoutData = _context.Cache.GetAll<LoadoutData>().FirstOrDefault(l => l.Name == args[1]);
|
||||
if (loadoutData == null)
|
||||
{
|
||||
Debug.Log($"Loadout with name \"{args[1]}\" not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
_context.CreateEntity(_populatedZone, _playerCorporation, loadoutData.ID);
|
||||
|
||||
// Parse first argument as hull name, default to Fighter if argument missing
|
||||
HullData hullData;
|
||||
if (args.Length > 1)
|
||||
{
|
||||
hullData = _cache.GetAll<HullData>().FirstOrDefault(h => h.Name == args[1]);
|
||||
if (hullData == null)
|
||||
{
|
||||
Debug.Log($"Hull with name \"{args[1]}\" not found!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hullData = _cache.GetAll<HullData>().FirstOrDefault(h => h.Name == "Fighter");
|
||||
}
|
||||
var hull = _context.CreateInstance(hullData.ID, .9f) as Gear;
|
||||
|
||||
List<Gear> gear = new List<Gear>();
|
||||
if (args.Length > 2)
|
||||
{
|
||||
foreach (string arg in args.Skip(2))
|
||||
{
|
||||
var gearData = _cache.GetAll<GearData>().FirstOrDefault(h => h.Name == arg);
|
||||
if (gearData == null)
|
||||
{
|
||||
Debug.Log($"Gear with name \"{arg}\" not found!");
|
||||
return;
|
||||
}
|
||||
gear.Add(_context.CreateInstance(gearData.ID, .9f) as Gear);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no gear arguments supplied and we're spawning a ship, get the first thruster and put it in
|
||||
if (args[0] == "ship")
|
||||
{
|
||||
var thrusterData = _cache.GetAll<GearData>().FirstOrDefault(g => g.Behaviors.Any(b => b is ThrusterData));
|
||||
var thruster = _context.CreateInstance(thrusterData.ID, .9f) as Gear;
|
||||
gear.Add(thruster);
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0] == "ship")
|
||||
{
|
||||
var entity = new Ship(_context, hull.ID, gear.Select(i=>i.ID), Enumerable.Empty<Guid>(), _populatedZone);
|
||||
_context.Cache.Add(entity);
|
||||
_context.ZoneEntities[_populatedZone][entity.ID] = entity;
|
||||
//_context.Agents.Add(new AgentController(_context, _populatedZone, entity.ID));
|
||||
var zoneShip = Instantiate(ZoneShipPrefab, ZoneRoot);
|
||||
zoneShip.Label.text = $"Ship {_zoneShips.Count}";
|
||||
_zoneShips[entity] = zoneShip;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"Unknown entity type: \"{args[0]}\"");
|
||||
}
|
||||
// HullData hullData;
|
||||
// if (args.Length > 1)
|
||||
// {
|
||||
// hullData = _cache.GetAll<HullData>().FirstOrDefault(h => h.Name == args[1]);
|
||||
// if (hullData == null)
|
||||
// {
|
||||
// Debug.Log($"Hull with name \"{args[1]}\" not found!");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// hullData = _cache.GetAll<HullData>().FirstOrDefault(h => h.Name == "Fighter");
|
||||
// }
|
||||
// var hull = _context.CreateInstance(hullData.ID, .9f) as Gear;
|
||||
//
|
||||
// List<Gear> gear = new List<Gear>();
|
||||
// if (args.Length > 2)
|
||||
// {
|
||||
// foreach (string arg in args.Skip(2))
|
||||
// {
|
||||
// var gearData = _cache.GetAll<GearData>().FirstOrDefault(h => h.Name == arg);
|
||||
// if (gearData == null)
|
||||
// {
|
||||
// Debug.Log($"Gear with name \"{arg}\" not found!");
|
||||
// return;
|
||||
// }
|
||||
// gear.Add(_context.CreateInstance(gearData.ID, .9f) as Gear);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // If no gear arguments supplied and we're spawning a ship, get the first thruster and put it in
|
||||
// if (args[0] == "ship")
|
||||
// {
|
||||
// var thrusterData = _cache.GetAll<GearData>().FirstOrDefault(g => g.Behaviors.Any(b => b is ThrusterData));
|
||||
// var thruster = _context.CreateInstance(thrusterData.ID, .9f) as Gear;
|
||||
// gear.Add(thruster);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (args[0] == "ship")
|
||||
// {
|
||||
// var entity = new Ship(_context, hull.ID, gear.Select(i=>i.ID), Enumerable.Empty<Guid>(), _populatedZone);
|
||||
// _context.Cache.Add(entity);
|
||||
// _context.ZoneEntities[_populatedZone][entity.ID] = entity;
|
||||
// //_context.Agents.Add(new AgentController(_context, _populatedZone, entity.ID));
|
||||
// var zoneShip = Instantiate(ZoneShipPrefab, ZoneRoot);
|
||||
// zoneShip.Label.text = $"Ship {_zoneShips.Count}";
|
||||
// _zoneShips[entity] = zoneShip;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.Log($"Unknown entity type: \"{args[0]}\"");
|
||||
// }
|
||||
}
|
||||
|
||||
void newzone(string[] args)
|
||||
|
|
@ -738,12 +892,12 @@ public class AsteroidBelt
|
|||
private Vector3[] _normals;
|
||||
private Vector2[] _uvs;
|
||||
private int[] _indices;
|
||||
private PlanetData _data;
|
||||
private Guid _data;
|
||||
private GameContext _context;
|
||||
private Mesh _mesh;
|
||||
private float _zoneScale;
|
||||
|
||||
public AsteroidBelt(GameContext context, MeshFilter meshFilter, MeshCollider collider, PlanetData data, int spritesheetWidth, int spritesheetHeight, float zoneScale)
|
||||
public AsteroidBelt(GameContext context, MeshFilter meshFilter, MeshCollider collider, Guid data, int spritesheetWidth, int spritesheetHeight, float zoneScale)
|
||||
{
|
||||
Transform = collider.transform;
|
||||
_context = context;
|
||||
|
|
@ -751,18 +905,19 @@ public class AsteroidBelt
|
|||
_filter = meshFilter;
|
||||
_collider = collider;
|
||||
_zoneScale = zoneScale;
|
||||
_vertices = new Vector3[data.Asteroids.Length*4];
|
||||
_normals = new Vector3[data.Asteroids.Length*4];
|
||||
_uvs = new Vector2[data.Asteroids.Length*4];
|
||||
_indices = new int[data.Asteroids.Length*6];
|
||||
var planetData = context.Cache.Get<PlanetData>(data);
|
||||
_vertices = new Vector3[planetData.Asteroids.Length*4];
|
||||
_normals = new Vector3[planetData.Asteroids.Length*4];
|
||||
_uvs = new Vector2[planetData.Asteroids.Length*4];
|
||||
_indices = new int[planetData.Asteroids.Length*6];
|
||||
|
||||
var maxDist = 0f;
|
||||
var spriteSize = float2(1f / spritesheetWidth, 1f / spritesheetHeight);
|
||||
// vertex order: bottom left, top left, top right, bottom right
|
||||
for (var i = 0; i < _data.Asteroids.Length; i++)
|
||||
for (var i = 0; i < planetData.Asteroids.Length; i++)
|
||||
{
|
||||
if (_data.Asteroids[i].x > maxDist)
|
||||
maxDist = _data.Asteroids[i].x;
|
||||
if (planetData.Asteroids[i].x > maxDist)
|
||||
maxDist = planetData.Asteroids[i].x;
|
||||
var spriteX = Random.Range(0, spritesheetWidth);
|
||||
var spriteY = Random.Range(0, spritesheetHeight);
|
||||
|
||||
|
|
@ -797,16 +952,16 @@ public class AsteroidBelt
|
|||
|
||||
public void Update()
|
||||
{
|
||||
for (var i = 0; i < _data.Asteroids.Length; i++)
|
||||
var planetData = _context.Cache.Get<PlanetData>(_data);
|
||||
var asteroidTransforms = _context.GetAsteroidTransforms(_data);
|
||||
for (var i = 0; i < planetData.Asteroids.Length; i++)
|
||||
{
|
||||
var rotation = Quaternion.Euler(0, 0, (float) (_context.Time * _data.Asteroids[i].w % 360.0));
|
||||
var position = (Vector3) (Vector2)
|
||||
OrbitData.Evaluate((float) frac(_context.Time / -_context.OrbitalPeriod(_data.Asteroids[i].x) *
|
||||
_context.GlobalData.OrbitSpeedMultiplier + _data.Asteroids[i].y)) * (_data.Asteroids[i].x * _zoneScale);
|
||||
_vertices[i * 4] = rotation * new Vector3(-_data.Asteroids[i].z,-_data.Asteroids[i].z,0) + position;
|
||||
_vertices[i * 4 + 1] = rotation * new Vector3(-_data.Asteroids[i].z,_data.Asteroids[i].z,0) + position;
|
||||
_vertices[i * 4 + 2] = rotation * new Vector3(_data.Asteroids[i].z,_data.Asteroids[i].z,0) + position;
|
||||
_vertices[i * 4 + 3] = rotation * new Vector3(_data.Asteroids[i].z,-_data.Asteroids[i].z,0) + position;
|
||||
var rotation = Quaternion.Euler(0, 0, asteroidTransforms[i].z);
|
||||
var position = (Vector3) (Vector2) asteroidTransforms[i].xy * _zoneScale;
|
||||
_vertices[i * 4] = rotation * new Vector3(-planetData.Asteroids[i].z,-planetData.Asteroids[i].z,0) + position;
|
||||
_vertices[i * 4 + 1] = rotation * new Vector3(-planetData.Asteroids[i].z,planetData.Asteroids[i].z,0) + position;
|
||||
_vertices[i * 4 + 2] = rotation * new Vector3(planetData.Asteroids[i].z,planetData.Asteroids[i].z,0) + position;
|
||||
_vertices[i * 4 + 3] = rotation * new Vector3(planetData.Asteroids[i].z,-planetData.Asteroids[i].z,0) + position;
|
||||
}
|
||||
|
||||
_mesh.vertices = _vertices;
|
||||
|
|
|
|||
|
|
@ -333,10 +333,10 @@ public class TechTreeMsagl : MonoBehaviour
|
|||
PropertiesPanel.Clear();
|
||||
var blueprint = (BlueprintData) vertex.UserData;
|
||||
PropertiesPanel.Title.text = blueprint.Name;
|
||||
PropertiesPanel.AddProperty("Research Time", $"{blueprint.ResearchTime:0.##} MH");
|
||||
PropertiesPanel.AddProperty("Produces", $"{blueprint.Quantity} {Context.Cache.Get<ItemData>(blueprint.Item).Name}");
|
||||
PropertiesPanel.AddProperty("Production Quality", $"{Mathf.RoundToInt(blueprint.Quality * 100)}%");
|
||||
PropertiesPanel.AddProperty("Production Time", $"{blueprint.ProductionTime:0.##} MH");
|
||||
PropertiesPanel.AddProperty("Research Time", () => $"{blueprint.ResearchTime:0.##} MH");
|
||||
PropertiesPanel.AddProperty("Produces", () => $"{blueprint.Quantity} {Context.Cache.Get<ItemData>(blueprint.Item).Name}");
|
||||
PropertiesPanel.AddProperty("Production Quality", () => $"{Mathf.RoundToInt(blueprint.Quality * 100)}%");
|
||||
PropertiesPanel.AddProperty("Production Time", () => $"{blueprint.ProductionTime:0.##} MH");
|
||||
PropertiesPanel.AddList("Ingredients", blueprint.Ingredients.Select(ingredient =>
|
||||
{
|
||||
var ingredientData = Context.Cache.Get<ItemData>(ingredient.Key);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
|
@ -7,4 +8,10 @@ public class PropertyLabel : MonoBehaviour
|
|||
{
|
||||
public TextMeshProUGUI Name;
|
||||
public TextMeshProUGUI Value;
|
||||
public Func<string> ValueFunction;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Value.text = ValueFunction?.Invoke() ?? "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ public class ReadOnlyPropertiesPanel : MonoBehaviour
|
|||
Destroy(property);
|
||||
}
|
||||
|
||||
public void AddProperty(string name, string value)
|
||||
public void AddProperty(string name, Func<string> value)
|
||||
{
|
||||
var property = Instantiate(PropertyPrefab, transform);
|
||||
property.Name.text = name;
|
||||
property.Value.text = value;
|
||||
property.ValueFunction = value;
|
||||
_properties.Add(property.gameObject);
|
||||
}
|
||||
|
||||
|
|
|
|||
9
Assets/Scripts/UI/ZoneGravityObject.cs
Normal file
9
Assets/Scripts/UI/ZoneGravityObject.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class ZoneGravityObject : ZoneObject
|
||||
{
|
||||
public MeshRenderer GravityMesh;
|
||||
}
|
||||
11
Assets/Scripts/UI/ZoneGravityObject.cs.meta
Normal file
11
Assets/Scripts/UI/ZoneGravityObject.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 17a379c98cd100d4c8548e22c676d246
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -5,9 +5,10 @@ using UnityEngine;
|
|||
|
||||
public class ZoneObject : MonoBehaviour
|
||||
{
|
||||
public MeshRenderer GravityMesh;
|
||||
|
||||
public MeshRenderer Icon;
|
||||
|
||||
public TextMeshPro Label;
|
||||
|
||||
[HideInInspector]
|
||||
public List<MeshRenderer> Children = new List<MeshRenderer>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 17a379c98cd100d4c8548e22c676d246
|
||||
guid: 4d8b39205d8cd404bae28355b1ed1596
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ using System.Collections.Generic;
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class ZoneShip : MonoBehaviour
|
||||
public class ZoneShip : ZoneObject
|
||||
{
|
||||
public MeshRenderer Icon;
|
||||
|
||||
public TextMeshPro Label;
|
||||
public Transform Thruster;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue