static CopperOre() { _id = ItemID.CopperOre; _name = "銅礦"; _description = ""; _type = MineralType.Mine; }
public MineralPrice(MineralType mineralType, double price, double min, double max) { this.MineralType = mineralType; this.Price = price; this.Min = min; this.Max = max; }
public void Weigh(int typeInt) { if (person != null) { MineralType type = (MineralType)typeInt; switch (type) { case MineralType.Lead: if (Lead.Instance.Weighing) { break; } Lead.Instance.Weighing = true; Lead.Instance.NextWeight = person; person = null; break; case MineralType.Aluminum: if (Aluminum.Instance.Weighing) { break; } Aluminum.Instance.Weighing = true; Aluminum.Instance.NextWeight = person; person = null; break; } } }
static IronOre() { _id = ItemID.IronOre; _name = "鐵礦"; _description = ""; _type = MineralType.Mine; }
static Coal() { _id = ItemID.Coal; _name = "煤礦"; _description = ""; _type = MineralType.Fossil; }
private void cboMineral_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (!_initialized) { return; } if (_mineralVisual != null) { _viewport.Children.Remove(_mineralVisual); } MineralType mineralType = (MineralType)cboMineral.SelectedValue; // Create visual ModelVisual3D visual = new ModelVisual3D(); visual.Content = Mineral.GetNewVisual(mineralType); //visual.Transform = new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRandomRotation())); _mineralVisual = visual; _viewport.Children.Add(_mineralVisual); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// This removes enough minerals to fulfill the requested volume. I may chop a larger mineral in two /// </summary> /// <param name="type">The type of mineral to remove</param> /// <param name="volume">How much to remove</param> /// <returns> /// Item1=Volume returned /// Item2=Cargo returned /// </returns> public Tuple <double, Cargo[]> RemoveMineral_Volume(MineralType type, double volume) { lock (_lock) { List <Tuple <int, Cargo> > allCandidates = new List <Tuple <int, Cargo> >(); for (int cntr = 0; cntr < _cargoBays.Length; cntr++) { // Get all the minerals of the requested type from this cargo bay Cargo[] candidates = _cargoBays[cntr].GetCargoSnapshot(). Where(o => o.Type == CargoType.Mineral && ((Cargo_Mineral)o).MineralType == type). ToArray(); if (candidates.Length > 0) { allCandidates.AddRange(candidates.Select(o => Tuple.Create(cntr, o))); } } // Remove as many as necessary (smallest first) var retVal = RemoveMineral_Continue_Volume(allCandidates.OrderBy(o => o.Item2.Volume).ToArray(), volume); // Fully remove any that are zero volume foreach (var cargo in allCandidates) { if (cargo.Item2.Volume.IsNearZero()) { _cargoBays[cargo.Item1].Remove(cargo.Item2.Token); } } return(retVal); } }
public Asteroid GenerateAsteroid(MineralType mineral, int size, int seed) { Random.seed = seed; int ran = Random.Range(0, variants - 1); int mineralIndex = (mineral == MineralType.Blank?0:1); Asteroid clone = Instantiate(baseAsteroid, transform.position, baseAsteroid.transform.rotation) as Asteroid; clone.renderer.material.mainTexture = textureArray[Mathf.Clamp(size, 0, sizes - 1), mineralIndex, ran, 0]; textureArray[Mathf.Clamp(size, 0, sizes - 1), mineralIndex, ran, 0].Apply(); clone.renderer.material.SetColor("_Color", baseColor * Random.Range(0.8f, 1.1f)); clone.renderer.material.SetColor("_OffColor", Asteroid.MineralToColor(mineral) * Random.Range(0.9f, 1.0f)); clone.renderer.material.SetColor("_SpecColor", Asteroid.MineralToColor(mineral) * Random.Range(1.1f, 1.3f)); clone.renderer.material.SetTexture("_BumpMap", textureArray[Mathf.Clamp(size, 0, sizes - 1), mineralIndex, ran, 1]); textureArray[Mathf.Clamp(size, 0, sizes - 1), mineralIndex, ran, 1].Apply(); clone.sizeClass = size; clone.gen = this; clone.mineral = mineral; clone.transform.localScale = Vector3.one * 2 * Random.Range(0.8f, 1.2f) * (Mathf.Pow(2, size)); clone.rigidbody2D.mass = 2 * Mathf.Pow(4, size); if (mineralIndex > 0) { clone.tag = "valuable"; } DeformMesh(clone.GetComponent <MeshFilter>().mesh, clone.GetComponent <PolygonCollider2D>(), (sizes - size + 1), Random.Range(int.MinValue, int.MaxValue)); return(clone); }
static Rock() { _id = ItemID.Rock; _name = "石頭"; _description = ""; _type = MineralType.Stone; }
static Sand() { _id = ItemID.Sand; _name = "沙"; _description = ""; _type = MineralType.Stone; }
static Clay() { _id = ItemID.Clay; _name = "黏土"; _description = ""; _type = (int)MineralType.Soil; }
public bool AddMineral(MineralType t, int q) { if (currentLoad + q > loadCapacity) { return(false); } switch (t) { case MineralType.Copperium: minerals[0] += q; break; case MineralType.Gallium: minerals[1] += q; break; case MineralType.Iron: minerals[2] += q; break; case MineralType.Whatium: minerals[3] += q; break; default: return(false); } currentLoad += q; return(true); }
public void init(int id, int drilledAmount, BrickType brickType, string neighbourCode = "1111", MineralType mineralType = MineralType.None) { this.id = id; this.drilledAmount = drilledAmount; this.brickType = brickType; this.mineralType = mineralType; this.neighbourCode = neighbourCode; //set sprite using drilledAmount neighbourCode and BrickManager sprites spr = GetComponent <SpriteRenderer> (); spr.color = new Color(BRICK_COLOR[(int)brickType], BRICK_COLOR[(int)brickType], BRICK_COLOR[(int)brickType]); if (drilledAmount < 100) { int nonDrilledSpriteIndex = drilledAmount / 17; if (nonDrilledSpriteIndex == 0 && id < BrickManager.COLUMN) { if (mineralType == MineralType.NonBreakableStone) { spr.sprite = BrickManager.current.S_Brick_Stone; } else { spr.sprite = BrickManager.current.S_Brick_Grass; } } else { spr.sprite = BrickManager.current.NonDrilledBrick[nonDrilledSpriteIndex]; } } else { Drilled(); } }
public Cargo_Mineral(MineralType mineralType, double density, double volume) : base(CargoType.Mineral) { this.Density = density; this.Volume = volume; this.MineralType = mineralType; }
public void Add(MineralType mineral, int amount) { if (inventory.ContainsKey(mineral)) { inventory[mineral] = inventory[mineral] + amount; panels[mineral].SetValue(inventory[mineral]); } }
void mission9(MineralType mnrl) { mineralCollectScore.Inc(1); if (mineralCollectScore.HasTempReached(m9record)) { onMissionCompleted(9); CollectMinerals -= mission9; } }
public Mineral GenerateMineral(MineralType t) { Mineral clone = Instantiate(baseMineral, new Vector3(0, 0, 0), baseMineral.transform.rotation) as Mineral; DeformMesh(clone.GetComponent <MeshFilter>().mesh, clone.GetComponent <PolygonCollider2D>(), 4, Random.Range(int.MinValue, int.MaxValue)); clone.renderer.material.SetColor("_OffColor", Asteroid.MineralToColor(t)); clone.renderer.material.SetColor("_Color", Asteroid.MineralToColor(t)); return(clone); }
public static decimal GetSuggestedCredits(MineralType mineralType) { //TODO: Get these from some environment settings //NOTE: The commented values are what I got from websites ($15,000 per carat for diamond seems a bit steep though) //I was screwing around, and this gave a pretty nice curve: // =10 * ((5 + log10(value))^2) // // But I ended up rounding the numbers off to give a smoother curve switch (mineralType) { case MineralType.Ice: //return .0003m; return(25m); case MineralType.Iron: //return .0017m; return(50m); case MineralType.Graphite: //return .08m; return(150m); case MineralType.Gold: //return 49420m; return(400m); case MineralType.Platinum: //return 59840m; return(700m); case MineralType.Emerald: //return 1250000m; return(1000m); case MineralType.Saphire: //return 5000000m; return(1200m); case MineralType.Ruby: //return 12500000m; return(1500m); case MineralType.Diamond: //return 75000000m; return(2000m); case MineralType.Rixium: //return 300000000m; return(5000m); default: throw new ApplicationException("Unknown MineralType: " + mineralType.ToString()); } }
private void CreateMineralsSprtBuild(MineralType mineralType, Vector3D position) { Mineral mineral = new Mineral(); mineral.MineralType = mineralType; mineral.InitialVelocity = Math3D.GetRandomVector_Circular(8); mineral.CreateMineral(_materialManager, _map, _sharedVisuals, position, true, .0005); mineral.PhysicsBody.ApplyForce += new BodyForceEventHandler(Body_ApplyForce); }
public Mineral Get(MineralType type, double visualPriority) { Mineral m = Pool.Get(); m.Definition = Minerals[type]; m.VisualPriority = visualPriority; m.Scene = Simulator.Scene; m.Initialize(); return m; }
public void AddMineral(MineralType mineralType, float ammount) { switch (mineralType) { case MineralType.Lead: Lead += (ammount * PercentOfWeight); break; case MineralType.Aluminum: Aluminum += (ammount * PercentOfWeight); break; } }
void mission7(MineralType mnrl) { if (mnrl != MineralType.Gold) { return; } collectGoldScore.Inc(1); if (collectGoldScore.HasTempReached(m7record)) { onMissionCompleted(7); CollectMinerals -= mission7; } }
void mission8(MineralType mnrl) { if (mnrl != MineralType.Diamond) { return; } collectDiamondScore.Inc(1); if (collectDiamondScore.HasTempReached(m8record)) { onMissionCompleted(8); CollectMinerals -= mission8; } }
void mission6(MineralType mnrl) { if (mnrl != MineralType.Copper) { return; } collectCopperScore.Inc(1); if (collectCopperScore.HasTempReached(m6record)) { onMissionCompleted(6); CollectMinerals -= mission6; } }
/// <summary> /// This should get called on an infrequent basis, and randomize the available inventory /// </summary> public void RandomizeInventory(bool completelyNew) { RandomizePrices(); if (completelyNew) { this.StationInventory.Clear(); } List <Inventory> inventory = new List <Inventory>(); // Ships inventory.AddRange(AdjustInventory( this.StationInventory.Where(o => o.Ship != null), 3, () => { DefaultShipType shipType = GetRandomItemChance(_shipChances).ShipType; ShipDNA shipDNA = DefaultShips.GetDNA(shipType); return(new Inventory(shipDNA, StaticRandom.NextDouble(.5, 2))); })); // Parts inventory.AddRange(AdjustInventory( this.StationInventory.Where(o => o.Part != null), 4, () => { PartCreateChance partType = GetRandomItemChance(_partChances); ShipPartDNA partDNA = GetRandomPart(partType); //TODO: Have a chance to make 2 if it's something that could come in pairs (thruster, gun, etc) return(new Inventory(partDNA)); })); // Minerals inventory.AddRange(AdjustInventory( this.StationInventory.Where(o => o.Mineral != null), 4, () => { MineralType type = UtilityCore.GetRandomEnum <MineralType>(); double volume = StaticRandom.NextPercent(ItemOptionsAstMin2D.MINERAL_AVGVOLUME, 2); return(new Inventory(ItemOptionsAstMin2D.GetMineral(type, volume))); })); this.StationInventory.Clear(); this.StationInventory.AddRange(inventory); _inventoryRandomizeCountdown = StaticRandom.NextDouble(3 * 60, 8 * 60); }
public static Color MineralToColor(MineralType mineral) { switch(mineral) { case(MineralType.Iron): return new Color(225/255f, 179/255f, 121/255f); case(MineralType.Copperium): return new Color(215/255f, 225/255f, 121/255f); case(MineralType.Gallium): return new Color(210/255f, 255/255f, 255/255f); case(MineralType.Whatium): return new Color(255/255f, 141/255f, 247/255f); default: return Color.white; } }
void mission5(MineralType mnrl) { if (mnrl != MineralType.Coal) { return; } Debug.Log("coal found"); collectCoalScore.Inc(1); if (collectCoalScore.HasTempReached(m5record)) { Debug.Log("coal found completed"); onMissionCompleted(5); CollectMinerals -= mission5; } }
private void CreateMinerals_Build(MineralType mineralType) { Mineral mineral = new Mineral(mineralType, new Point3D(0, 0, 0), .0005d, _world, _material_Mineral, _sharedVisuals); var posVel = GetPositionVelocity(mineral.PhysicsBody.Mass); mineral.PhysicsBody.Position = posVel.Item1; mineral.PhysicsBody.AngularVelocity = Math3D.GetRandomVector_Spherical(1d); mineral.PhysicsBody.Velocity = posVel.Item2; mineral.PhysicsBody.ApplyForceAndTorque += new EventHandler <BodyApplyForceAndTorqueArgs>(Mineral_ApplyForceAndTorque); _map.AddItem(mineral); }
public Icon3D(MineralType mineralType) { InitializeComponent(); this.ItemName = mineralType.ToString(); this.MineralType = mineralType; lblName.Text = this.ItemName; lblName.Visibility = _showName ? Visibility.Visible : Visibility.Collapsed; InitializeTrackball(); RenderMineral(); InitializeLight(); }
private void GenerateBlocks() { Mineral block; var map = Map; for (int y = 0; y < height; y++) { for (int z = 0; z < width; z++) { MineralType blockType = world[z, y]; map.TryGetValue(blockType, out block); AddBlock(block, new int[] { z, y }); } } }
public static int MineralPrice(MineralType mineral) { switch (mineral) { case (MineralType.Iron): return 1; case (MineralType.Copperium): return 2; case (MineralType.Gallium): return 4; case (MineralType.Whatium): return 8; default: return 1; } }
public SystemBody(OrbitingEntity parent, PlanetType type) : base() { /// <summary> /// create these or else anything that relies on a unique global id will break. /// </summary> Id = Guid.NewGuid(); Type = type; // set the type ASAP in case anthing needs to know it. Moons = new BindingList <SystemBody>(); Populations = new BindingList <Population>(); SSEntity = StarSystemEntityType.Body; Parent = parent; Position = parent.Position; TaskGroupsInOrbit = new BindingList <TaskGroupTN>(); GeoSurveyList = new Dictionary <Faction, bool>(); /// <summary> /// Default mineral amount is zero. /// do mineral generation elsewhere. /// </summary> m_aiMinerialReserves = new float[Constants.Minerals.NO_OF_MINERIALS]; m_aiMinerialAccessibility = new float[Constants.Minerals.NO_OF_MINERIALS]; for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++) { m_aiMinerialReserves[mineralIterator] = 0.0f; m_aiMinerialAccessibility[mineralIterator] = 0.0f; } _MineralsGenerated = false; _BodyMineralType = MineralType.NotGenerated; #warning planet generation needs minerals, anomalies, and ruins generation. PlanetaryRuins = new Ruins(); Atmosphere = new Atmosphere(this); if (Type != PlanetType.GasDwarf && Type != PlanetType.GasGiant && Type != PlanetType.IceGiant) { SupportsPopulations = true; } }
public int GetSurfaceMinerals(MineralType mineralType) { switch (mineralType) { case MineralType.Ironium: return(this.SurfaceIronium); case MineralType.Boranium: return(this.SurfaceBoranium); case MineralType.Germanium: return(this.SurfaceGermanium); default: throw new ArgumentOutOfRangeException(nameof(mineralType), mineralType, null); } }
public static MineralDNA GetMineral(MineralType mineralType, double volume) { return(new MineralDNA() { PartType = Mineral.PARTTYPE, //Radius = , //Position = , //Orientation = , //Velocity = , //AngularVelocity = , MineralType = mineralType, Volume = volume, Density = Mineral.GetSettingsForMineralType(mineralType).Density *MINERAL_DENSITYMULT, Scale = volume / MINERAL_AVGVOLUME, Credits = GetCredits_Mineral(mineralType, volume), }); }
public static decimal GetCredits_Mineral(MineralType mineralType) { //const decimal BASE = 3m; const decimal BASE = 10m; //roughly x^2.7 switch (mineralType) { case MineralType.Ice: //return BASE * 1m; return BASE * 3m; case MineralType.Graphite: return BASE * 6.5m; case MineralType.Diamond: return BASE * 20m; case MineralType.Ruby: return BASE * 42m; case MineralType.Saphire: return BASE * 77m; case MineralType.Emerald: return BASE * 125m; case MineralType.Iron: return BASE * 190m; case MineralType.Gold: return BASE * 275m; case MineralType.Platinum: return BASE * 380m; case MineralType.Rixium: return BASE * 500m; default: throw new ApplicationException("Unknown MineralType: " + mineralType.ToString()); } }
public Mineral(MineralType mineralType, Point3D position, double volumeInCubicMeters, World world, int materialID, SharedVisuals sharedVisuals, double densityMult = 1d, double scale = 1d, decimal credits = 0m) { this.MineralType = mineralType; this.VolumeInCubicMeters = volumeInCubicMeters; this.Scale = scale; this.Credits = credits; this.Model = GetNewVisual(mineralType, sharedVisuals, scale); // Model Visual ModelVisual3D visual = new ModelVisual3D(); // this is the expensive one, so as few of these should be made as possible visual.Content = this.Model; this.Density = GetSettingsForMineralType(mineralType).Density * densityMult; #region Physics Body Transform3DGroup transform = new Transform3DGroup(); transform.Children.Add(new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRandomRotation()))); transform.Children.Add(new TranslateTransform3D(position.ToVector())); ScaleTransform3D scaleTransform = new ScaleTransform3D(scale, scale, scale); Point3D[] hullPoints = UtilityWPF.GetPointsFromMesh((MeshGeometry3D)sharedVisuals.GetMineralMesh(mineralType), scaleTransform); using (CollisionHull hull = CollisionHull.CreateConvexHull(world, 0, hullPoints)) { this.PhysicsBody = new Body(hull, transform.Value, this.Density * volumeInCubicMeters, new Visual3D[] { visual }); this.PhysicsBody.MaterialGroupID = materialID; this.PhysicsBody.LinearDamping = .01f; this.PhysicsBody.AngularDamping = new Vector3D(.01f, .01f, .01f); //this.PhysicsBody.ApplyForce += new BodyForceEventHandler(Body_ApplyForce); } #endregion // Calculate radius Point3D aabbMin, aabbMax; this.PhysicsBody.GetAABB(out aabbMin, out aabbMax); this.Radius = (aabbMax - aabbMin).Length / 2d; this.CreationTime = DateTime.UtcNow; }
/// <summary> /// This returns the price of a mineral with a volume of 1 /// </summary> private static decimal GetCredits_Mineral_ORIG(MineralType mineralType) { const decimal BASE = 3m; switch (mineralType) { case MineralType.Ice: return BASE * 1m; case MineralType.Graphite: return BASE * 2m; case MineralType.Diamond: return BASE * 3m; case MineralType.Emerald: case MineralType.Saphire: case MineralType.Ruby: return BASE * 3.5m; case MineralType.Iron: return BASE * 7m; case MineralType.Gold: return BASE * 10m; case MineralType.Platinum: return BASE * 15m; case MineralType.Rixium: return BASE * 50m; default: throw new ApplicationException("Unknown MineralType: " + mineralType.ToString()); } }
public bool AddMineral(MineralType t, int q) { if(currentLoad + q > loadCapacity) return false; switch(t) { case MineralType.Copperium : minerals[0] += q; break; case MineralType.Gallium : minerals[1] += q; break; case MineralType.Iron : minerals[2] += q; break; case MineralType.Whatium : minerals[3] += q; break; default : return false; } currentLoad += q; return true; }
private void CreateMinerals_Build(MineralType mineralType, Point3D position) { double volume = StaticRandom.NextPercent(ItemOptionsAstMin2D.MINERAL_AVGVOLUME, 2); decimal credits = ItemOptionsAstMin2D.GetCredits_Mineral(mineralType, volume); double scale = volume / ItemOptionsAstMin2D.MINERAL_AVGVOLUME; Mineral mineral = new Mineral(mineralType, position, volume, _world, _material_Mineral, _sharedVisuals, ItemOptionsAstMin2D.MINERAL_DENSITYMULT, scale, credits); mineral.PhysicsBody.AngularVelocity = Math3D.GetRandomVector_Spherical(1d); mineral.PhysicsBody.Velocity = Math3D.GetRandomVector_Circular(6d); _map.AddItem(mineral); }
public int GetValue(MineralType type) { return Minerals[type].Value; }
void mission7(MineralType mnrl) { if (mnrl != MineralType.Gold) return; collectGoldScore.Inc (1); if (collectGoldScore.HasTempReached (m7record)) { onMissionCompleted(7); CollectMinerals -= mission7; } }
public static decimal GetSuggestedValue(MineralType mineralType) { //TODO: Get these from some environment settings //NOTE: The commented values are what I got from websites ($15,000 per carat for diamond seems a bit steep though) //I was screwing around, and this gave a pretty nice curve: // =10 * ((5 + log10(value))^2) // // But I ended up rounding the numbers off to give a smoother curve switch (mineralType) { case MineralType.Ice: //return .0003m; return 25m; case MineralType.Iron: //return .0017m; return 50m; case MineralType.Graphite: //return .08m; return 150m; case MineralType.Gold: //return 49420m; return 400m; case MineralType.Platinum: //return 59840m; return 700m; case MineralType.Emerald: //return 1250000m; return 1000m; case MineralType.Saphire: //return 5000000m; return 1200m; case MineralType.Ruby: //return 12500000m; return 1500m; case MineralType.Diamond: //return 75000000m; return 2000m; case MineralType.Rixium: //return 300000000m; return 5000m; default: throw new ApplicationException("Unknown MineralType: " + mineralType.ToString()); } }
void mission9(MineralType mnrl) { mineralCollectScore.Inc (1); if (mineralCollectScore.HasTempReached (m9record)) { onMissionCompleted(9); CollectMinerals -= mission9; } }
public static Model3D GetNewVisual(MineralType mineralType, SharedVisuals sharedVisuals = null, double scale = 1d) { if (sharedVisuals == null) { sharedVisuals = _sharedVisuals.Value; } MineralStats stats = GetSettingsForMineralType(mineralType); Model3DGroup retVal = new Model3DGroup(); // Material MaterialGroup materials = new MaterialGroup(); if (stats.DiffuseColor.A > 0) { materials.Children.Add(new DiffuseMaterial(new SolidColorBrush(stats.DiffuseColor))); } if (stats.SpecularColor.A > 0) { materials.Children.Add(new SpecularMaterial(new SolidColorBrush(stats.SpecularColor), stats.SpecularPower)); } if (stats.EmissiveColor.A > 0) { materials.Children.Add(new EmissiveMaterial(new SolidColorBrush(stats.EmissiveColor))); } // Geometry Model GeometryModel3D geometry = new GeometryModel3D(); geometry.Material = materials; geometry.BackMaterial = materials; geometry.Geometry = sharedVisuals.GetMineralMesh(mineralType); retVal.Children.Add(geometry); if (mineralType == MineralType.Rixium) { #region Rixium Visuals // These need to be added after the main crystal, because they are semitransparent retVal.Children.Add(GetRixiumTorusVisual(new Vector3D(0, 0, -.6), .38, .5, sharedVisuals)); retVal.Children.Add(GetRixiumTorusVisual(new Vector3D(0, 0, -.3), .44, .75, sharedVisuals)); retVal.Children.Add(GetRixiumTorusVisual(new Vector3D(0, 0, 0), .5, 1, sharedVisuals)); retVal.Children.Add(GetRixiumTorusVisual(new Vector3D(0, 0, .3), .44, .75, sharedVisuals)); retVal.Children.Add(GetRixiumTorusVisual(new Vector3D(0, 0, .6), .38, .5, sharedVisuals)); //TODO: Look at the global lighting options PointLight pointLight = new PointLight(); pointLight.Color = Color.FromArgb(255, 54, 147, 168); pointLight.Range = 20; pointLight.LinearAttenuation = .33; retVal.Children.Add(pointLight); #endregion } geometry.Transform = new ScaleTransform3D(scale, scale, scale); return retVal; }
public static MineralStats GetSettingsForMineralType(MineralType mineralType) { //NOTE: The geometry is defined in SharedVisuals.GetMineralMesh() switch (mineralType) { case MineralType.Ice: #region Ice // Going for an ice cube :) return new MineralStats( Color.FromArgb(192, 201, 233, 242), // slightly bluish white Color.FromArgb(255, 203, 212, 214), 66d, Colors.Transparent, 934); #endregion case MineralType.Iron: #region Iron // This will be an iron bar (with rust) return new MineralStats( Color.FromArgb(255, 92, 78, 72), Color.FromArgb(255, 117, 63, 40), 50d, Colors.Transparent, 7900); #endregion case MineralType.Graphite: #region Graphite // A shiny lump of coal (but coal won't form in space, so I call it graphite) return new MineralStats( Color.FromArgb(255, 32, 32, 32), Color.FromArgb(255, 209, 209, 209), 75d, Colors.Transparent, 2267); #endregion case MineralType.Gold: #region Gold // A reflective gold bar return new MineralStats( Color.FromArgb(255, 255, 191, 0), Color.FromArgb(255, 212, 138, 0), 75d, Colors.Transparent, 19300); #endregion case MineralType.Platinum: #region Platinum // A reflective platinum bar/plate //TODO: Make this a flat plate return new MineralStats( Color.FromArgb(255, 166, 166, 166), Color.FromArgb(255, 125, 57, 45), 95d, Color.FromArgb(20, 214, 214, 214), 21450); #endregion case MineralType.Emerald: #region Emerald // A semi transparent double trapazoid return new MineralStats( UtilityWPF.ColorFromHex("D948A340"), //Color.FromArgb(192, 69, 128, 64); UtilityWPF.ColorFromHex("24731C"), //Color.FromArgb(255, 26, 82, 20); 100d, UtilityWPF.ColorFromHex("40499100"), //Color.FromArgb(64, 64, 128, 0); 2760); #endregion case MineralType.Saphire: #region Saphire // A jeweled oval return new MineralStats( Color.FromArgb(160, 39, 53, 102), Color.FromArgb(255, 123, 141, 201), 100d, Color.FromArgb(64, 17, 57, 189), 4000); #endregion case MineralType.Ruby: #region Ruby // A jeweled oval return new MineralStats( Color.FromArgb(180, 176, 0, 0), Color.FromArgb(255, 255, 133, 133), 100d, Color.FromArgb(32, 156, 53, 53), 4000); #endregion case MineralType.Diamond: #region Diamond // A jewel return new MineralStats( Color.FromArgb(128, 230, 230, 230), Color.FromArgb(255, 196, 196, 196), 100d, Color.FromArgb(32, 255, 255, 255), 3515); #endregion case MineralType.Rixium: #region Rixium // A petagon rod // There are also some toruses around it, but they are just visuals. This rod is the collision mesh return new MineralStats( Color.FromArgb(192, 92, 59, 112), //_specularColor = Color.FromArgb(255, 145, 63, 196); Color.FromArgb(255, 77, 127, 138), 100d, Color.FromArgb(64, 112, 94, 122), 66666); #endregion default: throw new ApplicationException("Unknown MineralType: " + mineralType.ToString()); } }
void mission8(MineralType mnrl) { if (mnrl != MineralType.Diamond) return; collectDiamondScore.Inc (1); if (collectDiamondScore.HasTempReached (m8record)) { onMissionCompleted(8); CollectMinerals -= mission8; } }
void mission6(MineralType mnrl) { if (mnrl != MineralType.Copper) return; collectCopperScore.Inc (1); if (collectCopperScore.HasTempReached (m6record)) { onMissionCompleted(6); CollectMinerals -= mission6; } }
/// <summary> /// This removes enough minerals to fulfill the requested volume. I may chop a larger mineral in two /// </summary> /// <param name="type">The type of mineral to remove</param> /// <param name="volume">How much to remove</param> /// <returns> /// Item1=Volume returned /// Item2=Cargo returned /// </returns> public Tuple<double, Cargo[]> RemoveMineral_Volume(MineralType type, double volume) { lock (_lock) { List<Tuple<int, Cargo>> allCandidates = new List<Tuple<int, Cargo>>(); for (int cntr = 0; cntr < _cargoBays.Length; cntr++) { // Get all the minerals of the requested type from this cargo bay Cargo[] candidates = _cargoBays[cntr].GetCargoSnapshot(). Where(o => o.Type == CargoType.Mineral && ((Cargo_Mineral)o).MineralType == type). ToArray(); if (candidates.Length > 0) { allCandidates.AddRange(candidates.Select(o => Tuple.Create(cntr, o))); } } // Remove as many as necessary (smallest first) var retVal = RemoveMineral_Continue_Volume(allCandidates.OrderBy(o => o.Item2.Volume).ToArray(), volume); // Fully remove any that are zero volume foreach (var cargo in allCandidates) { if (cargo.Item2.Volume.IsNearZero()) { _cargoBays[cargo.Item1].Remove(cargo.Item2.Token); } } return retVal; } }
/// <summary> /// This removes enough minerals to fulfill the requested volume. I may chop a larger mineral in two /// </summary> /// <param name="type">The type of mineral to remove</param> /// <param name="volume">How much to remove</param> /// <returns> /// Item1=Volume returned /// Item2=Cargo returned /// </returns> public Tuple<double, Cargo[]> RemoveMineral(MineralType type, double volume) { lock (_lock) { Cargo[] candidates = _cargo. Where(o => o.Type == CargoType.Mineral && ((Cargo_Mineral)o).MineralType == type). OrderBy(o => o.Volume). ToArray(); var retVal = RemoveMineral_Continue(candidates, volume); foreach (Cargo fullRemove in candidates.Where(o => o.Volume.IsNearZero())) { Remove_Continue(fullRemove.Token); } return retVal; } }
public Asteroid GenerateAsteroid(MineralType mineral, int size, int seed) { Random.seed = seed; int ran = Random.Range (0,variants-1); int mineralIndex = (mineral==MineralType.Blank?0:1); Asteroid clone = Instantiate (baseAsteroid, transform.position, baseAsteroid.transform.rotation) as Asteroid; clone.renderer.material.mainTexture = textureArray[Mathf.Clamp(size,0,sizes-1),mineralIndex,ran,0]; textureArray[Mathf.Clamp(size,0,sizes-1),mineralIndex,ran,0].Apply(); clone.renderer.material.SetColor ("_Color", baseColor*Random.Range (0.8f, 1.1f)); clone.renderer.material.SetColor ("_OffColor", Asteroid.MineralToColor(mineral)*Random.Range (0.9f, 1.0f)); clone.renderer.material.SetColor ("_SpecColor", Asteroid.MineralToColor(mineral)*Random.Range (1.1f, 1.3f)); clone.renderer.material.SetTexture ("_BumpMap", textureArray[Mathf.Clamp(size,0,sizes-1),mineralIndex,ran,1]); textureArray[Mathf.Clamp(size,0,sizes-1),mineralIndex,ran,1].Apply (); clone.sizeClass = size; clone.gen = this; clone.mineral = mineral; clone.transform.localScale = Vector3.one*2*Random.Range (0.8f, 1.2f)*(Mathf.Pow (2,size)); clone.rigidbody2D.mass = 2*Mathf.Pow (4,size); if (mineralIndex > 0) clone.tag = "valuable"; DeformMesh (clone.GetComponent<MeshFilter>().mesh, clone.GetComponent<PolygonCollider2D>(), (sizes-size+1), Random.Range (int.MinValue, int.MaxValue)); return clone; }
public bool AddMineral(MineralType mineralType) { bool added = false; //try to add in bag BagElement bgE; for (int i=4; i<16; i++) { bgE = bagL[i]; if(bgE.isLocked) break; if(bgE.count == 0 || (bgE.elementTypeIndex == (int)mineralType && bgE.count < 10) ){ bgE.count++; bgE.elementTypeIndex = (int)mineralType; added = true; break; } } if (added) { totalMineral++; SetScoreNCoin(Constants.MINERAL_PRICE[(int)mineralType],Constants.MINERAL_PRICE[(int)mineralType]); if(OnMineralAdded != null){ OnMineralAdded(); } } return added; }
public Mineral GenerateMineral(MineralType t) { Mineral clone = Instantiate(baseMineral, new Vector3(0,0,0), baseMineral.transform.rotation) as Mineral; DeformMesh(clone.GetComponent<MeshFilter>().mesh, clone.GetComponent<PolygonCollider2D>(), 4, Random.Range (int.MinValue, int.MaxValue)); clone.renderer.material.SetColor ("_OffColor", Asteroid.MineralToColor(t)); clone.renderer.material.SetColor ("_Color", Asteroid.MineralToColor(t)); return clone; }