Galaxy View Collider Hotfix
THERE, clicking on sectors should be better now
This commit is contained in:
parent
d78ad49762
commit
68473a84ab
3 changed files with 46 additions and 52 deletions
|
|
@ -3919,8 +3919,6 @@ GameObject:
|
|||
- component: {fileID: 515449810}
|
||||
- component: {fileID: 515449813}
|
||||
- component: {fileID: 515449812}
|
||||
- component: {fileID: 515449811}
|
||||
- component: {fileID: 515449814}
|
||||
m_Layer: 0
|
||||
m_Name: Background
|
||||
m_TagString: Untagged
|
||||
|
|
@ -3942,20 +3940,6 @@ Transform:
|
|||
m_Father: {fileID: 559120530}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!64 &515449811
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 515449809}
|
||||
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!23 &515449812
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -4001,18 +3985,6 @@ MeshFilter:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 515449809}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!114 &515449814
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 515449809}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52538a3309c36fc4583c964a1c0b705f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &519035860
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -18617,6 +18589,8 @@ GameObject:
|
|||
- component: {fileID: 1873099341}
|
||||
- component: {fileID: 1873099344}
|
||||
- component: {fileID: 1873099343}
|
||||
- component: {fileID: 1873099342}
|
||||
- component: {fileID: 1873099345}
|
||||
m_Layer: 0
|
||||
m_Name: Icon
|
||||
m_TagString: Untagged
|
||||
|
|
@ -18638,6 +18612,18 @@ Transform:
|
|||
m_Father: {fileID: 559120530}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1873099342
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1873099340}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52538a3309c36fc4583c964a1c0b705f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!23 &1873099343
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -18683,6 +18669,20 @@ MeshFilter:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1873099340}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!64 &1873099345
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1873099340}
|
||||
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!1001 &1889382509
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using static Unity.Mathematics.math;
|
|||
using float2 = Unity.Mathematics.float2;
|
||||
using Random = Unity.Mathematics.Random;
|
||||
using JM.LinqFaster;
|
||||
using float4 = Unity.Mathematics.float4;
|
||||
|
||||
public class GameContext
|
||||
{
|
||||
|
|
@ -35,7 +36,6 @@ public class GameContext
|
|||
private Dictionary<(Guid, int), float> _asteroidRespawnTimers = new Dictionary<(Guid, int), float>();
|
||||
private Dictionary<(Guid, int), float> _asteroidDamage = new Dictionary<(Guid, int), float>();
|
||||
private Dictionary<(Guid, Guid, int), float> _asteroidMiningAccumulator = new Dictionary<(Guid, Guid, int), float>();
|
||||
private Dictionary<Guid, bool> _asteroidPositionsUpdated = new Dictionary<Guid, bool>();
|
||||
private Guid _forceLoadZone;
|
||||
private Type[] _statObjects;
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ public class GameContext
|
|||
}
|
||||
|
||||
foreach (var asteroids in _asteroidTransforms.Keys)
|
||||
_asteroidPositionsUpdated[asteroids] = false;
|
||||
UpdateAsteroidTransforms(asteroids);
|
||||
|
||||
foreach (var corporation in Cache.GetAll<Corporation>())
|
||||
{
|
||||
|
|
@ -164,6 +164,14 @@ public class GameContext
|
|||
|
||||
// TODO: Associate planets with stored entities for planetary colonies
|
||||
ZonePlanets[zone] = zoneData.Planets;
|
||||
|
||||
foreach (var belt in zoneData.Planets
|
||||
.Select(id => Cache.Get<PlanetData>(id))
|
||||
.Where(p => p.Belt))
|
||||
{
|
||||
_asteroidTransforms[belt.ID] = new float4[belt.Asteroids.Length];
|
||||
_previousAsteroidTransforms[belt.ID] = new float4[belt.Asteroids.Length];
|
||||
}
|
||||
|
||||
// TODO: Load stored entities
|
||||
ZoneEntities[zone] = new Dictionary<Guid, Entity>();
|
||||
|
|
@ -177,6 +185,13 @@ public class GameContext
|
|||
ZoneEntities.Remove(zone);
|
||||
ZonePlanets.Remove(zone);
|
||||
foreach (var orbit in zoneData.Orbits) _orbits.Remove(orbit);
|
||||
foreach (var belt in zoneData.Planets
|
||||
.Select(id => Cache.Get<PlanetData>(id))
|
||||
.Where(p => p.Belt))
|
||||
{
|
||||
_asteroidTransforms.Remove(belt.ID);
|
||||
_previousAsteroidTransforms.Remove(belt.ID);
|
||||
}
|
||||
}
|
||||
|
||||
public void Warp(Entity entity, Guid targetZone)
|
||||
|
|
@ -262,24 +277,16 @@ public class GameContext
|
|||
|
||||
public float2 GetAsteroidVelocity(Guid planetDataID, int asteroid)
|
||||
{
|
||||
UpdateAsteroidTransforms(planetDataID);
|
||||
|
||||
if (!_previousAsteroidTransforms.ContainsKey(planetDataID))
|
||||
return float2.zero;
|
||||
|
||||
return (_asteroidTransforms[planetDataID][asteroid].xy - _previousAsteroidTransforms[planetDataID][asteroid].xy) / _deltaTime;
|
||||
}
|
||||
|
||||
public float4 GetAsteroidTransform(Guid planetDataID, int asteroid)
|
||||
{
|
||||
UpdateAsteroidTransforms(planetDataID);
|
||||
return _asteroidTransforms[planetDataID][asteroid];
|
||||
}
|
||||
|
||||
public float4[] GetAsteroidTransforms(Guid planetDataID)
|
||||
{
|
||||
UpdateAsteroidTransforms(planetDataID);
|
||||
|
||||
return _asteroidTransforms[planetDataID];
|
||||
}
|
||||
|
||||
|
|
@ -287,17 +294,6 @@ public class GameContext
|
|||
{
|
||||
var planetData = Cache.Get<PlanetData>(planetDataID);
|
||||
|
||||
if (!_asteroidTransforms.ContainsKey(planetDataID))
|
||||
{
|
||||
_asteroidTransforms[planetDataID] = new float4[planetData.Asteroids.Length];
|
||||
_asteroidPositionsUpdated[planetDataID] = false;
|
||||
}
|
||||
|
||||
if (_asteroidPositionsUpdated[planetDataID])
|
||||
return;
|
||||
|
||||
if (!_previousAsteroidTransforms.ContainsKey(planetDataID))
|
||||
_previousAsteroidTransforms[planetDataID] = new float4[planetData.Asteroids.Length];
|
||||
Array.Copy(_asteroidTransforms[planetDataID], _previousAsteroidTransforms[planetDataID], planetData.Asteroids.Length);
|
||||
|
||||
var orbitData = Cache.Get<OrbitData>(planetData.Orbit);
|
||||
|
|
@ -319,8 +315,6 @@ public class GameContext
|
|||
planetData.Asteroids[i].Phase)) * planetData.Asteroids[i].Distance + orbitPosition,
|
||||
(float) (Time * planetData.Asteroids[i].RotationSpeed % 360.0), size);
|
||||
}
|
||||
|
||||
_asteroidPositionsUpdated[planetDataID] = true;
|
||||
}
|
||||
|
||||
public OrbitData CreateOrbit(Guid zone, Guid parent, float2 position)
|
||||
|
|
|
|||
|
|
@ -756,7 +756,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
var instanceZone = instance.GetComponent<GalaxyZone>();
|
||||
_galaxyZoneObjects[zone.ZoneID] = instanceZone;
|
||||
instanceZone.Label.text = zone.Name;
|
||||
instanceZone.Background.GetComponent<ClickableCollider>().OnClick += (_, pointer) =>
|
||||
instanceZone.Icon.GetComponent<ClickableCollider>().OnClick += (_, pointer) =>
|
||||
{
|
||||
if (_selectedGalaxyZone != null)
|
||||
_selectedGalaxyZone.Background.material.SetColor("_TintColor", UnselectedColor);
|
||||
|
|
|
|||
Loading…
Reference in a new issue