public void SetValues(ShipStats stats, int costUsed) { healthLabel.text = stats.health.ToString(); shieldLabel.text = stats.shield.ToString(); speedLabel.text = stats.speed.ToString(); damageLabel.text = stats.damage.ToString(); costLabel.text = string.Format(Cost, costUsed, costTotal); }
void OnTriggerEnter(Collider other) { Debug.Log(gameObject + " Collide with " + other.name); if(other.CompareTag("Enemy")){ bulletstats = GetComponent<BulletStats>(); shipstats = other.collider.GetComponent<ShipStats>(); shipstats.decreaseHealth(bulletstats.getDamage() * (1 - (shipstats.getArmor() - bulletstats.getArmorPen()))); Destroy(gameObject); } }
public BuildInfo(string name, ShipStats stats, int trimColor, ICollection<KeyValuePair<CUBE, CUBEGridInfo>> info) { this.name = name; this.stats = stats; this.trimColor = trimColor; partList = new List<KeyValuePair<int, CUBEGridInfo>>(info.Count); foreach (var entry in info) { partList.Add(new KeyValuePair<int, CUBEGridInfo>(entry.Key.ID, entry.Value)); } }
public virtual void Start() { stats = gameObject.GetComponent <ShipStats>(); audioController = gameObject.GetComponent <LocalAudioController>(); initialPosition = transform.position; if (weapons.Length != 0) { ClearWeapons(); } if (energyGenerationActive) { StartCoroutine(GenerateEnergy()); } }
//TODO:Remove spritebatch, it's for debug only public Ship3D(Model drawModel, SpriteBatch spriteBatch, Vector2 position, Vector2 velocity, float rotation, int shipID, int playerID, string playerName, ShipStats shipStats, ParticleManager particleManager, World world, HashSet <int> teams) : base(shipID, playerID, playerName, shipStats, particleManager, spriteBatch, teams) { DrawModel = drawModel; DrawData = new DrawData3D(); }
void ShootEnemy() { shipTrans = this.gameObject.transform.position; enemyTrans = thisShip.enemyType.transform.position; enemyShip = thisShip.enemyType.GetComponent <ShipHealth>().thisShip; /************************************************ * Find a way to access the hit points of the enemyType* ************************************************/ if (Vector3.Distance(shipTrans, enemyTrans) < 1f) { Debug.Log("Time to fire"); enemyShip.Hitpoints -= thisShip.Damage; print(enemyShip.Hitpoints); } }
/// <summary> /// Assigns necessary UI elements /// </summary> /// <param name="title"></param> /// <param name="text"></param> /// <param name="results"></param> /// <param name="background"></param> /// <param name="textBoxMask"></param> /// <param name="buttonSpace"></param> /// <param name="ship"></param> /// <param name="campaignManager"></param> public void AssignStatusFromEventSystem(TMP_Text title, TMP_Text text, GameObject results, Image background, Image textBoxMask, Transform buttonSpace, ShipStats ship, CampaignManager campaignManager) { titleBox = title; textBox = text; resultsBox = results; backgroundUI = background; textMask = textBoxMask; buttonGroup = buttonSpace; thisShip = ship; campMan = campaignManager; if (resultsBox != null) { resultsBox.transform.GetChild(0).GetComponentInChildren <TMP_Text>().text = ""; resultsBox.SetActive(false); } }
private void Awake() { // Singleton pattern that makes sure that there is only one MoraleManager if (instance) { Destroy(gameObject); } else { instance = this; } shipStatsUI = FindObjectOfType <ShipStatsUI>(); ship = GameObject.FindObjectOfType <ShipStats>(); if (!ship) { print("Could not find ship"); } }
/// <summary> /// Load Player Ship data from definition, init components and setup config data /// </summary> public void Init() { ShipDefinition = GameDefinitions.ShipDefinitions.FirstOrDefault(x => x.ID == LevelManager.PlayerDefitionPool.ID); ShipStats = new ShipStats(ShipDefinition.Health, ShipDefinition.Speed, ShipDefinition.ShootTime); Weapons = new Weapons(this, ShipDefinition); #if UNITY_EDITOR playerController = new PlayerController(); #elif UNITY_ANDROID playerController = new PlayerMobileController(); #endif playerController.Init(this); ShipRendererBehaviour = GetComponentInChildren <ShipRendererBehaviour>(); ShipRendererBehaviour.Init(this); }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (timer > 2.0f) { if (ShipStats.ShipShield < 100) { ShipStats.ShipShield += 5; GameObject shieldTextClone = Instantiate(shieldText, transform.position, Quaternion.identity); Debug.Log("generated"); } if (ShipStats.ShipShield > 100) { Debug.Log("max shield"); ShipStats.ShipShield = 100; } ShipStats.UpdateHUD(); timer = 0.0f; } }
/// <summary> /// Sets the instance of the GameManager using the Singleton pattern. /// Finds the AdditiveSceneManager and sets it to additiveSceneManager. /// </summary> private void Awake() { // Singleton pattern that makes sure that there is only one GameManager if (instance) { Destroy(gameObject); } else { instance = this; } // Sets the reference to the AdditiveSceneManager in the active scene. additiveSceneManager = FindObjectOfType <AdditiveSceneManager>(); // Sets the reference to the JobManager in the active scene jobManager = FindObjectOfType <JobManager>(); ship = FindObjectOfType <ShipStats>(); }
public void Start() { shipStats = FindObjectOfType <ShipStats>(); // set refill tooltip costs/gains refillToolTipText[0].text = "-" + priceForCrewReplacement; refillToolTipText[1].text = crewLost.ToString(); // set repair tooltip costs/gains repairToolTipText[0].text = "-" + priceForHullRepair; repairToolTipText[1].text = hullDamage.ToString(); // set repair tooltip costs/gains energyToolTipText[0].text = "-" + priceForEnergyRefill; energyToolTipText[1].text = energyLost.ToString(); CheckCanRefillCrew(); CheckCanRepairShip(); CheckCanRefillEnergy(); }
void OnTriggerEnter(Collider other) { Target tar = other.GetComponent <Target>(); if (tar != null) { tar.TakeDamage(40f); if (tar.tag == "Meteor") { //Shrink it out //other.transform.localScale = new Vector3(other.transform.localScale.x-0.05f ,other.transform.localScale.y-0.05f ,other.transform.localScale.z-0.05f ); if (tar.health <= 0) { ShipStats.AddPoints(10); } GameObject temp = Instantiate(imapact, this.transform.position, Quaternion.identity); Destroy(temp, 2f); } } Destroy(this.gameObject); }
public Penguin(Vector2 position, Vector2 velocity, float rotation, int shipID, int playerID, string playerName, ShipStats shipStats, ParticleManager particleManager, World world, SpriteBatch spriteBatch, Texture2D drawTex, HashSet <int> teams) : base(shipID, playerID, playerName, shipStats, particleManager, spriteBatch, teams) { currentDrawTex = drawTex; Texture = drawTex; engineOffset = 54 / 2.3f; shipName = "Penguin"; AssignBody(position, velocity, rotation, world, 54 / 2f); }
void FindTarget() { /* * Collider[] hitColliders = Physics.OverlapSphere(this.transform.position, SearchRadius); * List<ShipStats> PotentialTargets = new List<ShipStats>(); * for(int i = 0; i < hitColliders.Length; i++) * { * if(hitColliders[i].gameObject.GetComponent<ShipStats>() != null) * { * if(hitColliders[i].gameObject.GetComponent<ShipStats>().Team != SS.Team) * { * PotentialTargets.Add(hitColliders[i].gameObject.GetComponent<ShipStats>()); * //Target = hitColliders[i].gameObject.GetComponent<ShipStats>(); * //i = hitColliders.Length; //break from loop * } * } * }*/ List <ShipStats> PotentialTargets; if (SS.Team == 0) { PotentialTargets = BM.EnemyShips; } else { PotentialTargets = BM.FriendlyShips; } if (PotentialTargets.Count == 0) { Target = null; GameFinished = true; } else { Target = PotentialTargets[Random.Range(0, PotentialTargets.Count)]; } }
public void GenerateFactionLoadouts(Faction faction) { faction.FightersPool = new List <Loadout>(); faction.FreightersPool = new List <Loadout>(); faction.CapitalPool = new List <Loadout>(); //create 3 random loadouts for each ship in the ship pool and add them to corresponding loadout pool int index = 0; foreach (string shipID in faction.ShipPool) { ShipStats shipStats = GameManager.Inst.ItemManager.GetShipStats(shipID); Loadout loadout1 = GenerateFactionLoadout(faction, shipID, index); index++; Loadout loadout2 = GenerateFactionLoadout(faction, shipID, index); index++; Loadout Loadout3 = GenerateFactionLoadout(faction, shipID, index); index++; List <Loadout> targetList = null; if (shipStats.ShipType == ShipType.Fighter) { targetList = faction.FightersPool; } else if (shipStats.ShipType == ShipType.Transport || shipStats.ShipType == ShipType.CargoShip) { targetList = faction.FreightersPool; } else { targetList = faction.CapitalPool; } targetList.Add(loadout1); targetList.Add(loadout2); targetList.Add(Loadout3); } }
public void AbsorbePowerUp(ShipController ship) { ShipStats shipStats = ship.stats; switch (item.type) { case ItemType.shield: ShieldController shield = ship.gameObject.GetComponentInChildren <ShieldController>(); shield.PowerUpShield(); break; case ItemType.weapon: Weapon_SO newWeapon = (Weapon_SO)item; if (shipStats.GetActiveWeapon() != newWeapon.weaponType) { ship.ClearWeapons(); } ship.ActivateFirstInactiveWeapon(newWeapon.weaponType); break; } Destroy(gameObject); }
private void DamageEnemyShip(float dmg) { //calculate final damage if (ShipStats.ShipShield == 0) { ShipStats.ShipHealth -= dmg; if (ShipStats.ShipHealth < 0) { ShipStats.ShipHealth = 0; } } else { ShipStats.ShipShield -= dmg; if (ShipStats.ShipShield < 0) { ShipStats.ShipShield = 0; } } ShipStats.UpdateHUD(); }
public Battlecruiser(Vector2 position, Vector2 velocity, float rotation, int shipID, int playerID, string playerName, ShipStats shipStats, ParticleManager particleManager, World world, SpriteBatch spriteBatch, Texture2D drawTex, HashSet <int> teams) : base(shipID, playerID, playerName, shipStats, particleManager, spriteBatch, teams) { _drawScale = 2; currentDrawTex = drawTex; Texture = drawTex; shipName = "Battlecruiser"; //Fill texArray int index = 0; for (int i = 0; i < 4; i++) //Rows { for (int j = 0; j < 8; j++) //Column { rectArray[index] = new Rectangle(j * 108, i * 86, 108, 86); index++; } } AssignBody(position, velocity, rotation, world, rectArray[0].Width * _drawScale / 2, BodyShapes.Oval, rectArray[0].Height * _drawScale / 2); engineOffset = rectArray[0].Width / 2.8f * _drawScale; }
public void Refresh() { string shipID = CurrentLoadout.ShipID; ShipStats stats = GameManager.Inst.ItemManager.GetShipStats(shipID); HullValue.text = stats.Hull.ToString(); TurnRateValue.text = stats.TurnRate.ToString(); PowerSupplyValue.text = stats.PowerSupply.ToString(); ModSlotsValue.text = stats.ModSlots.ToString(); FASpeedValue.text = stats.MaxSpeed.ToString() + "um/s"; AccelerationValue.text = stats.Acceleration.ToString() + " um/ss"; CruiseSpeedValue.text = stats.CruiseSpeed.ToString() + " um/s"; CruiseDelayValue.text = stats.CruisePrepTime.ToString() + " s"; FuelValue.text = stats.MaxFuel.ToString(); LifeSupportValue.text = stats.LifeSupport.ToString(); ShieldClassValue.text = stats.ShieldClass.ToString(); StorageValue.text = stats.AmmoBaySize + " + " + stats.CargoBaySize; WeaponJointsValue.text = ""; foreach (WeaponJointData joint in stats.WeaponJoints) { string line = "Class " + joint.Class + " "; if (joint.RotationType == WeaponRotationType.Gimball) { line += "Gun/Missile"; } else if (joint.RotationType == WeaponRotationType.Turret) { line += "Turret"; } line += '\n'; WeaponJointsValue.text += line; } for (int i = 0; i < stats.DefenseSlots; i++) { WeaponJointsValue.text += "Defense Equipment" + '\n'; } }
// Start is called before the first frame update void Awake() { //Singleton pattern if (instance) { instance.myCanvas = myCanvas; instance.cheatModeActiveText = cheatModeActiveText; instance.helpMenu = helpMenu; instance.myCanvas.SetActive(false); instance.cheatModeActiveText.SetActive(instance.showingActiveText); instance.helpMenu.SetActive(instance.showingHelpMenu); Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } es = FindObjectOfType <EventSystem>(); campMan = FindObjectOfType <CampaignManager>(); thisShip = FindObjectOfType <ShipStats>(); jm = FindObjectOfType <JobManager>(); asm = FindObjectOfType <AdditiveSceneManager>(); //myCanvas.SetActive(false); cheatModeActiveText.SetActive(true); showingActiveText = true; helpMenu.SetActive(false); showingHelpMenu = false; inMinigameTest = false; }
public void Refresh() { string shipID = CurrentLoadout.ShipID; ShipStats stats = GameManager.Inst.ItemManager.GetShipStats(shipID); ShipName.text = stats.DisplayName; ShipDescription.text = stats.Description; if (ShipImage != null) { GameObject.Destroy(ShipImage.gameObject); } ShipImage = GameManager.Inst.UIManager.LoadUISprite("ShipIcon" + shipID, ShipImageAnchor.transform, 230, 172, 10); float hullAmountPercent = 0; float fuelAmountPercent = 0; float lsAmountPercent = 0; if (GameManager.Inst.SceneType == SceneType.Space) { hullAmountPercent = GameManager.Inst.PlayerControl.PlayerShip.HullAmount / GameManager.Inst.PlayerControl.PlayerShip.HullCapacity; fuelAmountPercent = GameManager.Inst.PlayerControl.PlayerShip.FuelAmount / GameManager.Inst.PlayerControl.PlayerShip.MaxFuel; lsAmountPercent = GameManager.Inst.PlayerControl.PlayerShip.LifeSupportAmount / GameManager.Inst.PlayerControl.PlayerShip.MaxLifeSupport; } else if (GameManager.Inst.SceneType == SceneType.Station) { hullAmountPercent = CurrentLoadout.HullAmount / GameManager.Inst.ItemManager.GetShipStats(CurrentLoadout.ShipID).Hull; fuelAmountPercent = CurrentLoadout.FuelAmount / GameManager.Inst.ItemManager.GetShipStats(CurrentLoadout.ShipID).MaxFuel; lsAmountPercent = CurrentLoadout.LifeSupportAmount / GameManager.Inst.ItemManager.GetShipStats(CurrentLoadout.ShipID).LifeSupport; } HullIndicator.SetFillPercentage(hullAmountPercent); FuelIndicator.SetFillPercentage(fuelAmountPercent); LifeSupportIndicator.SetFillPercentage(lsAmountPercent); }
private void Start() { ship = FindObjectOfType <ShipStats>(); CalculateTicks(); }
// Start is called before the first frame update void Start() { selectedShip = GetComponent <ShipStats>(); }
private void Start() { ship = FindObjectOfType <ShipStats>(); campaignManager = FindObjectOfType <CampaignManager>(); }
private void AdminShipChange(Player player, ShipStats shs) { ConsoleManager.WriteLine("Warning: AdminShipChange is currently disabled.", ConsoleMessageType.Warning); }
public MultiplierShipStatView(ShipStats stat, string shortDesc, string longDesc = "") : base(stat, shortDesc, longDesc) { }
public void ChangeShipType(ShipStats shs) { ShipStats = shs; SetHealthAndShields(shs); }
public RangedShipStatView(ShipStats stat, ShipStats upperStat, string shortDesc, string longDesc = "") : base(stat, shortDesc, longDesc) { this.upperStat = upperStat; }
// Use this for initialization void Start() { EngineAudio = GetComponent<AudioSource>(); Body = GetComponent<Rigidbody2D>(); Stats = GetComponent<ShipStats>(); GameManager.PlayerStats = Stats; GameManager.PlayerObject = gameObject; GameObject.Find("MainCamera").GetComponent<FollowPlayerShip>().Player = gameObject; GameManager.ActivePlayers.Add(gameObject); //transform.position = new Vector2(GameManager.Instance.WorldXBounds / 2, // GameManager.Instance.WorldYBounds / 2); }
public ProcShipStatView(ShipStats stat, string shortDesc, string longDesc = "") : base(stat, shortDesc, longDesc) { }
// Take input price and calculate customer behavior public void ConfirmPrice() { float amount = float.Parse(GameObject.Find("InputPrice").GetComponent <InputField>().text); if (amount <= 0) { return;//Error input } else { // Make sure offer panel is inaccesible after offer is made HidePopUpWindow(); ShipStats ship = currentShip; float maximumOffer = currentCustomer.MaxBuyingPrice(currentShip); //When customer accept the offer if (amount <= maximumOffer) { currentSoldShipParent = currentShipParent; AddIncome(amount, ship.value); if (amount / maximumOffer < 0.85f) { speechBubble.text = purchaseResponseCheap[Random.Range(0, purchaseResponseCheap.Length)]; currentCustomer.OutOfActions("Max Price: $" + maximumOffer); } else { speechBubble.text = purchaseResponseAverage[Random.Range(0, purchaseResponseAverage.Length)]; currentCustomer.OutOfActions("Max Price: $" + maximumOffer); } // If it has been accepted, just decrement the dealer action count for the visual of the thing dealerActions--; actionsText.text = dealerActions.ToString(); } //When customer can't accept the offer made, customer becomes inpatient else { speechBubble.text = purchaseResponseExpensive[Random.Range(0, purchaseResponseExpensive.Length)]; if (amount >= maximumOffer && amount < maximumOffer * 1.2f) { currentCustomer.UpdatePatience(-10.0f); } else if (amount >= maximumOffer * 1.2f && amount < maximumOffer * 1.5f) { currentCustomer.UpdatePatience(-20.0f); } else if (amount >= maximumOffer * 1.5f && amount < maximumOffer * 2f) { currentCustomer.UpdatePatience(-40.0f); } else if (amount >= maximumOffer * 2f && amount < maximumOffer * 3f) { currentCustomer.UpdatePatience(-70.0f); } else if (amount >= maximumOffer * 3f) { currentCustomer.UpdatePatience(-100.0f); } if (currentCustomer.patience == 0 || GameManager.instance.dealerActions == 1) { if (GameManager.instance.dealerActions > 1) { StartCoroutine("wait", maximumOffer); } else { UpdateFeedback("$" + maximumOffer + " Would've Done It..."); } } // If it has not been accepted, check as usual to see if the dealer is out of actions DealerActionCountdown(); } } }
public void AddFlat(ShipStats other) { agility += other.agility; thrust += other.thrust; maxTurnSpeed += other.maxTurnSpeed; maxSpeed += other.maxSpeed; passengerCapacity += other.passengerCapacity; armor += other.armor; shield += other.shield; mass += other.mass; damageMultiplier += other.damageMultiplier; }
protected override void InitStats() { Stats = new ShipStats(ShipID); }
// Use this for initialization void Start() { Destroy(gameObject, 30); shipstats = GetComponent<ShipStats>(); deathanim = (GameObject) Resources.Load("DeathAnimation"); }
void Awake() { if (s_Instance == null) s_Instance = this; //DontDestroyOnLoad(this); }
public BuildInfo() { stats = new ShipStats(); partList = new List<KeyValuePair<int, CUBEGridInfo>>(); }
private Loadout GenerateFactionLoadout(Faction faction, string shipID, int loadoutIndex) { ShipStats shipStats = GameManager.Inst.ItemManager.GetShipStats(shipID); Loadout loadout = new Loadout(shipID, shipStats.ShipType); List <InvItemData> shieldCandidates = new List <InvItemData>(); List <InvItemData> capacitorCandidates = new List <InvItemData>(); List <InvItemData> thrusterCandidates = new List <InvItemData>(); List <InvItemData> scannerCandidates = new List <InvItemData>(); List <InvItemData> defensiveCandidates = new List <InvItemData>(); List <InvItemData> weaponCandidates = new List <InvItemData>(); foreach (string equipmentID in faction.EquipmentPool) { //find the shield with same class as the ship's shield class ItemStats itemStats = GameManager.Inst.ItemManager.GetItemStats(equipmentID); Item item = new Item(itemStats); if (item.Type == ItemType.Equipment) { InvItemData itemData = new InvItemData(); itemData.Quantity = 1; itemData.Item = item; string equipmentType = item.GetStringAttribute("Equipment Type"); if (equipmentType == "Shield") { ShieldClass shieldClass = (ShieldClass)Enum.Parse(typeof(ShieldClass), item.GetStringAttribute("Shield Class")); if (shieldClass == shipStats.ShieldClass) { shieldCandidates.Add(itemData); } } else if (equipmentType == "WeaponCapacitor") { capacitorCandidates.Add(itemData); } else if (equipmentType == "Thruster") { thrusterCandidates.Add(itemData); } else if (equipmentType == "Scanner") { scannerCandidates.Add(itemData); } } else if (item.Type == ItemType.Defensives) { if (shipStats.DefenseSlots > 0) { InvItemData itemData = new InvItemData(); itemData.Quantity = 1; itemData.Item = item; defensiveCandidates.Add(itemData); } } else if (item.Type == ItemType.Weapon) { InvItemData itemData = new InvItemData(); itemData.Quantity = 1; itemData.Item = item; weaponCandidates.Add(itemData); } else if (item.Type == ItemType.Ammo) { InvItemData itemData = new InvItemData(); itemData.Quantity = 1; itemData.Item = item; loadout.AmmoBayItems.Add(itemData); Debug.Log("Party Spawner Added ammo " + itemData.Item.ID); } } loadout.Shield = shieldCandidates[UnityEngine.Random.Range(0, shieldCandidates.Count)]; loadout.WeaponCapacitor = capacitorCandidates[UnityEngine.Random.Range(0, capacitorCandidates.Count)]; loadout.Thruster = thrusterCandidates[UnityEngine.Random.Range(0, thrusterCandidates.Count)]; loadout.Scanner = scannerCandidates[UnityEngine.Random.Range(0, scannerCandidates.Count)]; if (shipStats.DefenseSlots > 0) { loadout.Defensives = new List <InvItemData>(); loadout.Defensives.Add(defensiveCandidates[UnityEngine.Random.Range(0, defensiveCandidates.Count)]); } //go through each weapon slot and find all the weapon candidates that can fit it, and then pick a random one loadout.WeaponJoints = new Dictionary <string, InvItemData>(); foreach (WeaponJointData jointData in shipStats.WeaponJoints) { List <InvItemData> slotWeaponCandidates = new List <InvItemData>(); foreach (InvItemData weaponItem in weaponCandidates) { if (weaponItem.Item.GetIntAttribute("Weapon Class") <= jointData.Class && weaponItem.Item.GetStringAttribute("Rotation Type") == jointData.RotationType.ToString()) { slotWeaponCandidates.Add(weaponItem); } } if (slotWeaponCandidates.Count > 0) { loadout.WeaponJoints.Add(jointData.JointID, slotWeaponCandidates[UnityEngine.Random.Range(0, slotWeaponCandidates.Count)]); } } loadout.ShipMods = new InvItemData[shipStats.ModSlots]; loadout.CurrentPowerMgmtButton = new Vector3(0, -20f, 0); loadout.FuelAmount = shipStats.MaxFuel; loadout.HullAmount = shipStats.Hull; loadout.LifeSupportAmount = shipStats.LifeSupport; loadout.LoadoutID = faction.ID + "_" + loadoutIndex.ToString(); return(loadout); }
//-------------------------------------------------------------------------------------------------------------------- //Name: Start //Description: Default start function, nothing special here //Parameters: NA //Returns: NA //-------------------------------------------------------------------------------------------------------------------- void Start() { engine = gameObject.AddComponent<AudioSource>(); engine.clip = soundEffects[1]; engine.playOnAwake = true; engine.loop = true; engine.volume = .40f; engine.Play(); engine.spatialBlend = 1.0f; engine.minDistance = 8; engine.maxDistance = 40; _ShipStats = GetComponent<ShipStats> (); direction = new GameObject (); direction.transform.SetParent (transform); DontDestroyOnLoad (transform.gameObject); fCurrentHealth = _ShipStats.fMaxHealth; fCurrentEnergy = _ShipStats.fMaxEnergy; fThrustCurrent = 0.0f; fTurnThreshold = Mathf.PI / 4.0f; PlayerPrefs.SetInt ("laps", 0); rb = GetComponent<Rigidbody> (); rb.angularDrag = 3.0f; rb.mass += _ShipStats.fMass * 250.0f; }
protected ShipStatView(ShipStats stat, string shortDesc, string longDesc = "") { this.stat = stat; this.shortDesc = shortDesc; this.longDesc = string.IsNullOrEmpty(longDesc) ? this.shortDesc : longDesc; }
public void ApplyProportional(ShipStats other) { agility += agility * other.agility; thrust += thrust * other.thrust; maxTurnSpeed += maxTurnSpeed * other.maxTurnSpeed; maxSpeed += maxSpeed * other.maxSpeed; passengerCapacity += passengerCapacity * other.passengerCapacity; armor += armor * other.armor; shield += shield * other.shield; mass += mass * other.mass; damageMultiplier += mass * other.damageMultiplier; }
const float cooldownTime = 10f; //time in seconds player has to wait to use this module again public override void InitServer() { shipStats = GetComponentInParent <ShipStats>(); }
public NPCShip(ShipStats shs, LocatorService ls) : base(shs, ls) { PilotType = PilotTypes.NPC; IsNPC = true; }
public SpreadShipStatView(ShipStats stat, ShipStats spreadStat, string shortDesc, string longDesc = "") : base(stat, shortDesc, longDesc) { this.spreadStat = spreadStat; }
private void SetHealthAndShields(ShipStats shs) { CurrentHealth = shs.MaxHealth + StatBonuses[StatBonusTypes.MaxHealth]; Shields.CurrentShields = shs.MaxShields + StatBonuses[StatBonusTypes.MaxShields]; CurrentEnergy = 0; }
/// <summary> /// Initialize ship components. Health, Motor, and Weapons. /// </summary> public void Initialize(ShipStats stats, Color trimColor) { // TODO: multiplier for all stats MyHealth.Initialize(stats.health * statMultipliers.health, stats.shield * statMultipliers.shield); MyMotor.Initialize(stats.speed * statMultipliers.speed); Weapons.Initialize(this, stats.damage * statMultipliers.damage); //GA.API.Design.NewEvent(GAAbilities + GAWeaponCount, Weapons.weapons.Count(w => w != null)); Augmentations.Initialize(this); //GA.API.Design.NewEvent(GAAbilities + GAAugCount, Augmentations.augmentations.Count(a => a != null)); // effects trailRenderer.material.color = trimColor; HUD.Initialize(this); stateMachine.Start(); }
public BuildFinishedArgs(GameObject ship, ShipStats stats, int trimColor) { this.ship = ship; this.stats = stats; this.trimColor = trimColor; }
/// <summary> /// Create and initialize grid, cells, ship, and cursor. /// </summary> /// <param name="size">Size of the grid's dimensions.</param> /// <param name="weaponCount">How many weapons allowed.</param> /// <param name="augmentationCount">How many augmentations alloed.</param> /// <param name="cubeMaterial">Material to apply to new CUBEs.</param> public void CreateGrid(int size, int weaponCount, int augmentationCount, Material cubeMaterial = null) { // cache material if (cubeMaterial != null) { cubeMat = cubeMaterial; } else if (cubeMat == null) { cubeMat = Singleton<GameResources>.Main.VertexColorLerp_Mat; } // clear any previous data Clear(); if (cells != null) { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { for (int k = 0; k < size; k++) { Destroy(cells[i][j][k]); } } } } // get player inventory inventory = CUBE.GetInventory(); // set start cursor rotation cursorRotation = new Quaternion(0, 0, 0, 1); // initialize this.size = size; grid = new CUBE[size][][]; cells = new GameObject[size][][]; var cursorPosition = new Vector3(-size / 2f + 0.5f, 0f, -size / 2f + 0.5f); // create grid and cells for (int i = 0; i < size; i++) { grid[i] = new CUBE[size][]; cells[i] = new GameObject[size][]; cursorPosition.z = -size / 2f + 0.5f; for (int j = 0; j < size; j++) { grid[i][j] = new CUBE[size]; cells[i][j] = new GameObject[size]; cursorPosition.x = -size / 2f + 0.5f; for (int k = 0; k < size; k++) { cells[i][j][k] = (GameObject)Instantiate(Cell_Prefab); cells[i][j][k].transform.parent = transform; cells[i][j][k].transform.localPosition = cursorPosition; cursorPosition.x++; } cursorPosition.z++; } cursorPosition.y++; } // set current layer and cursor cursor = StartCursorPosition; // create ship if (ship == null) { ship = new GameObject("Ship"); } ship.transform.position = transform.position + Vector3.up * (size / 2f - 0.5f); CurrentStats = new ShipStats(); // build points CorePointsMax = BuildStats.GetCoreCapacity(); CorePointsAvailable = CorePointsMax; // set up weapons weaponSlots = weaponCount; weapons = new List<Weapon>(); // set up augmentations augmentationSlots = augmentationCount; augmentations = new List<Augmentation>(); // create grid center Center = ((GameObject)Instantiate(Center_Prefab, ship.transform.position, Quaternion.identity)).transform; }