public override void OnResponseReceived(dynamic data) { KCDatabase db = KCDatabase.Instance; //api_ship_data foreach (var elem in data.api_ship_data) { int id = (int)elem.api_id; ShipData ship = db.Ships[id]; ship.LoadFromResponse(APIName, elem); for (int i = 0; i < ship.Slot.Count; i++) { if (ship.Slot[i] == -1) { continue; } if (!db.Equipments.ContainsKey(ship.Slot[i])) { //改装時に新装備を入手するが、追加される前にIDを与えられてしまうため EquipmentData eq = new EquipmentData(); eq.LoadFromResponse(APIName, ship.Slot[i]); db.Equipments.Add(eq); } } } //api_deck_data db.Fleet.LoadFromResponse(APIName, data.api_deck_data); base.OnResponseReceived((object)data); }
public void repairTile() { if (selected == null) { return; } HexaTile tile = ShipData.mainShip.GetTile(selected); if (tile == null || tile.device.hpCurrent >= tile.device.hpMax) { return; } int price = tile.RepairPrice(); if (ShipData.metals < price) { AddMessage("Pietrukst metala"); return; } ShipData.addMetals(-price); tile.Repair(); tileDamage.text = tile.device.hpCurrent.ToString("0") + "/" + tile.device.hpMax.ToString("0"); tileRepairText.text = tile.RepairPrice().ToString(); selected = selected; }
/// <summary> /// Вывод здоровья на панель /// </summary> /// <param name="index">Индекс панели</param> /// <param name="sd">Ссылка на данные корабля</param> public void SetHealthShip(int index, ShipData sd) { panel_health[index].img_reload.fillAmount = sd.cannonReloadTimer / sd.maxReloadTime; panel_health[index].img_body.fillAmount = Mathf.Clamp(sd.health_body / sd.health_body_max, 0f, 1f); panel_health[index].img_team.fillAmount = sd.health_team / sd.health_team_max; panel_health[index].img_ctrl.fillAmount = sd.health_control / sd.health_control_max; }
public void SetShipData(string key, ShipData data, float distance) { _name.text = data.shipName.Equals("") ? _noText : data.shipName; _callSign.text = data.callSign.Equals("") ? _noText : GetNaviID(data.callSign); _mmsi.text = key; _distance.text = distance.ToString("F1") + "m"; _lastUpdate.text = data.regDate; _cpaTcpa.text = GetCpaTcpa(data.latitude, data.longitude, data.sog, data.cog); _lastUpdate.text = data.regDate.Equals("") ? _noText : data.regDate; _latitude.text = GetLatitudeRead(data.latitude); _longtitude.text = GetLongiRead(data.longitude); _sog.text = float.Parse(data.sog).ToString("F1") + "kt"; _cog.text = data.cog + "°"; _rot.text = data.rot.Equals("") ? _noText : data.rot + "°"; _destination.text = data.destination.Equals("") ? _noText : data.destination; _eta.text = data.eta.Equals("") ? _noText : GetNaviID(data.eta); //* 파라메타 없다 _status.text = data.naviStatus.Equals("") ? _noText : GetNaviID(data.naviStatus); }
private void DecompressIntoShip(JArray data, ShipData ship) { var movingFlags = new MovingFlags() { RotatingLeft = ExtractValue <bool>(data, _shipContract.RotatingLeft), RotatingRight = ExtractValue <bool>(data, _shipContract.RotatingRight), Forward = ExtractValue <bool>(data, _shipContract.Forward), Backward = ExtractValue <bool>(data, _shipContract.Backward), }; var name = ExtractValue <string>(data, _shipContract.Name); var maxLife = ExtractValue <double>(data, _shipContract.MaxLife); var level = ExtractValue <int>(data, _shipContract.Level); var boosting = ExtractValue <bool>(data, _shipContract.Boost); var abilityData = new AbilityData() { Boosting = boosting }; DecompressIntoCollidable(data, ship); ship.Movement.Position = ship.Movement.Position + _initializationData.Configuration.ShipConfiguration.WIDTH * .5; ship.Movement.Moving = movingFlags; ship.Name = name; ship.MaxLife = maxLife; ship.Level = level; ship.Abilities = abilityData; ship.Width = _initializationData.Configuration.ShipConfiguration.WIDTH; ship.Height = _initializationData.Configuration.ShipConfiguration.HEIGHT; }
public void SetShipUnlocked(ShipData ship, bool unlocked) { string shipName = ship.GetShipName(); int unlockedAsInt = unlocked ? Constants.YES : Constants.NO; PlayerPrefs.SetInt(shipName + PlayerPrefKeys.UNLOCKED, unlockedAsInt); }
public void PurchaseShip(string name) { ShipData shipData = GetShip(name); AudioManager audioManager = AudioManager.instance; if (IsShipUnlocked(shipData)) { Debug.Log("Cannot buy " + name + " because it is already unlocked"); audioManager.Play(SoundNames.SHOP_REJECT_PURCHASE); return; } long cash = GetCash(); long cost = shipData.GetCost(); if (cash >= cost) { SetCash(cash - cost); selectedShipData = shipData; SetShipUnlocked(shipData, true); audioManager.Play(SoundNames.SHOP_SPEND_CASH); } else { Debug.Log("Not enough wonga! You have: " + GetCash() + " and you need " + shipData.GetCost()); audioManager.Play(SoundNames.SHOP_REJECT_PURCHASE); } }
/// <summary> /// 制空戦力を求めます。 /// </summary> /// <param name="ship">対象の艦船。</param> public static int GetAirSuperiority(ShipData ship) { if (ship == null) { return(0); } if (Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 0) { return(GetAirSuperiority(ship.SlotMaster.ToArray(), ship.Aircraft.ToArray())); } int air = 0; var eqs = ship.SlotInstance; var aircrafts = ship.Aircraft; for (int i = 0; i < eqs.Count; i++) { var eq = eqs[i]; if (eq != null && aircrafts[i] > 0) { int category = eq.MasterEquipment.CategoryType; if (AircraftLevelBonus.ContainsKey(category)) { air += (int)(eq.MasterEquipment.AA * Math.Sqrt(aircrafts[i]) + Math.Sqrt(AircraftExpTable[eq.AircraftLevel] / 10.0) + AircraftLevelBonus[category][eq.AircraftLevel]); } } } return(air); }
public async Task <IHttpActionResult> PutShipData(Int64 id, ShipData shipData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shipData.Id) { return(BadRequest()); } db.Entry(shipData).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShipDataExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public override void OnRequestReceived(Dictionary <string, string> data) { KCDatabase db = KCDatabase.Instance; db.Fleet.LoadFromRequest(APIName, data); bool destroysEquipments = data.ContainsKey("api_slot_dest_flag") ? (data["api_slot_dest_flag"] != "0") : true; foreach (string id in data["api_id_items"].Split(",".ToCharArray())) { int shipID = int.Parse(id); ShipData ship = db.Ships[shipID]; if (destroysEquipments) { for (int i = 0; i < ship.Slot.Count; i++) { if (ship.Slot[i] != -1) { db.Equipments.Remove(ship.Slot[i]); } } } Utility.Logger.Add(2, ship.NameWithLevel + " を除籍しました。"); db.Ships.Remove(shipID); } base.OnRequestReceived(data); }
private float shotsPerSecond; //New calculated value based on inspector input on shipdata private void Start() { data = GetComponent <ShipData>(); shotsPerSecond = 60 / data.shotsPerSecond; //Becomes a time in comparison to a minute shotsPerSecond = shotsPerSecond / 60; //Turns the minute into shots per second data.currentcannonPrefab = data.cannonballPrefab; }
public FuelModel(ShipData data) { MaxFuel = data.InitialFuelSupply; CurrentFuel = MaxFuel; TorqueFuelRate = data.TorqueRate; FuelRate = data.FuelRate; }
public void Tick(string args, UpdateType type, Action TickAction = null) { switch (type) { case UpdateType.Antenna: CustomModules.ForEach(x => x.ProcessCommand(args)); Communications.ProcessRawInputString(args); break; case UpdateType.Trigger: case UpdateType.Terminal: case UpdateType.Update1: ShipData.Update(); EventScheduler.Tick(); Communications.TickStart(); switch (args) { default: break; } Planets.Tick(); CustomModules.ForEach(x => x.Tick()); if (TickAction != null) { TickAction(); } Communications.TickEnd(); break; } }
void Start() { data = GetComponent<ShipData>(); tf = GetComponent<Transform>(); // Start out ready to fire! currentCooldown = data.bulletCooldown; }
void InitTest() { TextAsset EnemyJsonData = Resources.Load <TextAsset>("TextAssets/ShipDataSample"); ShipData EnemyData = ShipDataHelper.JsonToData(EnemyJsonData.text); string EnemyModelPath = "Ships/" + EnemyData.ModelName; GameObject EnemyShipModel = GameObject.Instantiate(AssetsLoader.LoadPrefab(EnemyModelPath), this.transform); Ship EnemyShip = EnemyShipModel.AddComponent <Ship>(); EnemyShip.Init(EnemyData); EnemyShip.ShipData.cannonNum = 1000; EnemyShipModel.AddComponent <EnemyShipController>(); //set tag EnemyShipModel.tag = "Enemy"; SetCollider(EnemyShipModel); Distance1 = DistanceToClose; Distance2 = DistanceToFlee; //ShowShipStats(EnemyShip); }
public async Task <IHttpActionResult> PostShipData(ShipData shipData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ShipDatas.Add(shipData); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (ShipDataExists(shipData.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = shipData.Id }, shipData)); }
void Start() { // Get the components for the Motor and Data data = GetComponent<ShipData>(); engine = GetComponent<ShipEngine>(); shooter = GetComponent<ShipShooter>(); }
public void FindClosestEnemy() { if (!GameManager.instance.isOnePlayer) { //Creates variables awaiting input float distanceToClosestEnemy = Mathf.Infinity; ShipData closestEnemy = null; //Holds onto only the players as potential enemies ShipData[] allEnemies = { (GameManager.instance.playerShipData), (GameManager.instance.player2ShipData) }; //Cycles through the distance of each enemy and decides which is the closest foreach (ShipData currentEnemy in allEnemies) { if (currentEnemy != null) { float distanceToEnemy = (currentEnemy.transform.position - this.transform.position).sqrMagnitude; if (distanceToEnemy < distanceToClosestEnemy) { distanceToClosestEnemy = distanceToEnemy; closestEnemy = currentEnemy; } } } //Sets the target to the closest enemy target = closestEnemy.gameObject; } else { target = GameManager.instance.playerShipData.gameObject; } }
public bool IsShipUnlocked(ShipData ship) { int unlocked = PlayerPrefs.GetInt(ship.GetShipName() + PlayerPrefKeys.UNLOCKED); bool asBool = unlocked.Equals(Constants.YES); return(asBool); }
public void UnlockButtons() { data = SaveManager.LoadPieces(); if (data.unlockShips[0]) { Ship1B1.SetActive(false); Ship1B2.SetActive(true); } else { Ship1B1.SetActive(true); Ship1B2.SetActive(false); } if (data.unlockShips[1]) { Ship2B1.SetActive(false); Ship2B2.SetActive(true); } else { Ship2B1.SetActive(true); Ship2B2.SetActive(false); } if (data.unlockShips[2]) { Ship3B1.SetActive(false); Ship3B2.SetActive(true); } else { Ship3B1.SetActive(true); Ship3B2.SetActive(false); } }
private void DevelopmentEnd(string apiname, dynamic data) { if (tempElement == null) { return; } if ((int)data.api_create_flag == 0) { tempElement.EquipmentID = -1; } else { tempElement.EquipmentID = (int)data.api_slot_item.api_slotitem_id; } ShipData flagship = KCDatabase.Instance.Ships[KCDatabase.Instance.Fleet[1].Members[0]]; tempElement.FlagshipID = flagship.ShipID; tempElement.HQLevel = KCDatabase.Instance.Admiral.Level; Record.Add(tempElement); tempElement = null; }
public int TickDeltaTime = 20; //{get;set;} public Ship(ShipData shipData) { p = new ShipData(shipData, this);; if (p.Rotation == new MyQuaternion(0f, 0f, 0f, 0f)) { p.Rotation = new MyQuaternion(0f, 0f, 0f, 1f); } //rotationToTarget = p.SO.rotation; moveCommand = MoveType.stop; //SendEvent(ShipEvenentsType.move); //host = _host; //newtargetToMove = null; weapons = new SO_weapon[shipData.Weapons.Length]; for (int i = 0; i < shipData.Weapons.Length; i++) { weapons[i] = new SO_weapon(shipData.Weapons[i], this); } equipments = new SO_equipment[shipData.Equipments.Length]; for (int i = 0; i < shipData.Equipments.Length; i++) { equipments[i] = new SO_equipment(shipData.Equipments[i], this); } }
public override void OnResponseReceived(dynamic data) { KCDatabase db = KCDatabase.Instance; int setid = (int)data.api_ship_data.api_set_ship.api_id; int unsetid = (int)data.api_ship_data.api_unset_ship.api_id; // 念のため if (!db.Ships.ContainsKey(setid)) { var a = new ShipData(); a.LoadFromResponse(APIName, data.api_ship_data.api_set_ship); db.Ships.Add(a); } else { db.Ships[setid].LoadFromResponse(APIName, data.api_ship_data.api_set_ship); } if (!db.Ships.ContainsKey(unsetid)) { var a = new ShipData(); a.LoadFromResponse(APIName, data.api_ship_data.api_unset_ship); db.Ships.Add(a); } else { db.Ships[unsetid].LoadFromResponse(APIName, data.api_ship_data.api_unset_ship); } base.OnResponseReceived((object)data); }
/// <summary> /// スロット情報を設定します。主に味方艦用です。 /// </summary> /// <param name="ship">当該艦船。</param> public void SetSlotList(ShipData ship) { int slotCount = Math.Max(ship.MasterShip.SlotSize, 4); if (SlotList.Length != slotCount) { SlotList = new SlotItem[slotCount]; for (int i = 0; i < SlotList.Length; i++) { SlotList[i] = new SlotItem(); } } for (int i = 0; i < SlotList.Length; i++) { var eq = ship.SlotInstance[i]; SlotList[i].EquipmentID = eq != null ? eq.EquipmentID : -1; SlotList[i].AircraftCurrent = ship.Aircraft[i]; SlotList[i].AircraftMax = ship.MasterShip.Aircraft[i]; } SlotSize = ship.MasterShip.SlotSize; PropertyChanged(); }
public virtual void AssignReferences(ShipData data) { parentBoard = (data.ownedByAttacker ? Battle.main.attacker : Battle.main.defender).board; if (data.tiles != null) { if (data.tiles.Length > 0) { tiles = new Tile[data.tiles.GetLength(0)]; for (int i = 0; i < data.tiles.GetLength(0); i++) { tiles[i] = parentBoard.tiles[data.tiles[i, 0], data.tiles[i, 1]]; } } } Vector3 directional = tiles[0].transform.position - tiles[tiles.Length - 1].transform.position; placementInfo.boardPosition = (tiles[0].transform.position + tiles[tiles.Length - 1].transform.position) / 2.0f; placementInfo.boardRotation = Quaternion.Euler(0, directional.z != 0 ? 0 : 90, 0); if (data.concealedBy >= 0) { concealedBy = (Cruiser)parentBoard.ships[data.concealedBy]; } transform.SetParent(parentBoard.transform); gameObject.SetActive(false); }
public void init(ShipData data) { shipData = data; transform.Find("Name").GetComponent <Text> ().text = data.shipName; mainRig = GetComponent <Rigidbody2D> (); speed = 5000; }
public void LoadData() { ShipData newShipData = shipAssembler.GetShipData(); if (shipData == null) { //New Ship shipData = new ShipData(); ChangeStage(CreationStage.CreateName); } else { shipData = new ShipData(); for (int i = 0; i < newShipData.availableSystems.Count; i++) { shipData.AddAvailableSystem(newShipData.availableSystems[i]); } ChangeStage(CreationStage.SelectRoom); foreach (SystemData sysData in newShipData.systemDatas) { AssignFullSystemData(sysData); } } if (onShipDataPrepared != null) { onShipDataPrepared(shipData, hardSaveShip); } }
public override void OnRequestReceived(Dictionary <string, string> data) { KCDatabase db = KCDatabase.Instance; //todo: ここに処理を書くのはみょんな感があるので、可能なら移動する int shipID = int.Parse(data["api_ship_id"]); db.Fleet.LoadFromRequest(APIName, data); ShipData ship = db.Ships[shipID]; Utility.Logger.Add(2, ship.NameWithLevel + LoggerRes.ShipScrapped); for (int i = 0; i < ship.Slot.Count; i++) { if (ship.Slot[i] != -1) { db.Equipments.Remove(ship.Slot[i]); } } db.Ships.Remove(shipID); base.OnRequestReceived(data); }
public ShipObj(MobileFortressClient game, Vector3 position, Quaternion orientation, ShipData data) : base(game, position, orientation, 2) { Data = data; Data.ComposeHitbox(); Data.Hitbox.Position = position; Sector.Redria.Space.Add(Data.Hitbox); this.Entity = Data.Hitbox; //Thrusters = new SingleEntityLinearMotor(Entity, Position); //ControlSurfaces = new SingleEntityAngularMotor(Entity); //ControlSurfaces.Settings.Mode = MotorMode.Servomechanism; //ControlSurfaces.Settings.Servo.MaxCorrectiveVelocity = 2; //Thrusters.Settings.Mode = MotorMode.VelocityMotor; //Thrusters.Settings.VelocityMotor.Softness = 0.002f; //Sector.Redria.Space.Add(Thrusters); //Sector.Redria.Space.Add(ControlSurfaces); Entity.IsAffectedByGravity = false; engineNoise = Resources.Sounds.Engine.CreateInstance(); engineNoise.Apply3D(Camera.Audio, Audio); engineNoise.IsLooped = true; engineNoise.Play(); Entity.CollisionInformation.Tag = this; }
/// <summary> /// 被ダメージ処理を行います。 /// </summary> /// <param name="hps">各艦のHPリスト。</param> /// <param name="index">ダメージを受ける艦のインデックス。</param> /// <param name="damage">ダメージ。</param> protected void AddDamage(int[] hps, int index, int damage) { hps[index] -= Math.Max(damage, 0); //自軍艦の撃沈が発生した場合(ダメコン処理) if (hps[index] <= 0 && !(6 <= index && index < 12) && !IsPractice) { ShipData ship = KCDatabase.Instance.Fleet[index < 6 ? _battleData.Initial.FriendFleetID : 2].MembersInstance[index % 6]; if (ship == null) { return; } foreach (var eid in ship.SlotMaster) { if (eid == 42) //応急修理要員 { hps[index] = (int)(ship.HPMax * 0.2); break; } else if (eid == 43) //応急修理女神 { hps[index] = ship.HPMax; break; } } } }
public override void OnRequestReceived(Dictionary <string, string> data) { KCDatabase db = KCDatabase.Instance; db.Fleet.LoadFromRequest(APIName, data); foreach (string id in data["api_id_items"].Split(",".ToCharArray())) { int shipID = int.Parse(id); ShipData ship = db.Ships[shipID]; for (int i = 0; i < ship.Slot.Count; i++) { if (ship.Slot[i] != -1) { db.Equipments.Remove(ship.Slot[i]); } } Utility.Logger.Add(2, "", "已除籍 : ", ship.NameWithLevel); db.Ships.Remove(shipID); } base.OnRequestReceived(data); }
private string GetEquipmentString(ShipData ship) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < ship.Slot.Count; i++) { if (ship.SlotInstance[i] != null) { sb.AppendFormat("[{0}/{1}] {2}\r\n", ship.Aircraft[i], ship.MasterShip.Aircraft[i], KCDatabase.Instance.Equipments[ship.Slot[i]].NameWithLevel); } } int[] slotmaster = ship.SlotMaster.ToArray(); sb.AppendFormat("\r\n昼戦: {0}\r\n夜戦: {1}\r\n", Constants.GetDayAttackKind(Calculator.GetDayAttackKind(slotmaster, ship.ShipID, -1)), Constants.GetNightAttackKind(Calculator.GetNightAttackKind(slotmaster, ship.ShipID, -1))); { int aacutin = Calculator.GetAACutinKind(ship.ShipID, slotmaster); if (aacutin != 0) { sb.AppendFormat("対空: {0}\r\n", Constants.GetAACutinKind(aacutin)); } } return(sb.ToString()); }
public ShipData get_data() { ShipData _ship_data=new ShipData(); foreach(Sail _s in m_sail_list) { _ship_data.m_sail_list.Add(_s.get_sail_data()); } return _ship_data; }
// Initialization event void Start() { //Initialize shipInfo = ScriptableObject.CreateInstance<ShipData>(); defaultDrag = rigidbody.drag; engine = GetComponent<Engine>() as Engine; engine.enabled = false; asteroidSpawner = GetComponent<ObstacleSpawner>(); lootCollector = GetComponent<Looter>(); lootCollector.enabled = false; if(gravityComponent != null) gravityComponent.SetActive(false); //Set default stuff state = new StateMachine<ShipState>(new Orbit(this)); }
void Start() { tf = GetComponent<Transform> (); data = GetComponent<ShipData>(); isInvincible = false; invincibleCooldown = 0.0f; }
// Use this for initialization void Start() { //Initialize shipInfo = ScriptableObject.CreateInstance<ShipData>(); defaultDrag = rigidbody.drag; lightSpeedEffect = transform.Find("Light Speed Effect").particleSystem; engine = GetComponent<Engine>() as Engine; lineRendererToLauncher = gameObject.AddComponent<LineRenderer>(); asteroidSpawner = GetComponent<ObstacleSpawner>(); //Set default stuff SetToDefaultState(); }
/// <summary> /// Initializes a new instance of the <see cref="Helm" /> class. /// </summary> /// <param name="ship">The ship.</param> public Helm(IShipModel ship) { _ship = ship; _data = ship.Data; _rigidbody = ship.Transform.rigidbody; _gameTime = GameTime.Instance; _gameSpeedMultiplier = _gameTime.GameSpeed.SpeedMultiplier(); // FIXME where/when to get initial GameSpeed before first GameSpeed change? _gameStatus = GameStatus.Instance; _engineRoom = new EngineRoom(_data, _rigidbody); AssessFrequencyOfCourseProgressChecks(); Subscribe(); }
protected virtual ShipData CreateElementData(ShipCategory elementCategory, string elementInstanceName, IPlayer owner) { float mass = TempGameValues.__GetMass(elementCategory); float drag = 0.1F; ShipData elementData = new ShipData(elementCategory, elementInstanceName, 50F, mass, drag) { // Ship's optionalParentName gets set when it gets attached to a fleet Strength = new CombatStrength(), CurrentHitPoints = UnityEngine.Random.Range(25F, 50F), MaxTurnRate = UnityEngine.Random.Range(45F, 315F), Owner = owner, MaxThrust = mass * drag * UnityEngine.Random.Range(2F, 5F) // MaxThrust = Mass * Drag * MaxSpeed; }; return elementData; }
public GuiCursorHudTextFactory_Ship(ShipData data, IntelLevel intelLevel) : base(data, intelLevel) { }
public void init(ShipData _sd) { }
/// <summary> /// Initializes a new instance of the <see cref="ShipHelm" /> class. /// </summary> /// <param name="ship">The ship.</param> /// <param name="shipRigidbody">The ship rigidbody.</param> internal ShipHelm(ShipItem ship, Rigidbody shipRigidbody) { ApCourse = new List<IShipNavigable>(); //_gameMgr = GameManager.Instance; _gameTime = GameTime.Instance; _jobMgr = JobManager.Instance; _ship = ship; _shipData = ship.Data; _engineRoom = new EngineRoom(ship, shipRigidbody); Subscribe(); }
public EngineRoom(ShipItem ship, Rigidbody shipRigidbody) { _ship = ship; _shipData = ship.Data; _shipTransform = ship.transform; _shipRigidbody = shipRigidbody; _gameMgr = GameManager.Instance; _gameTime = GameTime.Instance; _jobMgr = JobManager.Instance; _driftCorrector = new DriftCorrector(ship.transform, shipRigidbody, DebugName); Subscribe(); }
public ColoredTextList_Ship(ShipData ship, string valueFormat = Constants.FormatFloat_1DpMax) { _list.Add(new ColoredText(ship.Hull.GetName())); _list.Add(new ColoredText(valueFormat.Inject(ship.Mass))); _list.Add(new ColoredText(valueFormat.Inject(ship.MaxTurnRate))); }
private ShipData CreateShipData(ShipCategory hull, string shipName, IPlayer owner) { float mass = TempGameValues.__GetMass(hull); float drag = 0.1F; ShipData shipData = new ShipData(hull, shipName, 50F, mass, drag) { // Ship's optionalParentName gets set when it gets attached to a fleet Strength = new CombatStrength(), CurrentHitPoints = UnityEngine.Random.Range(25F, 50F), MaxTurnRate = UnityEngine.Random.Range(45F, 315F), Owner = owner, MaxThrust = mass * drag * UnityEngine.Random.Range(2F, 5F) // MaxThrust = Mass * Drag * MaxSpeed; }; return shipData; }
public AutoPilot(ShipModel ship) { _ship = ship; _shipData = ship.Data; _courseUpdateFrequency /= GameTime.Instance.GameSpeed.SpeedMultiplier(); Subscribe(); }
public EngineRoom(ShipModel ship) { _shipData = ship.Data; _shipRigidbody = ship.rigidbody; _shipRigidbody.useGravity = false; _gameSpeedMultiplier = GameTime.Instance.GameSpeed.SpeedMultiplier(); // FIXME where/when to get initial GameSpeed before first GameSpeed change? //D.Log("{0}.EngineRoom._gameSpeedMultiplier is {1}.", ship.FullName, _gameSpeedMultiplier); Subscribe(); }