protected override void _ActionPerform() { NewDroidType = new DroidDesign(); ResultUnit.TypeBase = NewDroidType; NewDroidType.CopyDesign(OldDroidType); NewDroidType.UpdateAttachments(); }
protected override void ActionCondition() { base.ActionCondition(); if (Unit.TypeBase.Type == UnitType.PlayerDroid) { OldDroidType = (DroidDesign)Unit.TypeBase; ActionPerformed = OldDroidType.IsTemplate; } else { OldDroidType = null; ActionPerformed = false; } }
public Unit(Unit unitToCopy, Map targetMap) { MapLink = new ConnectedListLink <Unit, Map>(this); MapSelectedUnitLink = new ConnectedListLink <Unit, Map>(this); Sectors = new ConnectedList <clsUnitSectorConnection, Unit>(this); var IsDesign = default(bool); if (unitToCopy.TypeBase.Type == UnitType.PlayerDroid) { IsDesign = !((DroidDesign)unitToCopy.TypeBase).IsTemplate; } else { IsDesign = false; } if (IsDesign) { var DroidDesign = new DroidDesign(); TypeBase = DroidDesign; DroidDesign.CopyDesign((DroidDesign)unitToCopy.TypeBase); DroidDesign.UpdateAttachments(); } else { TypeBase = unitToCopy.TypeBase; } Pos = unitToCopy.Pos; Rotation = unitToCopy.Rotation; var otherUnitGroup = default(clsUnitGroup); otherUnitGroup = unitToCopy.UnitGroup; if (otherUnitGroup.WZ_StartPos < 0) { UnitGroup = targetMap.ScavengerUnitGroup; } else { UnitGroup = targetMap.UnitGroups[otherUnitGroup.WZ_StartPos]; } SavePriority = unitToCopy.SavePriority; Health = unitToCopy.Health; PreferPartsOutput = unitToCopy.PreferPartsOutput; }