string GetUnitSpecialAbilityDescription(UnitTypeEnum unitType) { string result; switch (unitType) { case UnitTypeEnum.IFV: result = "Gas - two times larger movement range in one turn."; break; case UnitTypeEnum.Tank: result = "Break - special projectile damaging each vehicle on trajectory."; break; case UnitTypeEnum.HeavyTank: result = "Fortification - Increases deffence to 200% for 2 turns taking all movement quantity."; break; case UnitTypeEnum.Helicopter: result = "Valkiria - attacks 2 to 4 targets with power of 100% dvided between all of it."; break; case UnitTypeEnum.Artillery: result = "Raid - each target inside attack range receives 50% regular damage."; break; default: throw new InvalidProgramException("Unreacheable code."); } return(result); }
public MeasureInfo(RenderObject renderObject, SizeD size, UnitTypeEnum resolvedUnit) { _renderedAreas = new UnitRectangle[1]; _renderedAreas[0].X = new Unit(0, resolvedUnit); _renderedAreas[0].Y = new Unit(0, resolvedUnit); _renderedAreas[0].Width = new Unit(size.Width, resolvedUnit); _renderedAreas[0].Height = new Unit(size.Height, resolvedUnit); }
/// <summary> /// Only Width, Height, WidthUnit and HeightUnit properties of MeasureInfo have valid /// values after MeasureObject call. /// </summary> /// <param name="ro">RenderObject to measure.</param> /// <returns>Returns the MeasureInfo object with sizes of object.</returns> public MeasureInfo MeasureObject(RenderObject ro, Unit width, Unit height) { bool wasAdded = ro.Document == null; if (ro.Document == null) { this.Body.Children.Add(ro); } SizeD sz = ro.CalcSize(width, height); UnitTypeEnum resolvedUnit = ro.Document.ResolvedUnit; if (wasAdded) { this.Body.Children.Remove(ro); } return(new MeasureInfo(ro, sz, resolvedUnit)); }
protected override void Init() { base.Init(); if (null != GetComponent <TrollDrawLine>()) { trollDrawLine = GetComponent <TrollDrawLine>(); } GameMapManager.UnitData UnitData = GameMapManager.Instance.GetUnitData(gameObject.tag); if (UnitData.object_UnitName != "") { Object_UnitName = EnumChange <GameUnitName> .StringToEnum(UnitData.object_UnitName); Object_Camp = EnumChange <CampEnum> .StringToEnum(UnitData.object_Camp); Object_UnitType = EnumChange <UnitTypeEnum> .StringToEnum(UnitData.object_UnitType); Object_HP = UnitData.object_HP; Max_HP = UnitData.object_HP; Object_Radius = UnitData.unit_Radius; if (Object_Camp == GameMapManager.Instance.PlayerCamp) { IsPlayerCamp = true; } else { IsPlayerCamp = false; } } if (IsPlayerCamp) { gameObject.AddComponent <HighlightableObject>(); highlightable = GetComponent <HighlightableObject>(); } else { StartCoroutine(StartAI()); } Is_AI = !IsPlayerCamp; }