Browse Source

Fixes, Performance Increase

bolt_update
laurids 3 years ago
parent
commit
dcf87661f0
4 changed files with 37 additions and 35 deletions
  1. +2
    -2
      Assets/GWConquest/Materials/Planets/Yeesveer Kees.mat
  2. +2
    -2
      Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab
  3. +2
    -0
      Assets/GWConquest/Scripts/UI/GalaxyMapUI.cs
  4. +31
    -31
      Assets/GWConquest/Scripts/Unit.cs

+ 2
- 2
Assets/GWConquest/Materials/Planets/Yeesveer Kees.mat View File

@ -60,7 +60,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _Emissivecities: - _Emissivecities:
m_Texture: {fileID: 2800000, guid: e761d1b5f99e4c840b58081a41de20d6, type: 3}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _LookupSunset: - _LookupSunset:
@ -176,7 +176,7 @@ Material:
- _Ambiantatmospherecolor: {r: 0, g: 0, b: 0, a: 1} - _Ambiantatmospherecolor: {r: 0, g: 0, b: 0, a: 1}
- _Ambiantcolor: {r: 0, g: 0, b: 0, a: 0} - _Ambiantcolor: {r: 0, g: 0, b: 0, a: 0}
- _Ambiantlightcontrol: {r: 0, g: 0, b: 0, a: 0} - _Ambiantlightcontrol: {r: 0, g: 0, b: 0, a: 0}
- _Citiescolor: {r: 1, g: 0.815662, b: 0.559, a: 0}
- _Citiescolor: {r: 0, g: 0, b: 0, a: 0}
- _Citycolor: {r: 1, g: 0.7241379, b: 0, a: 1} - _Citycolor: {r: 1, g: 0.7241379, b: 0, a: 1}
- _Cloudscolor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - _Cloudscolor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _Color: {r: 0.641, g: 0.641, b: 0.641, a: 1} - _Color: {r: 0.641, g: 0.641, b: 0.641, a: 1}


+ 2
- 2
Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab View File

@ -92,7 +92,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &2845208572781105551 --- !u!224 &2845208572781105551
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -139,7 +139,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 21300000, guid: 3347df28e84113b4999b27c6afc9f3a0, type: 3}
m_Sprite: {fileID: 0}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1


+ 2
- 0
Assets/GWConquest/Scripts/UI/GalaxyMapUI.cs View File

@ -74,6 +74,8 @@ namespace GWConquest
{ {
var formations = SelectedPlanet.GetMainZone(ZoneType.Space).Formations; var formations = SelectedPlanet.GetMainZone(ZoneType.Space).Formations;
formations = formations.Where(f => f.ZoneType == ZoneType.Space);
var currentPlayer = Player.CurrentPlayer; var currentPlayer = Player.CurrentPlayer;
var playerFormations = formations.Where(f => f.Player == currentPlayer).ToList(); var playerFormations = formations.Where(f => f.Player == currentPlayer).ToList();


+ 31
- 31
Assets/GWConquest/Scripts/Unit.cs View File

@ -7,19 +7,19 @@ namespace GWConquest
Sprite Icon {get;} Sprite Icon {get;}
} }
public class Unit : Bolt.EntityEventListener<IUnitState>, IIconObject
public class Unit : GWBoltEntityListener<IUnitState>, IIconObject
{ {
public UnitClass Class public UnitClass Class
{ {
get => UnitClass.FromName(state.UnitClass);
get => UnitClass.FromName(State.UnitClass);
set { set {
if(value == null) if(value == null)
{ {
state.UnitClass = null;
State.UnitClass = null;
} }
else else
{ {
state.UnitClass = value.ShortName;
State.UnitClass = value.ShortName;
Inventory.StorageCapacity = value.InventorySlots; Inventory.StorageCapacity = value.InventorySlots;
Equipment.StorageCapacity = value.EquipmentSlots; Equipment.StorageCapacity = value.EquipmentSlots;
@ -34,18 +34,18 @@ namespace GWConquest
public Formation Formation public Formation Formation
{ {
get => state.Formation?.GetComponent<Formation>();
set => state.Formation = value.entity;
get => State.Formation?.GetComponent<Formation>();
set => State.Formation = value.entity;
} }
public int Hitpoints { public int Hitpoints {
get => state.Hitpoints;
set => state.Hitpoints = value;
get => State.Hitpoints;
set => State.Hitpoints = value;
} }
public int Shields { public int Shields {
get => state.Shields;
set => state.Shields = value;
get => State.Shields;
set => State.Shields = value;
} }
public float Armour { public float Armour {
@ -66,8 +66,8 @@ namespace GWConquest
public float Morale { public float Morale {
get => state.Morale;
set => state.Morale = value;
get => State.Morale;
set => State.Morale = value;
} }
public Player Player { public Player Player {
@ -75,9 +75,9 @@ namespace GWConquest
} }
public BattleUnitState BattleState { public BattleUnitState BattleState {
get => (BattleUnitState) state.BattleState;
get => (BattleUnitState) State.BattleState;
set { set {
state.BattleState = (int) value;
State.BattleState = (int) value;
if(BoltNetwork.IsServer) if(BoltNetwork.IsServer)
{ {
if(CurrentBattle != null) if(CurrentBattle != null)
@ -89,16 +89,16 @@ namespace GWConquest
} }
public RevealState RevealState { public RevealState RevealState {
get => (RevealState) state.RevealState;
set => state.RevealState = (int) value;
get => (RevealState) State.RevealState;
set => State.RevealState = (int) value;
} }
public float ActionCooldown { public float ActionCooldown {
get => state.ActionCooldown;
get => State.ActionCooldown;
} }
public float ActionCooldownPercent { public float ActionCooldownPercent {
get => state.ActionCooldown / state.ActionCooldownMax;
get => State.ActionCooldown / State.ActionCooldownMax;
} }
public BattleFlank FlankTarget { public BattleFlank FlankTarget {
@ -108,7 +108,7 @@ namespace GWConquest
return null; return null;
} }
else { else {
int ind = state.FlankTarget;
int ind = State.FlankTarget;
if(ind >= 0 && CurrentBattle.FlankCount < ind) if(ind >= 0 && CurrentBattle.FlankCount < ind)
{ {
return CurrentBattle.GetFlank(ind); return CurrentBattle.GetFlank(ind);
@ -116,13 +116,13 @@ namespace GWConquest
else return null; else return null;
} }
} }
set => state.FlankTarget = value == null ? -1 : value.FlankId;
set => State.FlankTarget = value == null ? -1 : value.FlankId;
} }
public void SetActionCooldown(float value) public void SetActionCooldown(float value)
{ {
state.ActionCooldown = value;
state.ActionCooldownMax = value;
State.ActionCooldown = value;
State.ActionCooldownMax = value;
} }
[System.NonSerialized] [System.NonSerialized]
@ -153,10 +153,10 @@ namespace GWConquest
public override void Attached() public override void Attached()
{ {
Inventory = new Inventory(state, "Inventory");
Equipment = new Inventory(state, "Equipment");
Inventory = new Inventory(State, "Inventory");
Equipment = new Inventory(State, "Equipment");
state.AddCallback("Formation", () =>
State.AddCallback("Formation", () =>
{ {
if(Formation != null) if(Formation != null)
{ {
@ -185,9 +185,9 @@ namespace GWConquest
Unit unit = unitEntity.GetComponent<Unit>(); Unit unit = unitEntity.GetComponent<Unit>();
unit.Class = uc; unit.Class = uc;
unit.gameObject.name = uc.ShortName + "_" + unitEntity.NetworkId.PackedValue.ToString(); unit.gameObject.name = uc.ShortName + "_" + unitEntity.NetworkId.PackedValue.ToString();
unit.state.Hitpoints = uc.Hitpoints;
unit.state.Shields = uc.Shields;
unit.state.Morale = uc.Morale;
unit.State.Hitpoints = uc.Hitpoints;
unit.State.Shields = uc.Shields;
unit.State.Morale = uc.Morale;
unit.Formation = playerFormation; unit.Formation = playerFormation;
playerFormation.UnitEntities.Add(unitEntity); playerFormation.UnitEntities.Add(unitEntity);
@ -222,7 +222,7 @@ namespace GWConquest
var evnt = UnitDamageAnimEvent.Create(entity); var evnt = UnitDamageAnimEvent.Create(entity);
evnt.Attacker = attacker.entity; evnt.Attacker = attacker.entity;
evnt.IsDead = state.Hitpoints <= 0;
evnt.IsDead = State.Hitpoints <= 0;
evnt.IsDemoralized = IsDemoralized; evnt.IsDemoralized = IsDemoralized;
evnt.GlancingHit = isGlancingHit; evnt.GlancingHit = isGlancingHit;
evnt.WeaponType = (int) weaponType; evnt.WeaponType = (int) weaponType;
@ -298,7 +298,7 @@ namespace GWConquest
if (ActionCooldown <= 0) if (ActionCooldown <= 0)
{ {
state.ActionCooldown = 0;
State.ActionCooldown = 0;
if (BattleState == BattleUnitState.MovingToFlank) if (BattleState == BattleUnitState.MovingToFlank)
{ {
BattleState = BattleUnitState.OnFlank; BattleState = BattleUnitState.OnFlank;
@ -321,7 +321,7 @@ namespace GWConquest
} }
else else
{ {
state.ActionCooldown -= BoltNetwork.FrameDeltaTime;
State.ActionCooldown -= BoltNetwork.FrameDeltaTime;
} }
} }


Loading…
Cancel
Save