Misc. Improvements
Turrets lead their projectiles Double click to equip/unequip/move Minimum weapon convergence distance
This commit is contained in:
parent
8629b35fd6
commit
922c8ea460
18 changed files with 240 additions and 69 deletions
|
|
@ -230,11 +230,14 @@
|
|||
<e p="ActionGameManager.cs" t="Include" />
|
||||
<e p="ArticulationPoint.cs" t="Include" />
|
||||
<e p="EntityPrefab.cs" t="Include" />
|
||||
<e p="GameSettings.cs" t="Include" />
|
||||
<e p="HullCollider.cs" t="Include" />
|
||||
<e p="RadiatorHardpoint.cs" t="Include" />
|
||||
<e p="ThrusterHardpoint.cs" t="Include" />
|
||||
<e p="WeaponHardpoint.cs" t="Include" />
|
||||
<e p="Weapons" t="Include">
|
||||
<e p="ConstantLaser.cs" t="Include" />
|
||||
<e p="ConstantLaserManager.cs" t="Include" />
|
||||
<e p="ConstantWeaponEffectManager.cs" t="Include" />
|
||||
<e p="GuidedProjectile.cs" t="Include" />
|
||||
<e p="GuidedProjectileManager.cs" t="Include" />
|
||||
|
|
@ -245,7 +248,6 @@
|
|||
<e p="ProjectileManager.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="GameSettings.cs" t="Include" />
|
||||
<e p="Gravity.cs" t="Include" />
|
||||
<e p="InitialSettings.cs" t="Include" />
|
||||
<e p="MapMenuInput.cs" t="Include" />
|
||||
|
|
@ -1452,6 +1454,7 @@
|
|||
</e>
|
||||
<e p="ServerShared" t="Include">
|
||||
<e p="ActionCollection.cs" t="Include" />
|
||||
<e p="AetheriaMath.cs" t="Include" />
|
||||
<e p="Agents" t="Include">
|
||||
<e p="AgentBehavior.cs" t="Include" />
|
||||
<e p="AgentTask.cs" t="Include" />
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@
|
|||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\Intersections.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\Relayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\PointLocation.cs" />
|
||||
<Compile Include="Assets\Scripts\GameSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\Gameplay\GameSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\IntervalNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\PointProjection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\MinSeparationConstraint.cs" />
|
||||
|
|
|
|||
|
|
@ -1068,7 +1068,7 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 2279630452912159028}
|
||||
m_HandleRect: {fileID: 2279630452912159027}
|
||||
m_Direction: 0
|
||||
m_Value: 0
|
||||
m_Value: 1
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
|
|
@ -1085,12 +1085,12 @@ GameObject:
|
|||
- component: {fileID: 2279630453345861720}
|
||||
- component: {fileID: 2279630453345861722}
|
||||
- component: {fileID: 2279630453345861721}
|
||||
- component: {fileID: 5461050610218844277}
|
||||
- component: {fileID: 5747035144148683486}
|
||||
- component: {fileID: 3584371112157775779}
|
||||
- component: {fileID: 3507449623040604819}
|
||||
- component: {fileID: 1876119682947177707}
|
||||
- component: {fileID: 3026868749259999386}
|
||||
- component: {fileID: 7846311452637886606}
|
||||
m_Layer: 5
|
||||
m_Name: Background
|
||||
m_TagString: Untagged
|
||||
|
|
@ -1155,18 +1155,6 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &5461050610218844277
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2279630453345861799}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aa69c313aba23f945b760e79c45083ad, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &5747035144148683486
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1227,6 +1215,18 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 9643e74593988274bbed9adf40384e48, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &7846311452637886606
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2279630453345861799}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aa69c313aba23f945b760e79c45083ad, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &2279630453679143106
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -2413,7 +2413,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
Background: {fileID: 2279630453345861721}
|
||||
Icon: {fileID: 7107228986248497935}
|
||||
PointerClickTrigger: {fileID: 5461050610218844277}
|
||||
PointerClickTrigger: {fileID: 7846311452637886606}
|
||||
BeginDragTrigger: {fileID: 3584371112157775779}
|
||||
DragTrigger: {fileID: 3507449623040604819}
|
||||
EndDragTrigger: {fileID: 5747035144148683486}
|
||||
|
|
|
|||
|
|
@ -2406,7 +2406,7 @@ ParticleSystem:
|
|||
m_Bits: 4294967295
|
||||
influenceList: []
|
||||
ClampVelocityModule:
|
||||
enabled: 0
|
||||
enabled: 1
|
||||
x:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
|
|
@ -2627,7 +2627,7 @@ ParticleSystem:
|
|||
drag:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
scalar: 0
|
||||
scalar: 33.08
|
||||
minScalar: 0
|
||||
maxCurve:
|
||||
serializedVersion: 2
|
||||
|
|
@ -4071,7 +4071,7 @@ ParticleSystem:
|
|||
widthOverTrail:
|
||||
serializedVersion: 2
|
||||
minMaxState: 1
|
||||
scalar: 3
|
||||
scalar: 1
|
||||
minScalar: 1
|
||||
maxCurve:
|
||||
serializedVersion: 2
|
||||
|
|
@ -4079,21 +4079,30 @@ ParticleSystem:
|
|||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 1
|
||||
outSlope: 1
|
||||
tangentMode: 34
|
||||
inSlope: 4.9771304
|
||||
outSlope: 4.9771304
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.27819547
|
||||
- serializedVersion: 3
|
||||
time: 0.5
|
||||
value: 1
|
||||
inSlope: -0.1670337
|
||||
outSlope: -0.1670337
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.36842084
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 1
|
||||
outSlope: 1
|
||||
tangentMode: 34
|
||||
value: 0
|
||||
inSlope: -3.9719422
|
||||
outSlope: -3.9719422
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
inWeight: 0.2556393
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
|
|
|
|||
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
Binary file not shown.
|
|
@ -21011,7 +21011,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
Background: {fileID: 817565128}
|
||||
Icon: {fileID: 109242182}
|
||||
PointerClickTrigger: {fileID: 817565127}
|
||||
PointerClickTrigger: {fileID: 0}
|
||||
BeginDragTrigger: {fileID: 817565125}
|
||||
DragTrigger: {fileID: 817565124}
|
||||
EndDragTrigger: {fileID: 817565126}
|
||||
|
|
@ -23392,7 +23392,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
Background: {fileID: 7628189704657849089}
|
||||
Icon: {fileID: 1504178997104738391}
|
||||
PointerClickTrigger: {fileID: 4447187362195032877}
|
||||
PointerClickTrigger: {fileID: 0}
|
||||
BeginDragTrigger: {fileID: 5170175554978942203}
|
||||
DragTrigger: {fileID: 5103404206460645835}
|
||||
EndDragTrigger: {fileID: 4161198292510736774}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
}
|
||||
|
||||
var diff = Target.position - transform.position;
|
||||
var targetDist = diff.magnitude;
|
||||
var targetDist = diff.Flatland().magnitude;
|
||||
|
||||
if (_prevDist < targetDist)
|
||||
{
|
||||
|
|
@ -74,7 +74,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
_prevDist = targetDist;
|
||||
|
||||
var position = (float3) t.position;
|
||||
var sourceDist = length((float3) Source.position - position);
|
||||
var sourceDist = length(((float3) Source.position).xz - position.xz);
|
||||
var curveLerp = 1 - targetDist / (sourceDist + targetDist);
|
||||
var dir = diff.normalized;
|
||||
var right = cross(dir, float3(0, 1, 0));
|
||||
|
|
|
|||
|
|
@ -660,7 +660,7 @@ public class SectorRenderer : MonoBehaviour
|
|||
if (entity.Key.Target.Value != null && !EntityInstances.ContainsKey(entity.Key.Target.Value))
|
||||
entity.Key.Target.Value = null;
|
||||
entity.Value.LookAtPoint.position = entity.Value.Transform.position + (Vector3) entity.Key.LookDirection * (entity.Key.Target.Value != null
|
||||
? (EntityInstances[entity.Key.Target.Value].Transform.position - entity.Value.Transform.position).magnitude : 10000);
|
||||
? max((EntityInstances[entity.Key.Target.Value].Transform.position - entity.Value.Transform.position).magnitude,Settings.GameplaySettings.ConvergenceMinimumDistance) : 10000);
|
||||
entity.Value.Transform.position = entity.Key.Position;
|
||||
}
|
||||
foreach(var e in hitList)
|
||||
|
|
|
|||
67
Assets/Scripts/ServerShared/AetheriaMath.cs
Normal file
67
Assets/Scripts/ServerShared/AetheriaMath.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
public class AetheriaMath
|
||||
{
|
||||
//first-order intercept using absolute target position
|
||||
public static float3 FirstOrderIntercept
|
||||
(
|
||||
float3 shooterPosition,
|
||||
float3 shooterVelocity,
|
||||
float shotSpeed,
|
||||
float3 targetPosition,
|
||||
float3 targetVelocity
|
||||
) {
|
||||
float3 targetRelativePosition = targetPosition - shooterPosition;
|
||||
float3 targetRelativeVelocity = targetVelocity - shooterVelocity;
|
||||
float t = FirstOrderInterceptTime
|
||||
(
|
||||
shotSpeed,
|
||||
targetRelativePosition,
|
||||
targetRelativeVelocity
|
||||
);
|
||||
return targetPosition + t*targetRelativeVelocity;
|
||||
}
|
||||
|
||||
//first-order intercept using relative target position
|
||||
public static float FirstOrderInterceptTime
|
||||
(
|
||||
float shotSpeed,
|
||||
float3 targetRelativePosition,
|
||||
float3 targetRelativeVelocity
|
||||
) {
|
||||
float velocitySquared = lengthsq(targetRelativeVelocity);
|
||||
if(velocitySquared < 0.001f)
|
||||
return 0f;
|
||||
|
||||
float a = velocitySquared - shotSpeed*shotSpeed;
|
||||
|
||||
//handle similar velocities
|
||||
if (abs(a) < 0.001f)
|
||||
{
|
||||
float t = -lengthsq(targetRelativePosition)/ (2f*dot(targetRelativeVelocity, targetRelativePosition));
|
||||
return max(t, 0f); //don't shoot back in time
|
||||
}
|
||||
|
||||
float b = 2f*dot(targetRelativeVelocity, targetRelativePosition);
|
||||
float c = lengthsq(targetRelativePosition);
|
||||
float determinant = b*b - 4f*a*c;
|
||||
|
||||
if (determinant > 0f) { //determinant > 0; two intercept paths (most common)
|
||||
float t1 = (-b + sqrt(determinant))/(2f*a),
|
||||
t2 = (-b - sqrt(determinant))/(2f*a);
|
||||
if (t1 > 0f) {
|
||||
if (t2 > 0f)
|
||||
return min(t1, t2); //both are positive
|
||||
else
|
||||
return t1; //only t1 is positive
|
||||
} else
|
||||
return max(t2, 0f); //don't shoot back in time
|
||||
} else if (determinant < 0f) //determinant < 0; no intercept path
|
||||
return 0f;
|
||||
else //determinant = 0; one intercept path, pretty much never happens
|
||||
return max(-b/(2f*a), 0f); //don't shoot back in time
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/ServerShared/AetheriaMath.cs.meta
Normal file
11
Assets/Scripts/ServerShared/AetheriaMath.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70c5f24f81c803248a4f682e6eb12ef2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -9,6 +9,7 @@ using Newtonsoft.Json;
|
|||
using UniRx;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
using float3 = Unity.Mathematics.float3;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class TurretControllerData : BehaviorData
|
||||
|
|
@ -23,6 +24,8 @@ public class TurretController : IBehavior
|
|||
{
|
||||
private TurretControllerData _data;
|
||||
private List<Weapon> _weapons = new List<Weapon>();
|
||||
private float _shotSpeed;
|
||||
private bool _predictShots;
|
||||
|
||||
public Entity EquippedEntity { get; }
|
||||
public EquippedItem Item { get; }
|
||||
|
|
@ -55,7 +58,14 @@ public class TurretController : IBehavior
|
|||
{
|
||||
foreach (var b in item.Behaviors)
|
||||
if (b is Weapon weapon)
|
||||
{
|
||||
_weapons.Add(weapon);
|
||||
if (weapon.Data is ProjectileWeaponData projectileWeaponData)
|
||||
{
|
||||
_predictShots = true;
|
||||
_shotSpeed = EquippedEntity.ItemManager.Evaluate(projectileWeaponData.Velocity, weapon.Item.EquippableItem, EquippedEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
|
|
@ -63,7 +73,19 @@ public class TurretController : IBehavior
|
|||
if (EquippedEntity.Target.Value != null)
|
||||
{
|
||||
var diff = EquippedEntity.Target.Value.Position - EquippedEntity.Position;
|
||||
EquippedEntity.LookDirection = normalize(diff);
|
||||
if (_predictShots)
|
||||
{
|
||||
var targetHullData = EquippedEntity.ItemManager.GetData(EquippedEntity.Target.Value.Hull) as HullData;
|
||||
var targetVelocity = float3(EquippedEntity.Target.Value.Velocity.x, 0, EquippedEntity.Target.Value.Velocity.y);
|
||||
var predictedPosition = AetheriaMath.FirstOrderIntercept(
|
||||
EquippedEntity.Position, float3.zero, _shotSpeed,
|
||||
EquippedEntity.Target.Value.Position, targetVelocity
|
||||
);
|
||||
predictedPosition.y = EquippedEntity.Zone.GetHeight(predictedPosition.xz) + targetHullData.GridOffset;
|
||||
EquippedEntity.LookDirection = normalize(predictedPosition - EquippedEntity.Position);
|
||||
}
|
||||
else
|
||||
EquippedEntity.LookDirection = normalize(diff);
|
||||
var dist = length(diff);
|
||||
|
||||
foreach (var x in _weapons)
|
||||
|
|
|
|||
|
|
@ -859,6 +859,15 @@ public class EquippedCargoBay : EquippedItem
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryStore(ItemInstance item)
|
||||
{
|
||||
if (item is SimpleCommodity simpleCommodity)
|
||||
return TryStore(simpleCommodity);
|
||||
if (item is CraftedItemInstance craftedItem)
|
||||
return TryStore(craftedItem);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryStore(ItemInstance item, int2 cargoCoord)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,4 +111,5 @@ public class GameplaySettings
|
|||
public float TorqueFloor;
|
||||
public float TorqueMultiplier;
|
||||
public float VisibilityDecay;
|
||||
public float ConvergenceMinimumDistance;
|
||||
}
|
||||
|
|
@ -275,27 +275,43 @@ public class InventoryMenu : MonoBehaviour
|
|||
var item = cargoEvent.CargoBay.Occupancy[cargoEvent.Position.x, cargoEvent.Position.y];
|
||||
if(item!=null)
|
||||
{
|
||||
if (_selectedPanel != null)
|
||||
if (Mouse.current.clickCount.ReadValue() == 2)
|
||||
{
|
||||
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
|
||||
if (otherPanel.DropItem(item))
|
||||
{
|
||||
cargoEvent.CargoBay.Remove(item);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_selectedPanel != null)
|
||||
{
|
||||
if (_selectedPanel.CellInstances.ContainsKey(_selectedPosition))
|
||||
{
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
_selectedPanel = panel;
|
||||
_selectedPosition = cargoEvent.Position;
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.AddItemProperties(item);
|
||||
_selectedPanel = panel;
|
||||
_selectedPosition = cargoEvent.CargoBay.Cargo[item];
|
||||
_selectedItem = item;
|
||||
_selectedItemData = GameManager.ItemManager.GetData(item);
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2);
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
|
||||
}
|
||||
}
|
||||
_selectedPanel = panel;
|
||||
_selectedPosition = cargoEvent.Position;
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.AddItemProperties(item);
|
||||
_selectedPanel = panel;
|
||||
_selectedPosition = cargoEvent.CargoBay.Cargo[item];
|
||||
_selectedItem = item;
|
||||
_selectedItemData = GameManager.ItemManager.GetData(item);
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
|
|
@ -303,26 +319,40 @@ public class InventoryMenu : MonoBehaviour
|
|||
var item = entityEvent.Entity.GearOccupancy[entityEvent.Position.x, entityEvent.Position.y];
|
||||
if (item != null)
|
||||
{
|
||||
if (_selectedPanel != null)
|
||||
if (Mouse.current.clickCount.ReadValue() == 2)
|
||||
{
|
||||
if(_selectedPanel.CellInstances.ContainsKey(_selectedItemData.Shape.Coordinates.First()))
|
||||
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
|
||||
if (otherPanel.DropItem(item.EquippableItem))
|
||||
{
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2);
|
||||
}
|
||||
entityEvent.Entity.Unequip(item);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
}
|
||||
}
|
||||
PropertiesPanel.Inspect(entityEvent.Entity, item);
|
||||
_selectedPanel = panel;
|
||||
_selectedPosition = item.Position;
|
||||
_selectedItem = item.EquippableItem;
|
||||
_selectedItemData = GameManager.ItemManager.GetData(item.EquippableItem);
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
else
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
|
||||
if (_selectedPanel != null)
|
||||
{
|
||||
if (_selectedPanel.CellInstances.ContainsKey(_selectedPosition))
|
||||
{
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropertiesPanel.Inspect(entityEvent.Entity, item);
|
||||
_selectedPanel = panel;
|
||||
_selectedPosition = item.Position;
|
||||
_selectedItem = item.EquippableItem;
|
||||
_selectedItemData = GameManager.ItemManager.GetData(item.EquippableItem);
|
||||
foreach (var v in _selectedItemData.Shape.Coordinates)
|
||||
{
|
||||
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
|
||||
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ public class InventoryPanel : MonoBehaviour
|
|||
ship.SetParent(GameManager.CurrentShip.Parent);
|
||||
GameManager.PlayerShips.Add(ship);
|
||||
GameManager.Credits -= pack.Price(GameManager.ItemManager);
|
||||
GameManager.CurrentShip = ship;
|
||||
GameManager.DockingBay.DockedShip = ship;
|
||||
Display(ship);
|
||||
}, pack.Price(GameManager.ItemManager) < GameManager.Credits
|
||||
)));
|
||||
}
|
||||
|
|
@ -630,6 +633,21 @@ public class InventoryPanel : MonoBehaviour
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DropItem(ItemInstance item)
|
||||
{
|
||||
if (_displayedEntity != null && item is EquippableItem equippableItem)
|
||||
{
|
||||
return _displayedEntity.TryEquip(equippableItem);
|
||||
}
|
||||
|
||||
if(_displayedCargo != null)
|
||||
{
|
||||
return _displayedCargo.TryStore(item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public UniRx.IObservable<InventoryEventData> OnClickAsObservable() => _onClick ?? (_onClick = new Subject<InventoryEventData>());
|
||||
public UniRx.IObservable<InventoryEventData> OnBeginDragAsObservable() => _onBeginDrag ?? (_onBeginDrag = new Subject<InventoryEventData>());
|
||||
|
|
|
|||
|
|
@ -521,6 +521,7 @@
|
|||
<Compile Include="Assets\Scripts\ServerShared\Behaviors\ChargedWeapon.cs" />
|
||||
<Compile Include="Assets\Scripts\ServerShared\Behaviors\AutoWeapon.cs" />
|
||||
<Compile Include="Assets\Scripts\ServerShared\Behaviors\LockWeapon.cs" />
|
||||
<Compile Include="Assets\Scripts\ServerShared\AetheriaMath.cs" />
|
||||
<None Include="Assets\Scripts\ServerShared\NIH\LinqFaster\readme.txt" />
|
||||
<None Include="Assets\Scripts\ServerShared\Economy.Shared.Unity.asmdef" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions">
|
||||
|
|
|
|||
Loading…
Reference in a new issue