Game Loop
Player spawns in starter ship, is presented with a game over screen when they die, with the option to start over
This commit is contained in:
parent
cb4cb243e4
commit
f340e992ec
14 changed files with 340 additions and 159 deletions
|
|
@ -43,7 +43,7 @@ Material:
|
|||
- _AlphaFloor: 0
|
||||
- _DepthBlend: 512
|
||||
- _DepthCeiling: 4096
|
||||
- _Gamma: 0.45
|
||||
- _Gamma: 0.5
|
||||
- _GridCeilingBlend: -300
|
||||
- _GridCeilingDensity: 0.01
|
||||
- _GridCeilingFollow: 0
|
||||
|
|
@ -59,7 +59,7 @@ Material:
|
|||
- _NoiseStrength: 75
|
||||
- _SafetyDistance: 50
|
||||
- _StepExponent: 2
|
||||
- _TintExponent: 4
|
||||
- _TintExponent: 8
|
||||
m_Colors:
|
||||
- _Tint: {r: 0.75, g: 0.75, b: 0.75, a: 1}
|
||||
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ Material:
|
|||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Scale: 4.933006
|
||||
- _Scale: 8.983329
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
|
|
|
|||
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1609,7 +1609,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &134113272
|
||||
MonoBehaviour:
|
||||
|
|
@ -2332,7 +2332,7 @@ Transform:
|
|||
- {fileID: 488792361}
|
||||
- {fileID: 970624070}
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 7
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &204301709
|
||||
GameObject:
|
||||
|
|
@ -4230,6 +4230,18 @@ RectTransform:
|
|||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &346333149 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 1713457305180270767, guid: 2758dfa2744d7ad4d8877545189d116e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1554374157}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &359038938
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 3
|
||||
|
|
@ -8090,6 +8102,8 @@ MonoBehaviour:
|
|||
ButtonGroup: {fileID: 947321577}
|
||||
Cancel: {fileID: 1176624628}
|
||||
Confirm: {fileID: 843760693}
|
||||
ConfirmText: {fileID: 1183272246}
|
||||
CancelText: {fileID: 346333149}
|
||||
--- !u!114 &620555925
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -8972,7 +8986,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 7
|
||||
m_RootOrder: 8
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &677710706
|
||||
GameObject:
|
||||
|
|
@ -10750,6 +10764,54 @@ RectTransform:
|
|||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &803284854
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 803284855}
|
||||
- component: {fileID: 803284856}
|
||||
m_Layer: 8
|
||||
m_Name: Death Postprocessing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &803284855
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 803284854}
|
||||
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: 906767442}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &803284856
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 803284854}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sharedProfile: {fileID: 11400000, guid: 793d6584f1c67544abb5ac31b8d2a57d, type: 2}
|
||||
isGlobal: 1
|
||||
blendDistance: 0
|
||||
weight: 0
|
||||
priority: 3
|
||||
--- !u!1 &804489111
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -11180,7 +11242,7 @@ Transform:
|
|||
- {fileID: 1075335641}
|
||||
- {fileID: 166261017}
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 8
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &831892783
|
||||
GameObject:
|
||||
|
|
@ -11243,12 +11305,12 @@ Transform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 837424433}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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: 1665127616}
|
||||
m_RootOrder: 5
|
||||
m_Father: {fileID: 906767442}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &837424435
|
||||
MonoBehaviour:
|
||||
|
|
@ -11852,6 +11914,40 @@ Transform:
|
|||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &906767441
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 906767442}
|
||||
m_Layer: 0
|
||||
m_Name: PostProcessing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &906767442
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 906767441}
|
||||
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:
|
||||
- {fileID: 937280108}
|
||||
- {fileID: 1404901905}
|
||||
- {fileID: 837424434}
|
||||
- {fileID: 803284855}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &906882333
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -12358,12 +12454,12 @@ Transform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 937280107}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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: 1665127616}
|
||||
m_RootOrder: 3
|
||||
m_Father: {fileID: 906767442}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &937280109
|
||||
MonoBehaviour:
|
||||
|
|
@ -13313,8 +13409,11 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 39f95af24dd29a645895a57a75460b0c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
StarterShipTemplate: Longinus
|
||||
TargetSpottedBlinkFrequency: 20
|
||||
TargetSpottedBlinkOffset: -0.25
|
||||
DeathPPTransitionTime: 0
|
||||
DeathPP: {fileID: 0}
|
||||
HeatstrokePP: {fileID: 1404901906}
|
||||
SevereHeatstrokePP: {fileID: 837424435}
|
||||
HostileTargetIndicator: {fileID: 1787772783}
|
||||
|
|
@ -13357,7 +13456,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1009503731
|
||||
MonoBehaviour:
|
||||
|
|
@ -13927,7 +14026,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 8
|
||||
m_RootOrder: 9
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1019449643
|
||||
MonoBehaviour:
|
||||
|
|
@ -14061,7 +14160,7 @@ Transform:
|
|||
- {fileID: 1108843909}
|
||||
- {fileID: 1647230682}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!1 &1060591358
|
||||
GameObject:
|
||||
|
|
@ -15061,6 +15160,18 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1183272246 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 1713457305180270767, guid: 2758dfa2744d7ad4d8877545189d116e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1593845000}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1187323005
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -16820,12 +16931,12 @@ Transform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1404901904}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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: 1665127616}
|
||||
m_RootOrder: 4
|
||||
m_Father: {fileID: 906767442}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1404901906
|
||||
MonoBehaviour:
|
||||
|
|
@ -17929,7 +18040,7 @@ Transform:
|
|||
m_LocalScale: {x: 2.3802, y: 2.3802, z: 2.3802}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_RootOrder: 7
|
||||
m_LocalEulerAnglesHint: {x: 19.345, y: 0, z: 0}
|
||||
--- !u!1 &1523113324
|
||||
GameObject:
|
||||
|
|
@ -18343,7 +18454,7 @@ Transform:
|
|||
- {fileID: 1537342002}
|
||||
- {fileID: 39508928}
|
||||
m_Father: {fileID: 1665127616}
|
||||
m_RootOrder: 6
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1547889400
|
||||
MonoBehaviour:
|
||||
|
|
@ -18409,7 +18520,7 @@ PrefabInstance:
|
|||
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
value: 55.675
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
|
||||
type: 3}
|
||||
|
|
@ -19439,7 +19550,7 @@ PrefabInstance:
|
|||
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
value: 60.98
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
|
||||
type: 3}
|
||||
|
|
@ -20074,9 +20185,6 @@ Transform:
|
|||
- {fileID: 887677623}
|
||||
- {fileID: 393266592}
|
||||
- {fileID: 2115559090}
|
||||
- {fileID: 937280108}
|
||||
- {fileID: 1404901905}
|
||||
- {fileID: 837424434}
|
||||
- {fileID: 1547889399}
|
||||
- {fileID: 199435031}
|
||||
- {fileID: 826773974}
|
||||
|
|
@ -23566,7 +23674,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2101419017
|
||||
GameObject:
|
||||
|
|
|
|||
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile Death.asset
(Stored with Git LFS)
Normal file
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile Death.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 793d6584f1c67544abb5ac31b8d2a57d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile Heatstroke.asset
(Stored with Git LFS)
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile Heatstroke.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile Severe Heatstroke.asset
(Stored with Git LFS)
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile Severe Heatstroke.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile.asset
(Stored with Git LFS)
BIN
Assets/Scenes/ARPG_Profiles/Postprocessing Profile.asset
(Stored with Git LFS)
Binary file not shown.
|
|
@ -23,8 +23,11 @@ using Random = UnityEngine.Random;
|
|||
|
||||
public class ActionGameManager : MonoBehaviour
|
||||
{
|
||||
public string StarterShipTemplate = "Longinus";
|
||||
public float TargetSpottedBlinkFrequency = 20;
|
||||
public float TargetSpottedBlinkOffset = -.25f;
|
||||
public float DeathPPTransitionTime;
|
||||
public PostProcessVolume DeathPP;
|
||||
public PostProcessVolume HeatstrokePP;
|
||||
public PostProcessVolume SevereHeatstrokePP;
|
||||
public Prototype HostileTargetIndicator;
|
||||
|
|
@ -65,7 +68,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
private Ship _currentShip;
|
||||
|
||||
// private ShipInput _shipInput;
|
||||
private List<Agent> _shipAgents = new List<Agent>();
|
||||
private float2 _shipYawPitch;
|
||||
private float3 _viewDirection;
|
||||
private (HardpointData[] hardpoints, Transform[] barrels, PlaceUIElementWorldspace crosshair)[] _articulationGroups;
|
||||
|
|
@ -118,6 +120,10 @@ public class ActionGameManager : MonoBehaviour
|
|||
if (CurrentShip != null)
|
||||
{
|
||||
CurrentShip.Deactivate();
|
||||
if (CurrentShip.Zone != null)
|
||||
{
|
||||
CurrentShip.Zone.Entities.Remove(CurrentShip);
|
||||
}
|
||||
CurrentShip.Zone = Zone;
|
||||
Zone.Entities.Add(CurrentShip);
|
||||
CurrentShip.Activate();
|
||||
|
|
@ -126,7 +132,64 @@ public class ActionGameManager : MonoBehaviour
|
|||
SectorRenderer.LoadZone(Zone);
|
||||
|
||||
if (CurrentShip != null)
|
||||
{
|
||||
DisposeEntityBinding();
|
||||
BindToEntity();
|
||||
}
|
||||
|
||||
var testCorp = new MegaCorporation();
|
||||
testCorp.Name = "TestCorp";
|
||||
testCorp.PlayerHostile = true;
|
||||
|
||||
var stationType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Station);
|
||||
var stationHull = ItemManager.CreateInstance(stationType) as EquippableItem;
|
||||
var stationParent = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(3);
|
||||
var stationParentOrbit = stationParent.Orbit.Data.ID;
|
||||
var stationParentPos = Zone.GetOrbitPosition(stationParentOrbit);
|
||||
var stationPos = stationParentPos + ItemManager.Random.NextFloat2Direction() * stationParent.GravityWellRadius.Value * .1f;
|
||||
var stationOrbit = Zone.CreateOrbit(stationParentOrbit, stationPos);
|
||||
var station = new OrbitalEntity(ItemManager, Zone, stationHull, stationOrbit.ID);
|
||||
//station.Faction = testCorp;
|
||||
Zone.Entities.Add(station);
|
||||
var dockingBayData = ItemData.GetAll<DockingBayData>().First();
|
||||
var dockingBay = ItemManager.CreateInstance(dockingBayData) as EquippableItem;
|
||||
station.TryEquip(dockingBay);
|
||||
station.Activate();
|
||||
|
||||
var turretLoadout = Loadouts.First(x => x.Name == "Turret");
|
||||
|
||||
for(int i=0; i<3; i++)
|
||||
{
|
||||
var planet = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(4+i);
|
||||
var planetOrbit = planet.Orbit.Data.ID;
|
||||
var planetPos = Zone.GetOrbitPosition(planetOrbit);
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
var pos = planetPos + ItemManager.Random.NextFloat2Direction() * planet.GravityWellRadius.Value * (.1f + .1f * j);
|
||||
var orbit = Zone.CreateOrbit(planetOrbit, pos);
|
||||
var turret = EntityPack.Unpack(ItemManager, Zone, turretLoadout, orbit.ID, true);
|
||||
turret.Activate();
|
||||
turret.Name = $"Turret {i}-{(char) ('A' + j)}";
|
||||
turret.Faction = testCorp;
|
||||
Zone.Entities.Add(turret);
|
||||
}
|
||||
}
|
||||
|
||||
var enemyShipLoadout = Loadouts.First(x => ((HullData) ItemManager.GetData(x.Hull)).HullType == HullType.Ship);
|
||||
var enemyShip = EntityPack.Unpack(ItemManager, Zone, enemyShipLoadout, true);
|
||||
enemyShip.Faction = testCorp;
|
||||
enemyShip.Activate();
|
||||
Zone.Entities.Add(enemyShip);
|
||||
Zone.Agents.Add(CreateAgent(enemyShip));
|
||||
}
|
||||
|
||||
private Agent CreateAgent(Ship ship)
|
||||
{
|
||||
var agent = new Minion(ship);
|
||||
var task = new PatrolOrbitsTask();
|
||||
task.Circuit = Zone.Orbits.OrderBy(_ => Random.value).Take(4).Select(x => x.Key).ToArray();
|
||||
agent.Task = task;
|
||||
return agent;
|
||||
}
|
||||
|
||||
void Start()
|
||||
|
|
@ -154,8 +217,8 @@ public class ActionGameManager : MonoBehaviour
|
|||
.Select(fi => MessagePackSerializer.Deserialize<EntityPack>(File.ReadAllBytes(fi.FullName))));
|
||||
|
||||
//var zoneFile = Path.Combine(_filePath.FullName, "Home.zone");
|
||||
|
||||
GenerateLevel();
|
||||
|
||||
#region Input Handling
|
||||
|
||||
_input = new AetheriaInput();
|
||||
_input.Global.Enable();
|
||||
|
|
@ -419,6 +482,9 @@ public class ActionGameManager : MonoBehaviour
|
|||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
StartGame();
|
||||
// ConsoleController.AddCommand("editmode", _ => ToggleEditMode());
|
||||
ConsoleController.AddCommand("savezone", args =>
|
||||
{
|
||||
|
|
@ -426,69 +492,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
Zone.Data.Name = args[0];
|
||||
SaveZone();
|
||||
});
|
||||
|
||||
var testCorp = new MegaCorporation();
|
||||
testCorp.Name = "TestCorp";
|
||||
testCorp.PlayerHostile = true;
|
||||
|
||||
var stationType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Station);
|
||||
var stationHull = ItemManager.CreateInstance(stationType) as EquippableItem;
|
||||
var stationParent = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(3);
|
||||
var stationParentOrbit = stationParent.Orbit.Data.ID;
|
||||
var stationParentPos = Zone.GetOrbitPosition(stationParentOrbit);
|
||||
var stationPos = stationParentPos + ItemManager.Random.NextFloat2Direction() * stationParent.GravityWellRadius.Value * .1f;
|
||||
var stationOrbit = Zone.CreateOrbit(stationParentOrbit, stationPos);
|
||||
var station = new OrbitalEntity(ItemManager, Zone, stationHull, stationOrbit.ID);
|
||||
station.Faction = testCorp;
|
||||
Zone.Entities.Add(station);
|
||||
var dockingBayData = ItemData.GetAll<DockingBayData>().First();
|
||||
var dockingBay = ItemManager.CreateInstance(dockingBayData) as EquippableItem;
|
||||
station.TryEquip(dockingBay);
|
||||
station.Activate();
|
||||
|
||||
var turretLoadout = Loadouts.First(x => x.Name == "Turret");
|
||||
|
||||
for(int i=0; i<3; i++)
|
||||
{
|
||||
var planet = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(4+i);
|
||||
var planetOrbit = planet.Orbit.Data.ID;
|
||||
var planetPos = Zone.GetOrbitPosition(planetOrbit);
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
var pos = planetPos + ItemManager.Random.NextFloat2Direction() * planet.GravityWellRadius.Value * (.1f + .1f * j);
|
||||
var orbit = Zone.CreateOrbit(planetOrbit, pos);
|
||||
var turret = EntityPack.Unpack(ItemManager, Zone, turretLoadout, orbit.ID, true);
|
||||
turret.Activate();
|
||||
turret.Name = $"Turret {i}-{(char) ('A' + j)}";
|
||||
turret.Faction = testCorp;
|
||||
Zone.Entities.Add(turret);
|
||||
}
|
||||
}
|
||||
|
||||
var enemyShipLoadout = Loadouts.First(x => ((HullData) ItemManager.GetData(x.Hull)).HullType == HullType.Ship);
|
||||
var enemyShip = EntityPack.Unpack(ItemManager, Zone, enemyShipLoadout, true);
|
||||
enemyShip.Faction = testCorp;
|
||||
enemyShip.Activate();
|
||||
Zone.Entities.Add(enemyShip);
|
||||
var agent = new Minion(enemyShip);
|
||||
var task = new PatrolOrbitsTask();
|
||||
task.Circuit = Zone.Orbits.OrderBy(_ => Random.value).Take(4).Select(x => x.Key).ToArray();
|
||||
agent.Task = task;
|
||||
_shipAgents.Add(agent);
|
||||
|
||||
DockedEntity = station;
|
||||
SectorRenderer.PerspectiveEntity = DockedEntity;
|
||||
DockingBay = station.DockingBays.First();
|
||||
DockCamera.enabled = true;
|
||||
FollowCamera.enabled = false;
|
||||
DockCamera.Follow = SectorRenderer.EntityInstances[station].transform;
|
||||
var parentOrbit = Zone.Orbits[station.OrbitData].Data.Parent;
|
||||
var parentPlanet = SectorRenderer.Planets[Zone.Planets.FirstOrDefault(p => p.Value.Orbit == parentOrbit).Key];
|
||||
DockCamera.LookAt = parentPlanet.Body.transform;
|
||||
Menu.ShowTab(MenuTab.Inventory);
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
_input.Player.Disable();
|
||||
GameplayUI.SetActive(false);
|
||||
|
||||
// MapButton.onClick.AddListener(() =>
|
||||
// {
|
||||
|
|
@ -501,6 +504,20 @@ public class ActionGameManager : MonoBehaviour
|
|||
//InventoryPanel.Display(ItemManager, entity);
|
||||
}
|
||||
|
||||
private void StartGame()
|
||||
{
|
||||
GenerateLevel();
|
||||
CurrentShip = EntityPack.Unpack(ItemManager, Zone, Loadouts.First(x => x.Name == StarterShipTemplate), true);
|
||||
CurrentShip.Zone = Zone;
|
||||
Zone.Entities.Add(CurrentShip);
|
||||
CurrentShip.Activate();
|
||||
BindToEntity();
|
||||
CurrentShip.ExitWormhole(
|
||||
SectorRenderer.WormholeInstances.Keys.First().Position,
|
||||
ItemManager.Random.NextFloat2Direction() * Settings.GameplaySettings.WormholeExitVelocity);
|
||||
EnterOverworld();
|
||||
}
|
||||
|
||||
public void Dock()
|
||||
{
|
||||
if (CurrentShip.Parent != null) return;
|
||||
|
|
@ -512,8 +529,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
var bay = entity.TryDock(CurrentShip);
|
||||
if (bay != null)
|
||||
{
|
||||
foreach(var subscription in _shipSubscriptions) subscription.Dispose();
|
||||
_shipSubscriptions.Clear();
|
||||
DisposeEntityBinding();
|
||||
DockedEntity = entity;
|
||||
SectorRenderer.PerspectiveEntity = DockedEntity;
|
||||
DockingBay = bay;
|
||||
|
|
@ -525,11 +541,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
var parentPlanet = SectorRenderer.Planets[Zone.Planets.FirstOrDefault(p => p.Value.Orbit == parentOrbit).Key];
|
||||
DockCamera.LookAt = parentPlanet.Body.transform;
|
||||
Menu.ShowTab(MenuTab.Inventory);
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
_input.Player.Disable();
|
||||
GameplayUI.SetActive(false);
|
||||
if(_lockingIndicators!=null) foreach(var (_, indicator, _) in _lockingIndicators)
|
||||
indicator.GetComponent<Prototype>().ReturnToPool();
|
||||
AkSoundEngine.PostEvent("Dock", gameObject);
|
||||
return;
|
||||
}
|
||||
|
|
@ -564,35 +575,9 @@ public class ActionGameManager : MonoBehaviour
|
|||
}
|
||||
else if (CurrentShip.Parent.TryUndock(CurrentShip))
|
||||
{
|
||||
Menu.gameObject.SetActive(false);
|
||||
DockedEntity = null;
|
||||
DockingBay = null;
|
||||
//_shipInput = new ShipInput(_input.Player, _currentShip);
|
||||
DockCamera.enabled = false;
|
||||
FollowCamera.enabled = true;
|
||||
|
||||
BindToEntity();
|
||||
|
||||
_lockingIndicators = CurrentShip.GetBehaviors<LockWeapon>()
|
||||
.Select(x =>
|
||||
{
|
||||
var i = LockIndicator.Instantiate<PlaceUIElementWorldspace>();
|
||||
return (x, i, i.GetComponent<Rotate>());
|
||||
}).ToArray();
|
||||
|
||||
// CurrentShip.HullDamage.Subscribe(f =>
|
||||
// {
|
||||
// if (float.IsNaN(CurrentShip.Hull.Durability))
|
||||
// Debug.Log("WTF!");
|
||||
// });
|
||||
|
||||
//_shipSubscriptions.Add(CurrentShip.HeatstrokeRisk.Subscribe(_ => _severeHeatstrokePhase = 0));
|
||||
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
GameplayUI.SetActive(true);
|
||||
_input.Player.Enable();
|
||||
ShipPanel.Display(CurrentShip, true);
|
||||
SchematicDisplay.ShowShip(CurrentShip);
|
||||
EnterOverworld();
|
||||
AkSoundEngine.PostEvent("Undock", gameObject);
|
||||
}
|
||||
else
|
||||
|
|
@ -603,6 +588,39 @@ public class ActionGameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void DisposeEntityBinding()
|
||||
{
|
||||
foreach (var indicator in _visibleHostileIndicators)
|
||||
{
|
||||
Destroy(indicator.Value.gameObject);
|
||||
}
|
||||
|
||||
_visibleHostileIndicators.Clear();
|
||||
if(_lockingIndicators!=null) foreach(var (_, indicator, _) in _lockingIndicators)
|
||||
indicator.GetComponent<Prototype>().ReturnToPool();
|
||||
_input.Player.Disable();
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
GameplayUI.SetActive(false);
|
||||
|
||||
foreach(var subscription in _shipSubscriptions) subscription.Dispose();
|
||||
_shipSubscriptions.Clear();
|
||||
}
|
||||
|
||||
private void EnterOverworld()
|
||||
{
|
||||
Menu.gameObject.SetActive(false);
|
||||
DockedEntity = null;
|
||||
DockingBay = null;
|
||||
DockCamera.enabled = false;
|
||||
FollowCamera.enabled = true;
|
||||
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
GameplayUI.SetActive(true);
|
||||
_input.Player.Enable();
|
||||
ShipPanel.Display(CurrentShip, true);
|
||||
SchematicDisplay.ShowShip(CurrentShip);
|
||||
}
|
||||
|
||||
private void BindToEntity()
|
||||
{
|
||||
SectorRenderer.PerspectiveEntity = CurrentShip;
|
||||
|
|
@ -627,9 +645,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
foreach (var group in _articulationGroups)
|
||||
group.crosshair.gameObject.SetActive(true);
|
||||
|
||||
foreach(var subscription in _shipSubscriptions) subscription.Dispose();
|
||||
_shipSubscriptions.Clear();
|
||||
|
||||
_shipSubscriptions.Add(CurrentShip.Target.Subscribe(target =>
|
||||
{
|
||||
TargetIndicator.gameObject.SetActive(CurrentShip.Target.Value != null);
|
||||
|
|
@ -656,6 +671,37 @@ public class ActionGameManager : MonoBehaviour
|
|||
_visibleHostileIndicators[removeEvent.Value].GetComponent<Prototype>().ReturnToPool();
|
||||
_visibleHostileIndicators.Remove(removeEvent.Value);
|
||||
}));
|
||||
|
||||
_shipSubscriptions.Add(CurrentShip.Death.Subscribe(_ =>
|
||||
{
|
||||
var deathTime = Time.time;
|
||||
DisposeEntityBinding();
|
||||
CurrentShip = null;
|
||||
ConfirmationDialog.Clear();
|
||||
ConfirmationDialog.Title.text = "You have died!";
|
||||
ConfirmationDialog.Show(StartGame, null, "Try again!");
|
||||
Observable.EveryUpdate()
|
||||
.Select(_ => (Time.time - deathTime) / DeathPPTransitionTime)
|
||||
.Where(t => t < 1)
|
||||
.Subscribe(t =>
|
||||
{
|
||||
HeatstrokePP.weight = 1 - t;
|
||||
SevereHeatstrokePP.weight = 1 - t;
|
||||
DeathPP.weight = t;
|
||||
}, () =>
|
||||
{
|
||||
HeatstrokePP.weight = 0;
|
||||
SevereHeatstrokePP.weight = 0;
|
||||
DeathPP.weight = 1;
|
||||
});
|
||||
}));
|
||||
|
||||
_lockingIndicators = CurrentShip.GetBehaviors<LockWeapon>()
|
||||
.Select(x =>
|
||||
{
|
||||
var i = LockIndicator.Instantiate<PlaceUIElementWorldspace>();
|
||||
return (x, i, i.GetComponent<Rotate>());
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
public void SaveZone() => File.WriteAllBytes(
|
||||
|
|
@ -720,8 +766,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
max(Settings.HeatstrokePhasingFloor, sin(Time.time * Settings.HeatstrokePhasingFrequency));
|
||||
}
|
||||
}
|
||||
foreach(var agent in _shipAgents)
|
||||
agent.Update(Time.deltaTime);
|
||||
Zone.Update(_time, Time.deltaTime);
|
||||
SectorRenderer.GameTime = _time;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,11 +118,13 @@ public abstract class Entity
|
|||
public Subject<float> HullDamage = new Subject<float>();
|
||||
public Subject<Entity> Docked = new Subject<Entity>();
|
||||
public Subject<Unit> HeatstrokeRisk = new Subject<Unit>();
|
||||
public Subject<Unit> HeatstrokeDeath = new Subject<Unit>();
|
||||
|
||||
public UniRx.IObservable<EquippedItem> ItemDestroyed;
|
||||
public UniRx.IObservable<int2> HullArmorDepleted;
|
||||
public UniRx.IObservable<HardpointData> HardpointArmorDepleted;
|
||||
public UniRx.IObservable<Weapon> WeaponDestroyed;
|
||||
public UniRx.IObservable<Unit> Death;
|
||||
|
||||
private List<IDisposable> _subscriptions = new List<IDisposable>();
|
||||
|
||||
|
|
@ -175,6 +177,7 @@ public abstract class Entity
|
|||
ItemDestroyed = ItemDamage.Where(x => x.item.EquippableItem.Durability < .01f).Select(x=>x.item);
|
||||
WeaponDestroyed = ItemDestroyed.Select(x => x.Behaviors.FirstOrDefault(b => b is Weapon) as Weapon).Where(x => x != null);
|
||||
HullArmorDepleted = ArmorDamage.Where(x => Armor[x.pos.x, x.pos.y] < .01f).Select(x => x.pos);
|
||||
Death = HullDamage.Select(_ => Unit.Default).Where(_ => Hull.Durability < .01f).Merge(HeatstrokeDeath);
|
||||
|
||||
EntityInfoGathered.ObserveReplace().Subscribe(replace =>
|
||||
{
|
||||
|
|
@ -742,26 +745,32 @@ public abstract class Entity
|
|||
|
||||
UpdateTemperature(delta);
|
||||
|
||||
if(Cockpit != null)
|
||||
{
|
||||
if (Cockpit.Item.Temperature > ItemManager.GameplaySettings.HeatstrokeTemperature)
|
||||
{
|
||||
var previous = Heatstroke;
|
||||
Heatstroke = saturate(
|
||||
Heatstroke +
|
||||
pow(Cockpit.Item.Temperature - ItemManager.GameplaySettings.HeatstrokeTemperature, ItemManager.GameplaySettings.HeatstrokeExponent) *
|
||||
ItemManager.GameplaySettings.HeatstrokeMultiplier * delta);
|
||||
if(previous < ItemManager.GameplaySettings.SevereHeatstrokeRiskThreshold && Heatstroke > ItemManager.GameplaySettings.SevereHeatstrokeRiskThreshold)
|
||||
HeatstrokeRisk.OnNext(Unit.Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
Heatstroke = saturate(Heatstroke - ItemManager.GameplaySettings.HeatstrokeRecoverySpeed * delta);
|
||||
}
|
||||
}
|
||||
|
||||
if (_active)
|
||||
{
|
||||
if(Cockpit != null)
|
||||
{
|
||||
if (Cockpit.Item.Temperature > ItemManager.GameplaySettings.HeatstrokeTemperature)
|
||||
{
|
||||
var previous = Heatstroke;
|
||||
Heatstroke = saturate(
|
||||
Heatstroke +
|
||||
pow(Cockpit.Item.Temperature - ItemManager.GameplaySettings.HeatstrokeTemperature, ItemManager.GameplaySettings.HeatstrokeExponent) *
|
||||
ItemManager.GameplaySettings.HeatstrokeMultiplier * delta);
|
||||
if(previous < ItemManager.GameplaySettings.SevereHeatstrokeRiskThreshold && Heatstroke > ItemManager.GameplaySettings.SevereHeatstrokeRiskThreshold)
|
||||
HeatstrokeRisk.OnNext(Unit.Default);
|
||||
if(Heatstroke > 1)
|
||||
{
|
||||
HeatstrokeDeath.OnNext(Unit.Default);
|
||||
Deactivate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Heatstroke = saturate(Heatstroke - ItemManager.GameplaySettings.HeatstrokeRecoverySpeed * delta);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var equippedItem in _orderedEquipment)
|
||||
{
|
||||
equippedItem.Update(delta);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public class Zone
|
|||
|
||||
private float _time;
|
||||
private Random _random;
|
||||
public List<Agent> Agents = new List<Agent>();
|
||||
|
||||
public ZoneData Data { get; }
|
||||
private List<Task> BeltUpdates = new List<Task>();
|
||||
|
|
@ -107,6 +108,9 @@ public class Zone
|
|||
BeltUpdates.Add(Task.Run(() => UpdateAsteroidTransformsAsync(belt.Key)));
|
||||
}
|
||||
|
||||
foreach(var agent in Agents)
|
||||
agent.Update(deltaTime);
|
||||
|
||||
foreach (var entity in Entities) entity.Update(deltaTime);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
|
@ -15,6 +16,8 @@ public class ConfirmationDialog : PropertiesPanel
|
|||
public GameObject ButtonGroup;
|
||||
public Button Cancel;
|
||||
public Button Confirm;
|
||||
public TextMeshProUGUI ConfirmText;
|
||||
public TextMeshProUGUI CancelText;
|
||||
|
||||
private Action _onCancel;
|
||||
private Action _onConfirm;
|
||||
|
|
@ -52,15 +55,17 @@ public class ConfirmationDialog : PropertiesPanel
|
|||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void Show(Action onConfirm = null, Action onCancel = null)
|
||||
public void Show(Action onConfirm = null, Action onCancel = null, string confirmText = "OK", string cancelText = "Cancel")
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
_onConfirm = onConfirm;
|
||||
Confirm.gameObject.SetActive(onConfirm!=null);
|
||||
ConfirmText.text = confirmText;
|
||||
|
||||
_onCancel = onCancel;
|
||||
Cancel.gameObject.SetActive(onCancel!=null);
|
||||
CancelText.text = cancelText;
|
||||
|
||||
ButtonGroup.SetActive(onConfirm!=null || onCancel!=null);
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue