public static Vector3 GetMissPosition(Transform _weapon, Transform _target, EnumSizeType _targetSize) { //Базовый разброс var scatter = 0.5f; //Разброс зависит от размеров Цели switch (_targetSize) { case EnumSizeType.Small: scatter = 0.3f; break; case EnumSizeType.Medium: scatter = 1.0f; break; case EnumSizeType.Large: scatter = 2.5f; break; } var vectorMod = Random.Range(-scatter, scatter); var lerpMod = Random.Range(2.5f, 5.0f); //Увеличиваем расстояние от орудия до точки промаха var randomMissPoint = _target.position + vectorMod * Vector3.one; return(Vector3.LerpUnclamped(_weapon.position, randomMissPoint, lerpMod)); }
protected virtual void ApplySelfParameters() { sizeType = (EnumSizeType)data.GetSelfParameter(EnumParameters.optimalSizeType); armorDamage = data.GetSelfParameter(EnumParameters.armorDamage); shieldDamage = data.GetSelfParameter(EnumParameters.shieldDamage); optimalDistance = data.GetSelfParameter(EnumParameters.optimalDistance); accuracy = data.GetSelfParameter(EnumParameters.accuracy); critical = data.GetSelfParameter(EnumParameters.critical); rate = data.GetSelfParameter(EnumParameters.rate); }
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(); }