|
@ -77,7 +77,7 @@ namespace GWConquest |
|
|
|
|
|
|
|
|
public IEnumerable<Unit> Units |
|
|
public IEnumerable<Unit> Units |
|
|
{ |
|
|
{ |
|
|
get => UnitEntities.Select((e,i) => e.GetComponent<Unit>()); |
|
|
|
|
|
|
|
|
get => UnitEntities.Select((e,i) => e.Entity.GetComponent<Unit>()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public Unit HeroUnit |
|
|
public Unit HeroUnit |
|
@ -93,7 +93,7 @@ namespace GWConquest |
|
|
|
|
|
|
|
|
public IEnumerable<Formation> SubFormations |
|
|
public IEnumerable<Formation> SubFormations |
|
|
{ |
|
|
{ |
|
|
get => SubFormationEntities.Select((e,i) => e.GetComponent<Formation>()); |
|
|
|
|
|
|
|
|
get => SubFormationEntities.Select((e,i) => e.Entity.GetComponent<Formation>()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ZoneList PathQueue; |
|
|
public ZoneList PathQueue; |
|
@ -240,15 +240,11 @@ namespace GWConquest |
|
|
movingArmyIcon.transform.SetParent(FindObjectOfType<IngameUI>().PlanetView.DistrictIcons); |
|
|
movingArmyIcon.transform.SetParent(FindObjectOfType<IngameUI>().PlanetView.DistrictIcons); |
|
|
movingArmyIcon.transform.localRotation = Quaternion.identity; |
|
|
movingArmyIcon.transform.localRotation = Quaternion.identity; |
|
|
var iconComp = movingArmyIcon.GetComponent<FormationIcon>(); |
|
|
var iconComp = movingArmyIcon.GetComponent<FormationIcon>(); |
|
|
|
|
|
iconComp.Arrow.gameObject.SetActive(true); |
|
|
iconComp.UpdateDisplay(this); |
|
|
iconComp.UpdateDisplay(this); |
|
|
iconComp.CanBeDragged = false; |
|
|
iconComp.CanBeDragged = false; |
|
|
var stick = movingArmyIcon.AddComponent<StickUIToPlanet>(); |
|
|
var stick = movingArmyIcon.AddComponent<StickUIToPlanet>(); |
|
|
stick.target = transform; |
|
|
stick.target = transform; |
|
|
//movingArmyIcon.GetComponent<StickUIToPlanet>().target = transform;
|
|
|
|
|
|
//movingArmyIcon.GetComponentInChildren<UnityEngine.UI.Image>().color = Player.Color;
|
|
|
|
|
|
//movingArmyIcon.GetComponentInChildren<UnityEngine.UI.Text>().color = Player.Color;
|
|
|
|
|
|
iconComp.Arrow.gameObject.SetActive(true); |
|
|
|
|
|
//Transform circleTransform = movingArmyIcon.GetComponentInChildren<UnityEngine.UI.Image>().transform;
|
|
|
|
|
|
Camera cam = Camera.main; |
|
|
Camera cam = Camera.main; |
|
|
Vector3 originPoint = RectTransformUtility.WorldToScreenPoint(cam, originZone.transform.position); |
|
|
Vector3 originPoint = RectTransformUtility.WorldToScreenPoint(cam, originZone.transform.position); |
|
|
Vector3 targetPoint = RectTransformUtility.WorldToScreenPoint(cam, targetZone.transform.position); |
|
|
Vector3 targetPoint = RectTransformUtility.WorldToScreenPoint(cam, targetZone.transform.position); |
|
@ -425,7 +421,13 @@ namespace GWConquest |
|
|
|
|
|
|
|
|
public float GetFormationStrength() |
|
|
public float GetFormationStrength() |
|
|
{ |
|
|
{ |
|
|
return UnitEntities.Sum(unit => unit.GetComponent<Unit>().Class.UnitStrength); |
|
|
|
|
|
|
|
|
if(entity.IsAttached) |
|
|
|
|
|
{ |
|
|
|
|
|
return UnitEntities.Sum(unit => unit.Entity.GetComponent<Unit>().Class.UnitStrength); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return 0f; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -436,20 +438,26 @@ namespace GWConquest |
|
|
{ |
|
|
{ |
|
|
currentZone.OnFormationChanged(this); |
|
|
currentZone.OnFormationChanged(this); |
|
|
} |
|
|
} |
|
|
if(!keepFormationName) |
|
|
|
|
|
|
|
|
if(entity.IsOwner) |
|
|
{ |
|
|
{ |
|
|
ConstructName(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(!keepFormationName) |
|
|
|
|
|
{ |
|
|
|
|
|
ConstructName(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
OnUnitsChanged?.Invoke(); |
|
|
OnUnitsChanged?.Invoke(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnUnitRemoved(Unit unit) |
|
|
public void OnUnitRemoved(Unit unit) |
|
|
{ |
|
|
{ |
|
|
OnUnitsChanged?.Invoke(); |
|
|
OnUnitsChanged?.Invoke(); |
|
|
if(!keepFormationName) |
|
|
|
|
|
|
|
|
if(entity.IsOwner) |
|
|
{ |
|
|
{ |
|
|
ConstructName(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(!keepFormationName) |
|
|
|
|
|
{ |
|
|
|
|
|
ConstructName(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void AddSubFormation(Formation f) |
|
|
public void AddSubFormation(Formation f) |
|
|