Exemplo n.º 1
0
    /// <summary>
    /// Disassembles the given <paramref name="chemical"/> into its sub parts.
    /// </summary>
    /// <param name="chemical">Chemical to disassemble.</param>
    public IEnumerable <IChemical> Disassemble(IChemical chemical)
    {
        if (chemical == null)
        {
            throw new ArgumentNullException(nameof(chemical));
        }
        else if (!ActiveChemicals.Contains(chemical))
        {
            throw new ArgumentException(nameof(chemical));
        }
        else
        {
            var newElements = chemical.Disassemble();
            if (newElements.Count() > 0)
            {
                // remove old element
                _activeChemicals.Remove(chemical);

                // add new elements
                foreach (var e in newElements)
                {
                    AddElement(e);
                }
            }

            return(newElements);
        }
    }
Exemplo n.º 2
0
        // SolventMix is a mix of Weed-leaves and chemical(s).
        public SolventMix(IChronic chronic, IChemical chemical) : base(chronic.Name + " " + chemical.Name, chronic.Description + " " + chemical.Description, chronic.Weight + chemical.Weight, chronic.Value)
        {
            Type = ItemType.SolventMix;

            _extractedOils = new Random().NextDouble() * (0.85 - 0.75) + 0.75;
            Chronic        = chronic;
            Chemical       = chemical;
            Solvent        = new Solvent(Chronic, Chemical);
        }
Exemplo n.º 3
0
        // SolventMix is a mix of Weed-leaves and chemical(s).
        public SolventMix(IChronic chronic, IChemical chemical)
            : base(chronic.Name + " " + chemical.Name, chronic.Description + " " + chemical.Description, chronic.Weight + chemical.Weight, chronic.Value)
        {
            Type = ItemType.SolventMix;

            _extractedOils = new Random().NextDouble() * (0.85 - 0.75) + 0.75;
            Chronic = chronic;
            Chemical = chemical;
            Solvent = new Solvent(Chronic, Chemical);
        }
Exemplo n.º 4
0
 // Solvent is a mix of THC (from Chronic) and Chemicals
 public Solvent(IChronic chronic, IChemical chemical)
 {
     Contents    = chemical.Contents;
     Age         = 0;
     THC         = 0;
     CBD         = 0;
     Yield       = 0;
     Quality     = chronic.Quality;
     Name        = chronic.Name + chemical.Name;
     Description = chemical.Description;
 }
Exemplo n.º 5
0
    /// <summary>
    /// Adds (and unlocks) the given <paramref name="chemical"/>.
    /// </summary>
    /// <param name="chemical">Chemical to add.</param>
    private void AddElement(IChemical chemical)
    {
        if (chemical == null)
        {
            throw new ArgumentNullException(nameof(chemical));
        }

        _activeChemicals.Add(chemical);
        if (!UnlockedChemicals.Contains(chemical.Name))
        {
            _unlockedChemicals.Add(chemical.Name);
        }
    }
Exemplo n.º 6
0
        public Material(float noise)
        {
            Noise = noise;
            AcousticProperties       = new Acoustic();
            AtomicProperties         = new Atomic();
            ChemicalProperties       = new Chemical();
            ElectricalProperties     = new Electrical();
            EnvironmentalProperties  = new Environmental();
            MagneticProperties       = new Magnetic();
            ManufacturingProperties  = new Manufacturing();
            MechanicalProperties     = new Mechanical();
            OpticalProperties        = new Optical();
            RadiologicalProperties   = new Radiological();
            ThermoDynamicsProperties = new ThermoDynamics();

            float input_start  = -1;
            float input_end    = 1;
            float output_start = 0;
            float output_end   = 256 * 256 * 256;

            double output;

            double slope = 1.0 * (output_end - output_start) / (input_end - input_start);

            output = output_start + slope * (Noise - input_start);

            float Positive = Noise.Spread(-1, 1, 0, 1);

            float r = Voxel.GetRed(Positive);
            float g = Voxel.GetGreen(Positive);
            float b = Voxel.GetBlue(Positive);
            float a = Voxel.GetAlpha(Noise);

            PhysicalMaterial = new PhongMaterial
            {
                DiffuseColor = new Color4(r, g, b, a)
            };
        }
Exemplo n.º 7
0
 public NotEnoughSolventException(IChemical chemical) : base(chemical.ToString())
 {
 }
Exemplo n.º 8
0
 public NotEnoughSolventException(IChemical chemical)
     : base(chemical.ToString())
 {
 }
Exemplo n.º 9
0
 /// <summary>
 /// Combines the given <paramref name="chemical1"/> with <paramref name="chemical2"/>.
 /// </summary>
 /// <param name="chemical1">Chemical to combine with <paramref name="chemical2"/>.</param>
 /// <param name="chemical2">Chemical to combine with <paramref name="chemical1"/>.</param>
 public IEnumerable <IChemical> Combine(IChemical chemical1, IChemical chemical2)
 {
     return(Combine(new[] { chemical1, chemical2 }));
 }
Exemplo n.º 10
0
    private void InstantiateChemical(IChemical chemical, Vector2 position)
    {
        var obj = Instantiate(Resources.Load <GameObject>("Prefabs/Chemical"), position, Quaternion.identity);

        obj.GetComponent <ChemicalBehaviour>().Chemical = chemical;
    }