void SpawnBasic(ShipSettings setts, Vector3 initialPos, Vector2 bounds) { GameObject newEnemy = Pool2.GetGameObjectFromPool(); if (newEnemy) { EnemyBasic enemy = newEnemy.GetComponent <EnemyBasic>(); if (!enemy) { enemy = newEnemy.AddComponent <EnemyBasic>(); } BulletSettings bSetts = new BulletSettings(); bSetts.Damage = 10; bSetts.Speed = 5; bSetts.Type = BulletType.LINEAR; setts.Bullet = bullet; setts.BulletParameters = bSetts; setts.HitPoints = 10; setts.MovementSpeed = 10; setts.RateOfFire = 0.5f; enemy.InitializeCurve(initialPos, bounds); enemy.Initialize(setts); } }
private void Clear() { _ammunitionObsoleteMap.Clear(); _componentMap.Clear(); _componentModMap.Clear(); _componentStatsMap.Clear(); _deviceMap.Clear(); _droneBayMap.Clear(); _factionMap.Clear(); _satelliteMap.Clear(); _satelliteBuildMap.Clear(); _shipMap.Clear(); _shipBuildMap.Clear(); _skillMap.Clear(); _technologyMap.Clear(); _characterMap.Clear(); _fleetMap.Clear(); _lootMap.Clear(); _questMap.Clear(); _questItemMap.Clear(); _ammunitionMap.Clear(); _bulletPrefabMap.Clear(); _visualEffectMap.Clear(); _weaponMap.Clear(); DatabaseSettings = null; ExplorationSettings = null; GalaxySettings = null; ShipSettings = null; _images.Clear(); _audioClips.Clear(); _localizations.Clear(); }
void Start() { rb = GetComponent <Rigidbody>(); HUD = GetComponent <ShipHUD>(); ship = Instantiate(shipPrefab, transform).transform; ship.localPosition = Vector3.zero; handling = ship.GetComponent <ShipSettings>(); rb.mass = handling.mass; rb.drag = handling.drag; rb.angularDrag = handling.angularDrag; cam = Instantiate(camPrefab, transform.position, transform.rotation).GetComponentInChildren <Camera>(); camSmooth = Instantiate(camSpot, transform.position, transform.rotation); camSnappy = Instantiate(camSpot, transform); prevPos = ship.position; prevUp = ship.up; foreach (Transform child in ship.GetComponentsInChildren <Transform>()) { if (child.gameObject.name == "ShipModel") { model = child; } } GetComponent <ShipCustomization>().Init(model); //pitchLimit = Mathf.Rad2Deg * Mathf.Asin(handling.pitchSpeedLimit / handling.speed); g_manager = FindObjectOfType <GameManager>(); shipID = g_manager.RegisterShip(this); gravityScalar = g_manager.GetGravity(); }
public virtual void Initialize(ShipSettings shipSettings) { Settings = shipSettings; InitialSettings = shipSettings; if (Pool == null) { Pool = new ObjectPool(shipSettings.Bullet, transform, 20); } }
public void SetupShip() { // Create rigidbody shipBody = gameObject.AddComponent <Rigidbody>(); shipBody.useGravity = false; shipBody.drag = 0; shipBody.angularDrag = 20; shipBody.constraints = RigidbodyConstraints.FreezeRotationY; // Create physics material shipPhysicsMaterial = new PhysicMaterial(); shipPhysicsMaterial.bounciness = 0; shipPhysicsMaterial.staticFriction = 0; shipPhysicsMaterial.dynamicFriction = 0; shipPhysicsMaterial.bounceCombine = PhysicMaterialCombine.Minimum; shipPhysicsMaterial.frictionCombine = PhysicMaterialCombine.Minimum; // Create ship axis shipAxis = new GameObject("Ship Axis"); shipAxis.transform.parent = transform; shipAxis.transform.localPosition = Vector3.zero; // Load ship GameObject ShipObject = Instantiate(Resources.Load("Ships/Test/LoadMe") as GameObject) as GameObject; ShipObject.transform.parent = shipAxis.transform; ShipObject.transform.localPosition = Vector3.zero; // Get ship settings settings = ShipObject.GetComponent <ShipSettings>(); // Create ship collider GameObject ShipCollider = new GameObject("Ship Collider"); ShipCollider.transform.parent = transform; ShipCollider.transform.localPosition = Vector3.zero; ShipCollider.AddComponent <BoxCollider>(); ShipCollider.GetComponent <BoxCollider>().size = settings.physColliderSize; ShipCollider.GetComponent <BoxCollider>().material = shipPhysicsMaterial; // Create controller controller = gameObject.AddComponent <ShipController>(); controller.controller = inputControl; // Camera if (bShipHasCameraControl) { shipCamera = Camera.main.gameObject; } // Attach forcefeedback manager vibrationManager = gameObject.AddComponent <FFManager>(); // Attach Audio/Visual Manager gameObject.AddComponent <ShipAVManager>(); }
public void SetupShip() { // Create rigidbody shipBody = gameObject.AddComponent <Rigidbody>(); shipBody.useGravity = false; shipBody.drag = 0; shipBody.angularDrag = 100; RigidbodyConstraints constr = RigidbodyConstraints.FreezeRotationY; shipBody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; shipBody.constraints = constr; // Create physics material shipPhysicsMaterial = new PhysicMaterial(); shipPhysicsMaterial.bounciness = 0; shipPhysicsMaterial.staticFriction = 0; shipPhysicsMaterial.dynamicFriction = 0; shipPhysicsMaterial.bounceCombine = PhysicMaterialCombine.Minimum; shipPhysicsMaterial.frictionCombine = PhysicMaterialCombine.Minimum; // Create ship axis shipAxis = new GameObject("Ship Axis"); shipAxis.transform.parent = transform; shipAxis.transform.localPosition = Vector3.zero; // Load ship GameObject ShipObject = Instantiate(Resources.Load("Ships/Test/LoadMe") as GameObject) as GameObject; ShipObject.transform.parent = shipAxis.transform; // ShipObject.transform.localPosition = Vector3.zero; // Get ship settings settings = ShipObject.GetComponent <ShipSettings>(); // Create ship collider /* GameObject ShipCollider = new GameObject("Ship Collider"); * ShipCollider.transform.parent = transform; * ShipCollider.transform.localPosition = Vector3.zero; * ShipCollider.AddComponent<BoxCollider>(); * ShipCollider.GetComponent<BoxCollider>().size = settings.physColliderSize; * ShipCollider.GetComponent<BoxCollider>().material = shipPhysicsMaterial; */ // Create controller controller = gameObject.AddComponent <ShipController>(); controller.controller = inputControl; // Camera if (bShipHasCameraControl) { shipCamera = Camera.main.gameObject; } }
public void Setup(ShipSettings settings) { _movingForce = settings.MovingForce; _rotationSpeed = settings.RotationSpeed; _shotDelay = settings.ShotDelay; Rigidbody.drag = settings.LinearDrag; Rigidbody.angularDrag = settings.AngularDrag; Activate(); }
void FixedUpdate() { Clock += Time.deltaTime; if (Clock >= SpawnRate) { float scale = 10000; median = Analyser.GetMedianOfSpectrum() * scale; foreach (float frequency in FrequencyList) { ShipSettings setts = new ShipSettings(); //lows float currentFreq = frequency; Vector3 initial = GetARandomTreePos(); initial.x = Analyser.GetFrequencyVolume(frequency) * scale / 10; frequencyNow = initial.x; if (initial.x > 15) { BulletSettings bSetts = new BulletSettings(); bSetts.Damage = 5; bSetts.Speed = 3; bSetts.Type = BulletType.LINEAR; setts.Bullet = bullet; setts.BulletParameters = bSetts; setts.HitPoints = 50; setts.MovementSpeed = 1; setts.RateOfFire = 0.5f; SpawnBasic(setts, initial, GetEmiterBounds()); } //mids currentFreq *= 3; setts = new ShipSettings(); initial = GetARandomTreePos(); initial.x = Analyser.GetFrequencyVolume(frequency) * scale / 10; if (initial.x > 30) { BulletSettings bSetts = new BulletSettings(); bSetts.Damage = 5; bSetts.Speed = 3; bSetts.Type = BulletType.LINEAR; setts.Bullet = bullet; setts.BulletParameters = bSetts; setts.HitPoints = 10; setts.MovementSpeed = 15; setts.RateOfFire = 0.5f; SpawnBasic(setts, initial, GetEmiterBounds()); } } Clock = 0; } }
public void Init(Transform shipModel) { model = shipModel; colors = model.GetComponentInParent <ShipSettings>(); ship = model.GetComponentInParent <ShipController>(); primary = colors.primary; secondary = colors.secondary; trail = colors.trail; shipPrimary = colors.primary; shipSecondary = colors.secondary; shipTrail = colors.trail; UpdateColors(); }
public ShipInfo(ShipSettings type, int xp, int level, AttachmentSettings[] attachments, int teamId) { _type = type; Experience = xp; Level = level; Attachments = attachments; TeamId = teamId; //_health = _type.GetHealth(Level); //_damage = _type.GetDamage(Level); //_crit = _type.GetCrit(Level); //_evade = _type.GetEvade(Level); //_armor = _type.GetArmor(Level); }
void Spawn(ShipSettings setts) { GameObject newEnemy = Pool.GetGameObjectFromPool(); if (newEnemy) { Enemy enemy = newEnemy.GetComponent <Enemy>(); if (!enemy) { enemy = newEnemy.AddComponent <Enemy>(); } enemy.Move(GetARandomTreePos()); enemy.Initialize(setts); } }
public void SetupShip() { // Create rigidbody shipBody = gameObject.AddComponent<Rigidbody>(); shipBody.useGravity = false; shipBody.drag = 0; shipBody.angularDrag = 20; shipBody.constraints = RigidbodyConstraints.FreezeRotationY; // Create physics material shipPhysicsMaterial = new PhysicMaterial(); shipPhysicsMaterial.bounciness = 0; shipPhysicsMaterial.staticFriction = 0; shipPhysicsMaterial.dynamicFriction = 0; shipPhysicsMaterial.bounceCombine = PhysicMaterialCombine.Minimum; shipPhysicsMaterial.frictionCombine = PhysicMaterialCombine.Minimum; // Create ship axis shipAxis = new GameObject("Ship Axis"); shipAxis.transform.parent = transform; shipAxis.transform.localPosition = Vector3.zero; // Load ship GameObject ShipObject = Instantiate(Resources.Load("Ships/Test/LoadMe") as GameObject) as GameObject; ShipObject.transform.parent = shipAxis.transform; ShipObject.transform.localPosition = Vector3.zero; // Get ship settings settings = ShipObject.GetComponent<ShipSettings>(); // Create ship collider GameObject ShipCollider = new GameObject("Ship Collider"); ShipCollider.transform.parent = transform; ShipCollider.transform.localPosition = Vector3.zero; ShipCollider.AddComponent<BoxCollider>(); ShipCollider.GetComponent<BoxCollider>().size = settings.physColliderSize; ShipCollider.GetComponent<BoxCollider>().material = shipPhysicsMaterial; // Create controller controller = gameObject.AddComponent<ShipController>(); controller.controller = inputControl; // Camera if (bShipHasCameraControl) { shipCamera = Camera.main.gameObject; } // Attach forcefeedback manager vibrationManager = gameObject.AddComponent<FFManager>(); // Attach Audio/Visual Manager gameObject.AddComponent<ShipAVManager>(); }
public void Load() { foreach (var item in _content.AmmunitionObsoleteList) { if (!item.Disabled && !_database._ammunitionObsoleteMap.ContainsKey(item.Id)) { AmmunitionObsolete.Create(item, this); } } foreach (var item in _content.ComponentList) { if (!item.Disabled && !_database._componentMap.ContainsKey(item.Id)) { Component.Create(item, this); } } foreach (var item in _content.ComponentModList) { if (!item.Disabled && !_database._componentModMap.ContainsKey(item.Id)) { ComponentMod.Create(item, this); } } foreach (var item in _content.ComponentStatsList) { if (!item.Disabled && !_database._componentStatsMap.ContainsKey(item.Id)) { ComponentStats.Create(item, this); } } foreach (var item in _content.DeviceList) { if (!item.Disabled && !_database._deviceMap.ContainsKey(item.Id)) { Device.Create(item, this); } } foreach (var item in _content.DroneBayList) { if (!item.Disabled && !_database._droneBayMap.ContainsKey(item.Id)) { DroneBay.Create(item, this); } } foreach (var item in _content.FactionList) { if (!item.Disabled && !_database._factionMap.ContainsKey(item.Id)) { Faction.Create(item, this); } } foreach (var item in _content.SatelliteList) { if (!item.Disabled && !_database._satelliteMap.ContainsKey(item.Id)) { Satellite.Create(item, this); } } foreach (var item in _content.SatelliteBuildList) { if (!item.Disabled && !_database._satelliteBuildMap.ContainsKey(item.Id)) { SatelliteBuild.Create(item, this); } } foreach (var item in _content.ShipList) { if (!item.Disabled && !_database._shipMap.ContainsKey(item.Id)) { Ship.Create(item, this); } } foreach (var item in _content.ShipBuildList) { if (!item.Disabled && !_database._shipBuildMap.ContainsKey(item.Id)) { ShipBuild.Create(item, this); } } foreach (var item in _content.SkillList) { if (!item.Disabled && !_database._skillMap.ContainsKey(item.Id)) { Skill.Create(item, this); } } foreach (var item in _content.TechnologyList) { if (!item.Disabled && !_database._technologyMap.ContainsKey(item.Id)) { Technology.Create(item, this); } } foreach (var item in _content.CharacterList) { if (!item.Disabled && !_database._characterMap.ContainsKey(item.Id)) { Character.Create(item, this); } } foreach (var item in _content.FleetList) { if (!item.Disabled && !_database._fleetMap.ContainsKey(item.Id)) { Fleet.Create(item, this); } } foreach (var item in _content.LootList) { if (!item.Disabled && !_database._lootMap.ContainsKey(item.Id)) { LootModel.Create(item, this); } } foreach (var item in _content.QuestList) { if (!item.Disabled && !_database._questMap.ContainsKey(item.Id)) { QuestModel.Create(item, this); } } foreach (var item in _content.QuestItemList) { if (!item.Disabled && !_database._questItemMap.ContainsKey(item.Id)) { QuestItem.Create(item, this); } } foreach (var item in _content.AmmunitionList) { if (!item.Disabled && !_database._ammunitionMap.ContainsKey(item.Id)) { Ammunition.Create(item, this); } } foreach (var item in _content.BulletPrefabList) { if (!item.Disabled && !_database._bulletPrefabMap.ContainsKey(item.Id)) { BulletPrefab.Create(item, this); } } foreach (var item in _content.VisualEffectList) { if (!item.Disabled && !_database._visualEffectMap.ContainsKey(item.Id)) { VisualEffect.Create(item, this); } } foreach (var item in _content.WeaponList) { if (!item.Disabled && !_database._weaponMap.ContainsKey(item.Id)) { Weapon.Create(item, this); } } foreach (var item in _content.Images) { if (!_database._images.ContainsKey(item.Key)) { _database._images.Add(item.Key, item.Value); } } foreach (var item in _content.AudioClips) { if (!_database._audioClips.ContainsKey(item.Key)) { _database._audioClips.Add(item.Key, item.Value); } } foreach (var item in _content.Localizations) { if (!_database._localizations.ContainsKey(item.Key)) { _database._localizations.Add(item.Key, item.Value); } } if (_database.DatabaseSettings == null) { _database.DatabaseSettings = DatabaseSettings.Create(_content.DatabaseSettings ?? new Serializable.DatabaseSettingsSerializable { ItemType = Enums.ItemType.DatabaseSettings }, this); } if (_database.ExplorationSettings == null) { _database.ExplorationSettings = ExplorationSettings.Create(_content.ExplorationSettings ?? new Serializable.ExplorationSettingsSerializable { ItemType = Enums.ItemType.ExplorationSettings }, this); } if (_database.GalaxySettings == null) { _database.GalaxySettings = GalaxySettings.Create(_content.GalaxySettings ?? new Serializable.GalaxySettingsSerializable { ItemType = Enums.ItemType.GalaxySettings }, this); } if (_database.ShipSettings == null) { _database.ShipSettings = ShipSettings.Create(_content.ShipSettings ?? new Serializable.ShipSettingsSerializable { ItemType = Enums.ItemType.ShipSettings }, this); } }
public virtual void Initialize(ShipSettings shipSettings) { base.Initialize(shipSettings); State = EnemyState.BIRTH; }
public override void Initialize(ShipSettings shipSettings) { base.Initialize(shipSettings); t = 0.0f; Clock = 0; }
public void SpawnShip(bool isAI) { // load ship prefab and get settings from it GameObject prefab = LoadShip(RaceSettings.playerShip); ShipSettings settings = prefab.GetComponent <ShipSettings>(); if (settings == null) { Debug.LogError("The loaded prefab does not contain a settings class!"); return; } // create axis containers GameObject axis = new GameObject("_axis"); GameObject anim = new GameObject("_anim"); anim.transform.parent = transform; anim.transform.localPosition = Vector3.zero; anim.transform.localRotation = Quaternion.identity; axis.transform.parent = anim.transform; axis.transform.localPosition = Vector3.zero; axis.transform.localRotation = Quaternion.identity; // parent prefab to axis prefab.transform.parent = axis.transform; prefab.transform.localPosition = Vector3.zero; prefab.transform.localRotation = Quaternion.identity; // create rigibody Rigidbody body = gameObject.AddComponent <Rigidbody>(); body.useGravity = false; body.constraints = RigidbodyConstraints.FreezeRotation; body.drag = 1; // create classses ShipRefs r = gameObject.AddComponent <ShipRefs>(); r.settings = settings; r.position = gameObject.AddComponent <ShipPosition>(); r.position.r = r; r.effects = gameObject.AddComponent <ShipEffects>(); r.effects.r = r; r.input = gameObject.AddComponent <ShipInput>(); r.input.r = r; r.sim = gameObject.AddComponent <ShipSim>(); r.sim.r = r; r.body = body; r.mesh = settings.REF_MESH; r.cam = CreateNewCamera(isAI, r); r.shield = settings.DAMAGE_SHIELD; r.axis = axis; r.anim = anim; // attach mesh collider to mesh MeshCollider mc = r.mesh.AddComponent <MeshCollider>(); mc.convex = true; // add frictionless physics manterial to collider PhysicMaterial shipMat = new PhysicMaterial(); shipMat.bounceCombine = PhysicMaterialCombine.Minimum; shipMat.frictionCombine = PhysicMaterialCombine.Minimum; shipMat.bounciness = 0; shipMat.dynamicFriction = 0; shipMat.staticFriction = 0; mc.material = shipMat; r.isAI = isAI; // destroy this class (it's no longer needed) Destroy(this); }
public override void OnInspectorGUI() { // Set class target ShipSettings classTarget = (ShipSettings)target; // Get current editor GUI settings (for resetting after everything below) int origFoldoutFontSize = EditorStyles.foldout.fontSize; FontStyle origFoldoutFontStyle = EditorStyles.foldout.fontStyle; #region EngineFoldout // Engine EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bEngineExpanded = EditorGUILayout.Foldout(bEngineExpanded, "Engine Settings"); if (bEngineExpanded) { // Labels GUIContent AccelCap = new GUIContent("Acceleration Cap", "The cap value for how quickly the ship reaches the thrust cap."); GUIContent ThrustCap = new GUIContent("Thrust Cap", "The top force that can be applied to the ship."); GUIContent Gain = new GUIContent("Engine Gain", "How quickly the acceleration reaches it's cap."); GUIContent Falloff = new GUIContent("Engine Falloff", "How quickly the acceleration and thrust decrease."); GUIContent Turbo = new GUIContent("Engine Turbo", "How powerful the Turbo pickup is."); // Font Styles EditorStyles.foldout.fontSize = 12; EditorStyles.foldout.fontStyle = FontStyle.Bold; EditorGUILayout.Separator(); // Others classTarget.engineGain = EditorGUILayout.FloatField(Gain, classTarget.engineGain, GUILayout.ExpandWidth(false)); classTarget.engineFalloff = EditorGUILayout.FloatField(Falloff, classTarget.engineFalloff, GUILayout.ExpandWidth(false)); classTarget.engineTurbo = EditorGUILayout.FloatField(Turbo, classTarget.engineTurbo, GUILayout.ExpandWidth(false)); EditorGUILayout.Separator(); // D Class bEngineDClassExpanded = EditorGUILayout.Foldout(bEngineDClassExpanded, "D Class"); if (bEngineDClassExpanded) { classTarget.engineAccelCapD = EditorGUILayout.FloatField(AccelCap, classTarget.engineAccelCapD, GUILayout.ExpandWidth(false)); classTarget.engineThrustCapD = EditorGUILayout.FloatField(ThrustCap, classTarget.engineThrustCapD, GUILayout.ExpandWidth(false)); } // C Class bEngineCClassExpanded = EditorGUILayout.Foldout(bEngineCClassExpanded, "C Class"); if (bEngineCClassExpanded) { classTarget.engineAccelCapC = EditorGUILayout.FloatField(AccelCap, classTarget.engineAccelCapC, GUILayout.ExpandWidth(false)); classTarget.engineThrustCapC = EditorGUILayout.FloatField(ThrustCap, classTarget.engineThrustCapC, GUILayout.ExpandWidth(false)); } // B Class bEngineBClassExpanded = EditorGUILayout.Foldout(bEngineBClassExpanded, "B Class"); if (bEngineBClassExpanded) { classTarget.engineAccelCapB = EditorGUILayout.FloatField(AccelCap, classTarget.engineAccelCapB, GUILayout.ExpandWidth(false)); classTarget.engineThrustCapB = EditorGUILayout.FloatField(ThrustCap, classTarget.engineThrustCapB, GUILayout.ExpandWidth(false)); } // A Class bEngineAClassExpanded = EditorGUILayout.Foldout(bEngineAClassExpanded, "A Class"); if (bEngineAClassExpanded) { classTarget.engineAccelCapA = EditorGUILayout.FloatField(AccelCap, classTarget.engineAccelCapA, GUILayout.ExpandWidth(false)); classTarget.engineThrustCapA = EditorGUILayout.FloatField(ThrustCap, classTarget.engineThrustCapA, GUILayout.ExpandWidth(false)); } // A+ Class bEngineAPClassExpanded = EditorGUILayout.Foldout(bEngineAPClassExpanded, "A+ Class"); if (bEngineAPClassExpanded) { classTarget.engineAccelCapAP = EditorGUILayout.FloatField(AccelCap, classTarget.engineAccelCapAP, GUILayout.ExpandWidth(false)); classTarget.engineThrustCapAP = EditorGUILayout.FloatField(ThrustCap, classTarget.engineThrustCapAP, GUILayout.ExpandWidth(false)); } // A++ Class bEngineAPPClassExpanded = EditorGUILayout.Foldout(bEngineAPPClassExpanded, "A++ Class"); if (bEngineAPPClassExpanded) { classTarget.engineAccelCapAPP = EditorGUILayout.FloatField(AccelCap, classTarget.engineAccelCapAPP, GUILayout.ExpandWidth(false)); classTarget.engineThrustCapAPP = EditorGUILayout.FloatField(ThrustCap, classTarget.engineThrustCapAPP, GUILayout.ExpandWidth(false)); } } EditorGUILayout.Separator(); #endregion #region TurningFoldout // Turning EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bTurningExpanded = EditorGUILayout.Foldout(bTurningExpanded, "Turning Settings"); if (bTurningExpanded) { // Labels GUIContent Amount = new GUIContent("Turning Amount", "How fast the ship can turn."); GUIContent Gain = new GUIContent("Turning Gain", "How quickly the ship starts rotating."); GUIContent Falloff = new GUIContent("Turning Falloff", "How quickly the ship stops rotating."); EditorGUILayout.Separator(); // Settings classTarget.turnAmount = EditorGUILayout.FloatField(Amount, classTarget.turnAmount, GUILayout.ExpandWidth(false)); classTarget.turnGain = EditorGUILayout.FloatField(Gain, classTarget.turnGain, GUILayout.ExpandWidth(false)); classTarget.turnFalloff = EditorGUILayout.FloatField(Falloff, classTarget.turnFalloff, GUILayout.ExpandWidth(false)); } EditorGUILayout.Separator(); #endregion #region AirbrakesFoldout // Airbrakes EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bAirbrakesExpanded = EditorGUILayout.Foldout(bAirbrakesExpanded, "Airbrakes Settings"); if (bAirbrakesExpanded) { // Labels GUIContent Amount = new GUIContent("Airbrakes Amount", "How much the airbrakes cause the ship to bank over."); GUIContent Drag = new GUIContent("Airbrakes Drag", "How much air resistance the airbrakes cause."); GUIContent Gain = new GUIContent("Airbrakes Gain", "How quickly the airbrakes start having an effect on the ship."); GUIContent Falloff = new GUIContent("Airbrakes Falloff", "How quickly the airbrakes stop having an effect on the ship."); GUIContent Turn = new GUIContent("Airbrakes Turn", "How sensitive the airbrakes are."); GUIContent Slidegrip = new GUIContent("Airbrakes Slidegrip", "How much the airbrakes grip the ship to the track."); GUIContent Sideshift = new GUIContent("Airbrakes Sideshift", "How strong sideshifting is."); GUIContent VisualAmount = new GUIContent("Visual Amount", "The angle that the airbrakes on the ship raise to."); GUIContent UpSpeed = new GUIContent("Visual Up Speed", "How quickly the airbrake models on the ship raise."); GUIContent DownSpeed = new GUIContent("Visual Down Speed", "How quickly the airbrake models on the ship lower."); EditorGUILayout.Separator(); // Settings classTarget.airbrakesAmount = EditorGUILayout.FloatField(Amount, classTarget.airbrakesAmount, GUILayout.ExpandWidth(false)); classTarget.airbrakesDrag = EditorGUILayout.FloatField(Drag, classTarget.airbrakesDrag, GUILayout.ExpandWidth(false)); classTarget.airbrakesGain = EditorGUILayout.FloatField(Gain, classTarget.airbrakesGain, GUILayout.ExpandWidth(false)); classTarget.airbrakesFalloff = EditorGUILayout.FloatField(Falloff, classTarget.airbrakesFalloff, GUILayout.ExpandWidth(false)); classTarget.airbrakesTurn = EditorGUILayout.FloatField(Turn, classTarget.airbrakesTurn, GUILayout.ExpandWidth(false)); classTarget.airbrakesSlidegrip = EditorGUILayout.FloatField(Slidegrip, classTarget.airbrakesSlidegrip, GUILayout.ExpandWidth(false)); classTarget.airbrakesSideshift = EditorGUILayout.FloatField(Sideshift, classTarget.airbrakesSideshift, GUILayout.ExpandWidth(false)); EditorGUILayout.Separator(); classTarget.airbrakeAmount = EditorGUILayout.FloatField(VisualAmount, classTarget.airbrakeAmount, GUILayout.ExpandWidth(false)); classTarget.airbrakeUpSpeed = EditorGUILayout.FloatField(UpSpeed, classTarget.airbrakeUpSpeed, GUILayout.ExpandWidth(false)); classTarget.airbrakeDownSpeed = EditorGUILayout.FloatField(DownSpeed, classTarget.airbrakeDownSpeed, GUILayout.ExpandWidth(false)); } EditorGUILayout.Separator(); #endregion #region AntiGravityFoldout // Anti-Gravity Foldout EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bAntiGravityExpanded = EditorGUILayout.Foldout(bAntiGravityExpanded, "Anti-Gravity Settings"); if (bAntiGravityExpanded) { // Labels GUIContent Rebound = new GUIContent("Rebound", "A force that keeps the ship grounded better."); GUIContent ReboundLanding = new GUIContent("Landing Rebound", "A damping multiplier to prevent the ship bouncing up high from great falls."); GUIContent ReboundJumpTime = new GUIContent("Rebound Jump Time", "How long the rebound force is active for."); GUIContent AirGrip = new GUIContent("Air Grip", "How much grip the ship has when in flight."); GUIContent TrackGrip = new GUIContent("Ground Grip", "How much grip the ship has when hovering above the track."); // Font Styles EditorStyles.foldout.fontSize = 12; EditorStyles.foldout.fontStyle = FontStyle.Bold; EditorGUILayout.Separator(); // Others classTarget.agRebound = EditorGUILayout.FloatField(Rebound, classTarget.engineGain, GUILayout.ExpandWidth(false)); classTarget.agReboundLanding = EditorGUILayout.FloatField(ReboundLanding, classTarget.engineFalloff, GUILayout.ExpandWidth(false)); classTarget.agReboundJumpTime = EditorGUILayout.FloatField(ReboundJumpTime, classTarget.engineTurbo, GUILayout.ExpandWidth(false)); EditorGUILayout.Separator(); // D Class bAntiGravityDClassExpanded = EditorGUILayout.Foldout(bAntiGravityDClassExpanded, "D Class"); if (bAntiGravityDClassExpanded) { classTarget.agGripAirD = EditorGUILayout.FloatField(AirGrip, classTarget.agGripAirD, GUILayout.ExpandWidth(false)); classTarget.agGripGroundD = EditorGUILayout.FloatField(TrackGrip, classTarget.agGripGroundD, GUILayout.ExpandWidth(false)); } // C Class bAntiGravityCClassExpanded = EditorGUILayout.Foldout(bAntiGravityCClassExpanded, "C Class"); if (bAntiGravityCClassExpanded) { classTarget.agGripAirC = EditorGUILayout.FloatField(AirGrip, classTarget.agGripAirC, GUILayout.ExpandWidth(false)); classTarget.agGripGroundC = EditorGUILayout.FloatField(TrackGrip, classTarget.agGripGroundC, GUILayout.ExpandWidth(false)); } // B Class bAntiGravityBClassExpanded = EditorGUILayout.Foldout(bAntiGravityBClassExpanded, "B Class"); if (bAntiGravityBClassExpanded) { classTarget.agGripAirB = EditorGUILayout.FloatField(AirGrip, classTarget.agGripAirB, GUILayout.ExpandWidth(false)); classTarget.agGripGroundB = EditorGUILayout.FloatField(TrackGrip, classTarget.agGripGroundB, GUILayout.ExpandWidth(false)); } // A Class bAntiGravityAClassExpanded = EditorGUILayout.Foldout(bAntiGravityAClassExpanded, "A Class"); if (bAntiGravityAClassExpanded) { classTarget.agGripAirA = EditorGUILayout.FloatField(AirGrip, classTarget.agGripAirA, GUILayout.ExpandWidth(false)); classTarget.agGripGroundA = EditorGUILayout.FloatField(TrackGrip, classTarget.agGripGroundA, GUILayout.ExpandWidth(false)); } // AP Class bAntiGravityAPClassExpanded = EditorGUILayout.Foldout(bAntiGravityAPClassExpanded, "A+ Class"); if (bAntiGravityAPClassExpanded) { classTarget.agGripAirAP = EditorGUILayout.FloatField(AirGrip, classTarget.agGripAirAP, GUILayout.ExpandWidth(false)); classTarget.agGripGroundAP = EditorGUILayout.FloatField(TrackGrip, classTarget.agGripGroundAP, GUILayout.ExpandWidth(false)); } // D Class bAntiGravityAPPClassExpanded = EditorGUILayout.Foldout(bAntiGravityAPPClassExpanded, "A++ Class"); if (bAntiGravityAPPClassExpanded) { classTarget.agGripAirAPP = EditorGUILayout.FloatField(AirGrip, classTarget.agGripAirAPP, GUILayout.ExpandWidth(false)); classTarget.agGripGroundAPP = EditorGUILayout.FloatField(TrackGrip, classTarget.agGripGroundAPP, GUILayout.ExpandWidth(false)); } } EditorGUILayout.Separator(); #endregion #region Camera // Camera Rollout EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bCameraExpanded = EditorGUILayout.Foldout(bCameraExpanded, "Camera Settings"); if (bCameraExpanded) { // Labels GUIContent FoV = new GUIContent("Field of View", "How many degrees the camera can see."); // Font Styles EditorStyles.foldout.fontSize = 12; EditorStyles.foldout.fontStyle = FontStyle.Bold; EditorGUILayout.Separator(); // Close Camera bCloseCamExpanded = EditorGUILayout.Foldout(bCloseCamExpanded, "Close Camera"); if (bCloseCamExpanded) { classTarget.camCloseFoV = EditorGUILayout.FloatField(FoV, classTarget.camCloseFoV, GUILayout.ExpandWidth(false)); GUIContent HorSpring = new GUIContent("Horizontal Spring", "How fast the camera chases the ship on the X axis."); classTarget.camCloseSpringHor = EditorGUILayout.FloatField(HorSpring, classTarget.camCloseSpringHor, GUILayout.ExpandWidth(false)); GUIContent VertSpring = new GUIContent("Vertical Spring", "How fast the camera chases the ship on the Y axis."); classTarget.camCloseSpringVert = EditorGUILayout.FloatField(VertSpring, classTarget.camCloseSpringVert, GUILayout.ExpandWidth(false)); GUIContent LA = new GUIContent("Look At", "The position relative to the ship the camera will look at."); classTarget.camCloseLA = EditorGUILayout.Vector3Field(LA, classTarget.camCloseLA); GUIContent POS = new GUIContent("Position", "The target position behind the ship the camera will chase."); classTarget.camCloseOffset = EditorGUILayout.Vector3Field(POS, classTarget.camCloseOffset); } // Far Camera bFarCamExpanded = EditorGUILayout.Foldout(bFarCamExpanded, "Far Camera"); if (bFarCamExpanded) { classTarget.camFarFoV = EditorGUILayout.FloatField(FoV, classTarget.camFarFoV, GUILayout.ExpandWidth(false)); GUIContent HorSpring = new GUIContent("Horizontal Spring", "How fast the camera chases the ship on the X axis."); classTarget.camFarSpringHor = EditorGUILayout.FloatField(HorSpring, classTarget.camFarSpringHor, GUILayout.ExpandWidth(false)); GUIContent VertSpring = new GUIContent("Vertical Spring", "How fast the camera chases the ship on the Y axis."); classTarget.camFarSpringVert = EditorGUILayout.FloatField(VertSpring, classTarget.camFarSpringVert, GUILayout.ExpandWidth(false)); GUIContent LA = new GUIContent("Look At", "The position relative to the ship the camera will look at."); classTarget.camFarLA = EditorGUILayout.Vector3Field(LA, classTarget.camFarLA); GUIContent POS = new GUIContent("Position", "The target position behind the ship the camera will chase."); classTarget.camFarOffset = EditorGUILayout.Vector3Field(POS, classTarget.camFarOffset); } // Internal Camera bInternalCamExpanded = EditorGUILayout.Foldout(bInternalCamExpanded, "Internal Camera"); if (bInternalCamExpanded) { classTarget.camIntFoV = EditorGUILayout.FloatField(FoV, classTarget.camIntFoV, GUILayout.ExpandWidth(false)); GUIContent POS = new GUIContent("Position", "The position relative to the ship the camera will sit."); classTarget.camIntOffset = EditorGUILayout.Vector3Field(POS, classTarget.camIntOffset); } // Backwards Camera bBackwardCamExpanded = EditorGUILayout.Foldout(bBackwardCamExpanded, "Backwards Camera"); if (bBackwardCamExpanded) { classTarget.camBackFoV = EditorGUILayout.FloatField(FoV, classTarget.camBackFoV, GUILayout.ExpandWidth(false)); GUIContent POS = new GUIContent("Position", "The position relative to the ship the camera will sit."); classTarget.camBackOffset = EditorGUILayout.Vector3Field(POS, classTarget.camBackOffset); } // Bonnet Camera bBonnetCamExpanded = EditorGUILayout.Foldout(bBonnetCamExpanded, "Bonnet Camera"); if (bBonnetCamExpanded) { classTarget.camBonnetFoV = EditorGUILayout.FloatField(FoV, classTarget.camBonnetFoV, GUILayout.ExpandWidth(false)); GUIContent POS = new GUIContent("Position", "The position relative to the ship the camera will sit."); classTarget.camBonnetOffset = EditorGUILayout.Vector3Field(POS, classTarget.camBonnetOffset); } } EditorGUILayout.Separator(); #endregion #region Misc // Misc Rollout EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bMiscExpanded = EditorGUILayout.Foldout(bMiscExpanded, "Misc Settings"); if (bMiscExpanded) { // Labels GUIContent ColliderSize = new GUIContent("Collider Scale", "The actual physical size of the ship which will be handled by the physics engine."); GUIContent ShieldAmount = new GUIContent("Shield Amount", "How strong the ship's shield generator is (from a range of 0 - 1)."); GUIContent WeightDist = new GUIContent("Weight Distrubution", "Centre of Mass offset to help weight the ship."); GUIContent TiltInternalSpeed = new GUIContent("Internal Tilt Speed", "How fast the internal camera wobbles when the ship looses balance."); GUIContent TiltInternalAmount = new GUIContent("Internal Tilt Amount", "How much the internal camera wobbles when the ship looses balance."); GUIContent TiltShipSpeed = new GUIContent("Ship Tilt Speed", "How fast the ship wobbles when the ship looses balance."); GUIContent TiltShipAmount = new GUIContent("Ship Tilt Amount", "How much the ship wobbles when the ship looses balance."); EditorGUILayout.Separator(); classTarget.physColliderSize = EditorGUILayout.Vector3Field(ColliderSize, classTarget.physColliderSize); classTarget.physShieldAmount = EditorGUILayout.Slider(ShieldAmount, classTarget.physShieldAmount, 0.0f, 1.0f); classTarget.physWeightDist = EditorGUILayout.Slider(WeightDist, classTarget.physWeightDist, -4.0f, 4.0f); EditorGUILayout.Separator(); classTarget.tiltInternalSpeed = EditorGUILayout.FloatField(TiltInternalSpeed, classTarget.tiltInternalSpeed, GUILayout.ExpandWidth(false)); classTarget.tiltInternalAmount = EditorGUILayout.FloatField(TiltInternalAmount, classTarget.tiltInternalAmount, GUILayout.ExpandWidth(false)); classTarget.tiltShipSpeed = EditorGUILayout.FloatField(TiltShipSpeed, classTarget.tiltShipSpeed, GUILayout.ExpandWidth(false)); classTarget.tiltShipAmount = EditorGUILayout.FloatField(TiltShipAmount, classTarget.tiltShipAmount, GUILayout.ExpandWidth(false)); EditorGUILayout.Separator(); } EditorGUILayout.Separator(); #endregion #region FrontEnd // Frontend Rollout EditorStyles.foldout.fontSize = 16; EditorStyles.foldout.fontStyle = FontStyle.Italic; bFEExpanded = EditorGUILayout.Foldout(bFEExpanded, "Front-End Settings"); if (bFEExpanded) { // Labels GUIContent Speed = new GUIContent("Speed", "The value (0 - 10) that is shown on the menu."); GUIContent Thrust = new GUIContent("Thrust", "The value (0 - 10) that is shown on the menu."); GUIContent Handling = new GUIContent("Handling", "The value (0 - 10) that is shown on the menu."); GUIContent Shield = new GUIContent("Shield", "The value (0 - 10) that is shown on the menu."); EditorGUILayout.Separator(); classTarget.feSpeed = EditorGUILayout.IntSlider(Speed, classTarget.feSpeed, 0, 10); classTarget.feThrust = EditorGUILayout.IntSlider(Thrust, classTarget.feThrust, 0, 10); classTarget.feHandling = EditorGUILayout.IntSlider(Handling, classTarget.feHandling, 0, 10); classTarget.feShield = EditorGUILayout.IntSlider(Shield, classTarget.feShield, 0, 10); } EditorGUILayout.Separator(); #endregion // Information EditorGUILayout.LabelField("This custom inspector makes it easier to edit the ship settings."); EditorGUILayout.LabelField("Attach this script to your ship model prefab!"); // Reset editor styles EditorStyles.foldout.fontSize = origFoldoutFontSize; EditorStyles.foldout.fontStyle = origFoldoutFontStyle; }
// Use this for initialization void Awake() { shipSettings = gameObject.GetComponent<ShipSettings>(); }
public void SaveAs(string path) { foreach (var item in _components) { item.Value.Save(Cleanup(_jsonDatabase.GetComponent(item.Key))); } foreach (var item in _devices) { item.Value.Save(Cleanup(_jsonDatabase.GetDevice(item.Key))); } foreach (var item in _weapons) { item.Value.Save(Cleanup(_jsonDatabase.GetWeapon(item.Key))); } foreach (var item in _ammunition) { item.Value.Save(Cleanup(_jsonDatabase.GetAmmunition(item.Key))); } foreach (var item in _ammunitionObsolete) { item.Value.Save(Cleanup(_jsonDatabase.GetAmmunitionObsolete(item.Key))); } foreach (var item in _droneBays) { item.Value.Save(Cleanup(_jsonDatabase.GetDroneBay(item.Key))); } foreach (var item in _ships) { item.Value.Save(Cleanup(_jsonDatabase.GetShip(item.Key))); } foreach (var item in _shipBuilds) { item.Value.Save(Cleanup(_jsonDatabase.GetShipBuild(item.Key))); } foreach (var item in _satellites) { item.Value.Save(Cleanup(_jsonDatabase.GetSatellite(item.Key))); } foreach (var item in _satelliteBuilds) { item.Value.Save(Cleanup(_jsonDatabase.GetSatelliteBuild(item.Key))); } foreach (var item in _technologies) { item.Value.Save(Cleanup(_jsonDatabase.GetTechnology(item.Key))); } foreach (var item in _skills) { item.Value.Save(Cleanup(_jsonDatabase.GetSkill(item.Key))); } foreach (var item in _componentStats) { item.Value.Save(Cleanup(_jsonDatabase.GetComponentStats(item.Key))); } foreach (var item in _componentMods) { item.Value.Save(Cleanup(_jsonDatabase.GetComponentMod(item.Key))); } foreach (var item in _factions) { item.Value.Save(Cleanup(_jsonDatabase.GetFaction(item.Key))); } foreach (var item in _loot) { item.Value.Save(Cleanup(_jsonDatabase.GetLoot(item.Key))); } foreach (var item in _quests) { item.Value.Save(Cleanup(_jsonDatabase.GetQuest(item.Key))); } foreach (var item in _fleets) { item.Value.Save(Cleanup(_jsonDatabase.GetFleet(item.Key))); } foreach (var item in _characters) { item.Value.Save(Cleanup(_jsonDatabase.GetCharacter(item.Key))); } foreach (var item in _questItems) { item.Value.Save(Cleanup(_jsonDatabase.GetQuestItem(item.Key))); } foreach (var item in _bulletPrefabs) { item.Value.Save(Cleanup(_jsonDatabase.GetBulletPrefab(item.Key))); } foreach (var item in _visualEffects) { item.Value.Save(Cleanup(_jsonDatabase.GetVisualEffect(item.Key))); } ShipSettings.Save(Cleanup(_jsonDatabase.ShipSettings)); GalaxySettings.Save(Cleanup(_jsonDatabase.GalaxySettings)); _jsonDatabase.SaveData(path); }
public ShipMotor(IShipInput ship_input, Transform transform_to_move, ShipSettings ship_settings) { this._ship_input = ship_input; this._transform_to_move = transform_to_move; this._ship_settings = ship_settings; }