Finished Map Tab

This commit is contained in:
Reinier Vens 2020-12-18 13:48:03 +00:00
commit 615cc4e936
43 changed files with 8383 additions and 920 deletions

View file

@ -32,6 +32,7 @@ public class ActionGameManager : MonoBehaviour
private float _time;
private AetheriaInput _input;
private int _zoomLevelIndex;
public List<Ship> PlayerShips { get; } = new List<Ship>();
public DatabaseCache ItemData { get; private set; }
public ItemManager ItemManager { get; private set; }
@ -73,22 +74,27 @@ public class ActionGameManager : MonoBehaviour
SectorRenderer.MinimapDistance = Settings.MinimapZoomLevels[_zoomLevelIndex];
};
// _input.Global.MapToggle.performed += context =>
// {
// MapView.enabled = !MapView.enabled;
// GameplayUI.SetActive(!MapView.enabled);
// if (MapView.enabled)
// {
// MapView.BindInput(_input.UI);
// _input.Player.Disable();
// }
// else
// {
// _input.Player.Enable();
// SectorRenderer.ViewDistance = Settings.DefaultViewDistance;
// SectorRenderer.MinimapDistance = Settings.MinimapZoomLevels[_zoomLevelIndex];
// }
// };
_input.Global.MapToggle.performed += context =>
{
if (Menu.gameObject.activeSelf && Menu.CurrentTab == MenuTab.Map)
{
Menu.gameObject.SetActive(false);
return;
}
Menu.ShowTab(MenuTab.Map);
};
_input.Global.Inventory.performed += context =>
{
if (Menu.gameObject.activeSelf && Menu.CurrentTab == MenuTab.Inventory)
{
Menu.gameObject.SetActive(false);
return;
}
Menu.ShowTab(MenuTab.Inventory);
};
ConsoleController.AddCommand("editmode", _ => ToggleEditMode());
ConsoleController.AddCommand("savezone", args =>
@ -98,6 +104,20 @@ public class ActionGameManager : MonoBehaviour
SaveZone();
});
var stationType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Station);
var stationHull = ItemManager.CreateInstance(stationType, 0, 1) as EquippableItem;
var stationParent = Zone.PlanetInstances.Values.OrderByDescending(p => p.BodyData.Mass.Value).ElementAt(2);
var parentOrbit = stationParent.Orbit.Data.ID;
var stationPos = Zone.GetOrbitPosition(parentOrbit) +
normalize(ItemManager.Random.NextFloat2() - float2(.5f, .5f)) * ItemManager.Random.NextFloat() * stationParent.GravityWellRadius.Value * .75f;
var stationOrbit = Zone.CreateOrbit(parentOrbit, stationPos);
var station = new OrbitalEntity(ItemManager, Zone, stationHull, stationOrbit.ID);
Zone.Entities.Add(station);
var hullType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Ship);
var shipHull = ItemManager.CreateInstance(hullType, 0, 1) as EquippableItem;
var ship = new Ship(ItemManager, Zone, shipHull);
// MapButton.onClick.AddListener(() =>
// {
// if (_currentMenuTabButton == MapPanel) return;
@ -106,9 +126,6 @@ public class ActionGameManager : MonoBehaviour
// _currentMenuTabButton = MapButton;
// });
//
// var hullType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Ship);
// var hull = ItemManager.CreateInstance(hullType, 0, 1) as EquippableItem;
// var entity = new Ship(ItemManager, Zone, hull);
//InventoryPanel.Display(ItemManager, entity);
}