public SpaceshipsConfig GetConfig() { if (config == null) { config = Global.Instance.CONFIGS.spaceships.Find(x => x.id == model); } if (config == null) { Debug.LogWarning("<color=#FF0000>[SpaceshipData] \"config\" is null!</color>"); } return(config); }
public static void Copy(this SpaceshipsConfig _cg1, SpaceshipsConfig _cg2) { _cg1.id = _cg2.id; _cg1.name = _cg2.name; _cg1.description = _cg2.description; _cg1.level = _cg2.level; _cg1.hitPoints = _cg2.hitPoints; _cg1.shieldPoints = _cg2.shieldPoints; _cg1.maneuver = _cg2.maneuver; _cg1.repairTime = _cg2.repairTime; _cg1.coefLvlHP = _cg2.coefLvlHP; _cg1.coefLvlManeuver = _cg2.coefLvlManeuver; _cg1.coefLvlRepair = _cg2.coefLvlRepair; _cg1.coefPriceLvl = _cg2.coefPriceLvl; _cg1.skills = (string[])_cg2.skills.Clone(); }
public SubsystemData(EnumSubsystems _id, SpaceshipsConfig _config, int _mkIndex) { id = _id; mkIndex = _mkIndex; parameters.Clear(); skills.Clear(); //Наполняем по конфигу перечнем параметров var paramsTMP = Global.Instance.CONFIGS.parameters.FindAll(x => x.subsystem == id.ToString()); foreach (var paramTMP in paramsTMP) { var value = GetParamValue(paramTMP.id, _config); var newParam = new ParameterData((EnumParameters)Enum.Parse(typeof(EnumParameters), paramTMP.id), value); parameters.Add(newParam); } }
private float speedResultNormalize; //Нормализованная скорость, к которой стремимся #endregion #region Public methods public SpaceshipMetadata(SpaceshipData _data, SpaceshipsConfig _config, bool _isPlayer) { data = _data; config = _config; isPlayer = _isPlayer; mk = data.mk; mkIndex = data.GetMkIndex(); ApplySubsystems(); ApplyWeapons(); ApplySlots(); ApplyItems(); ApplyMaxParameters(); ApplyParameters(); ApplyDefault(); }
private float GetParamValue(string _id, SpaceshipsConfig _config) { var result = 0.0f; var param = (EnumParameters)Enum.Parse(typeof(EnumParameters), _id); switch (param) { case EnumParameters.armor: result = _config.armor[mkIndex]; break; case EnumParameters.cargo: result = _config.cargo[mkIndex]; break; case EnumParameters.shield: result = _config.shield[mkIndex]; break; case EnumParameters.shieldRecovery: result = _config.shieldRecovery[mkIndex]; break; case EnumParameters.speed: result = _config.speed[mkIndex]; break; case EnumParameters.maneuver: result = _config.maneuver[mkIndex]; break; case EnumParameters.targets: result = _config.targets[mkIndex]; break; case EnumParameters.energy: result = _config.energy[mkIndex]; break; } return(result); }
public void InitializeSpaceship() { //Input ApplyInpytComponent(); //coroutine = null; speedCoroutine = null; point = null; targets.Clear(); data = Global.Instance.PROFILE.spaceships.Find(x => x.model == model); if (data == null) { //Debug.LogWarning("<color=#FF0000>[SpaceshipController] \"data\" is null!</color>"); //model = "ERROR"; //return; data = new SpaceshipData(model); //TODO: TEST data.ApplyDefault(); Global.Instance.PROFILE.spaceships.Add(data); } config = data.GetConfig(); meta = new SpaceshipMetadata(data, config, isPlayer); SizeType = (EnumSizeType)config.sizeType; ApplyWeapons(); material = data.material; //LoadedMainMesh(); LoadedMainMaterial(); Title = string.Format("{0} MK-{1}", data.model.ToUpper(), data.mk); CreateMarker(); }
public SpaceshipData(string _model) { config = Global.Instance.CONFIGS.spaceships.Find(x => x.id == _model); if (config == null) { Debug.LogError("[SpaceshipData] Config is NULL. Create default values."); id = ""; model = "mk6"; material = "Default"; mk = 1; return; } model = config.id; id = UtilityBase.GetMD5(model + DateTime.UtcNow.ToString()); material = "Default"; mk = 1; }
private void SetConfig(string _id) { config = Global.Instance.CONFIGS.spaceships.GetConfig(_id); }
public SpaceshipsConfig(SpaceshipsConfig _cg2) { this.Copy(_cg2); }