Example #1
0
    void GrowPrimaryProducer()
    {
        terrainData[4] = "false";
        hasSeed        = false;
        if (currentType == Type.Solid && hasNest != true)
        {
            switch (ProducerType)
            {
            case 1:
                PlaceModel(.5f, raspBush, 0);
                terrainData[3] = "Raspberry Bush";
                hasTree        = true;
                break;

            case 2:
                PlaceModel(1, appTree, 0);
                terrainData[3] = "Apple Tree";
                hasTree        = true;
                break;

            default:
                PlaceModel(.65f, flower, 0);
                terrainData[3] = "Flower";
                break;
            }
            abundanceLevel = Abundance.Barron;
            setSurfaceTexture();
        }
    }
Example #2
0
        /// <summary>Provide isotope contents in JSON form.</summary>
        /// <param name="quote">Name delimiter, or empty string for no delimiter.</param>
        /// <returns>A string defining a JSON object.</returns>
        /// <remarks>
        /// Pass an empty string for JavaScript results
        /// or pass a string containing a quote character for JSON results.
        /// </remarks>
        public string ToJsonString(string quote)
        {
            var sb = new StringBuilder();

            sb.Append('{');
            sb.Append($"{quote}z{quote}:");
            sb.Append(Z);
            sb.Append($",{quote}a{quote}:");
            sb.Append(A);
            sb.Append($",{quote}abundance{quote}:");
            sb.Append(IsNatural ? Abundance.ToString() : "null");
            sb.Append($",{quote}occurrenceIndex{quote}:");
            sb.Append(OccurrenceIndex);
            if (DecayMode != 0)
            {
                sb.Append($",{quote}stabilityIndex{quote}:");
                sb.Append(StabilityIndex);
                sb.Append($",{quote}decayFlags{quote}:");
                sb.Append((int)DecayMode);
                sb.Append($",{quote}halflife{quote}:");
                sb.Append(Halflife);
                sb.Append($",{quote}timeUnit{quote}:\"{TimeUnit}\"");
            }
            sb.Append('}');
            return(sb.ToString());
        }
 void Start()
 {
     if (isTree == true)
     {
         maxFruit = 5;
     }
     abundanceLevel      = Abundance.Young;
     sol                 = FindObjectOfType <SunControls>();
     sol.Photosynthesis += UpdateAbundance;
 }
Example #4
0
        /// <summary>
        /// Generates a hash code.
        /// </summary>
        /// <returns>Hash code based on stored data.</returns>
        public override int GetHashCode()
        {
            var hashCode =
                Abundance.GetHashCode() ^
                ChargeState.GetHashCode() ^
                DriftTime.GetHashCode() ^
                Id.GetHashCode() ^
                Net.GetHashCode();

            return(hashCode);
        }
Example #5
0
    /*
    ////////////////////
    Initilization
    ////////////////////
    */

    void Start () {
        mainMap = GetComponentInParent<MapGenerator>();
        sol = FindObjectOfType<SunControls>();
        if (isWater == true){
            currentType = Type.Liquid;
            abundanceLevel = Abundance.Barron;
            InstanceType();
        }
        else {
            currentType = Type.Solid;
            abundanceLevel = Abundance.Empty;
            if (sol != null) { sol.Photosynthesis += UpdateAbundance; }
            InstanceType();
            setSurfaceTexture();
        }
        
    }
Example #6
0
        /// <summary>
        /// Compares two objects' values.
        /// </summary>
        /// <param name="obj">Other to compare with.</param>
        /// <returns>True if values are the same, false if not.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            var other = obj as FeatureLight;

            if (other == null)
            {
                return(false);
            }

            if (!Id.Equals(other.Id))
            {
                return(false);
            }
            if (!Abundance.Equals(other.Abundance))
            {
                return(false);
            }
            if (!ChargeState.Equals(other.ChargeState))
            {
                return(false);
            }
            if (!DriftTime.Equals(other.DriftTime))
            {
                return(false);
            }
            if (!MassMonoisotopic.Equals(other.MassMonoisotopic))
            {
                return(false);
            }
            if (!Net.Equals(other.Net))
            {
                return(false);
            }
            return(true);
        }
Example #7
0
    /*
     * ////////////////////
     * Initilization
     * ////////////////////
     */

    void Start()
    {
        mainMap = GetComponentInParent <MapGenerator>();
        sol     = FindObjectOfType <SunControls>();
        if (isWater == true)
        {
            currentType    = Type.Liquid;
            abundanceLevel = Abundance.Barron;
            InstanceType();
        }
        else
        {
            currentType    = Type.Solid;
            abundanceLevel = Abundance.Empty;
            if (sol != null)
            {
                sol.Photosynthesis += UpdateAbundance;
            }
            InstanceType();
            setSurfaceTexture();
        }
    }
 void Start () {
     if (isTree == true) { maxFruit = 5; }
     abundanceLevel = Abundance.Young;
     sol = FindObjectOfType<SunControls>();
     sol.Photosynthesis += UpdateAbundance;
 }
Example #9
0
 void GrowPrimaryProducer()
 {
     terrainData[4] = "false";
     hasSeed = false;
     if (currentType == Type.Solid && hasNest != true) {
         switch (ProducerType)
         {
             case 1:
                 PlaceModel(.5f, raspBush, 0);
                 terrainData[3] = "Raspberry Bush";
                 hasTree = true;
                 break;
             case 2:
                 PlaceModel(1, appTree, 0);
                 terrainData[3] = "Apple Tree";
                 hasTree = true;
                 break;
             default:
                 PlaceModel(.65f, flower, 0);
                 terrainData[3] = "Flower";
                 break;
         }
         abundanceLevel = Abundance.Barron;
         setSurfaceTexture();
     }
 }