ToString() public static method

public static ToString ( String value ) : String
value String
return String
Beispiel #1
0
        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            Object res = new Object();

            String[] xpr = SysConvert.ToString(parameter).Split('|');

            switch (xpr[0])
            {
            case "+":
                res = SysConvert.ToDouble(value) + SysConvert.ToDouble(xpr[1]);
                break;

            case "-":
                res = SysConvert.ToDouble(value) - SysConvert.ToDouble(xpr[1]);
                break;

            case "*":
                res = SysConvert.ToDouble(value) * SysConvert.ToDouble(xpr[1]);
                break;

            case "/":
                res = SysConvert.ToDouble(value) / SysConvert.ToDouble(xpr[1]);
                break;
            }

            return(res);
        }
Beispiel #2
0
        public override InheritanceMappingAttribute[] GetInheritanceMapping(Type type, TypeExtension typeExtension)
        {
            var extList = typeExtension.Attributes["InheritanceMapping"];

            if (extList == AttributeExtensionCollection.Null)
            {
                return(Array <InheritanceMappingAttribute> .Empty);
            }

            var attrs = new InheritanceMappingAttribute[extList.Count];

            for (var i = 0; i < extList.Count; i++)
            {
                var ext = extList[i];

                attrs[i] = new InheritanceMappingAttribute
                {
                    Code      = ext["Code"],
                    IsDefault = TypeExtension.ToBoolean(ext["IsDefault", "False"], false),
                    Type      = Type.GetType(Convert.ToString(ext["Type"]))
                };
            }

            return(attrs);
        }
Beispiel #3
0
        private void LoadVariables()
        {
            Prefix        = Convert.ToString(GetConfig("Chat Settings", "Prefix", "[NightPVP] "));               // CHAT PLUGIN PREFIX
            PrefixColor   = Convert.ToString(GetConfig("Chat Settings", "PrefixColor", "#bf0000"));              // CHAT PLUGIN PREFIX COLOR
            ChatColor     = Convert.ToString(GetConfig("Chat Settings", "ChatColor", "#dd8e8e"));                // CHAT MESSAGE COLOR
            SteamIDIcon   = Convert.ToUInt64(GetConfig("Chat Settings", "SteamIDIcon", "76561198079320022"));    // SteamID FOR PLUGIN ICON - STEAM PROFILE CREATED FOR THIS PLUGIN / NONE YET /
            starthour     = Convert.ToSingle(GetConfig("Night Time Zone", "Start at", "21"));
            stophour      = Convert.ToSingle(GetConfig("Night Time Zone", "Stop at", "6"));
            leftmin       = Convert.ToDouble(GetConfig("HUD position", "left (0.95 by default)", "0.95"));
            bottom        = Convert.ToDouble(GetConfig("HUD position", "bottom (0.86 by default)", "0.86"));
            HUDtxtsize    = Convert.ToInt32(GetConfig("HUD text size", "(10 by default)", "10"));
            HUDwidth      = Convert.ToDouble(GetConfig("HUD size", "width (0.05 by default)", "0.05"));
            HUDheigth     = Convert.ToDouble(GetConfig("HUD size", "heigth (0.04 by default)", "0.04"));
            HUDpvecolor   = Convert.ToString(GetConfig("HUD color", "for PVE", "0.5 1.0 0.0"));              // CHAT MESSAGE COLOR
            HUDpveopacity = Convert.ToString(GetConfig("HUD opacity", "for PVE", "0.0"));                    // CHAT MESSAGE COLOR
            HUDpvpcolor   = Convert.ToString(GetConfig("HUD color", "for PVP", "0.85 0.2 0.5"));             // CHAT MESSAGE COLOR
            HUDpvpopacity = Convert.ToString(GetConfig("HUD opacity", "for PVP", "0.0"));                    // CHAT MESSAGE COLOR

            //rate = Convert.ToSingle(GetConfig("", "", "300"));

            if (!ConfigChanged)
            {
                return;
            }
            SaveConfig();
            ConfigChanged = false;
        }
Beispiel #4
0
 private void XUserDataBlockForm_Load(object sender, EventArgs e)
 {
     try
     {
         txtDeviceName.Text       = dv.DeviceName;
         gpDataBlock.Text         = ch.ChannelName;
         txtChannelId.Text        = ch.ChannelId.ToString();
         txtDeviceId.Text         = dv.DeviceId.ToString();
         txtOPCServerPath.Text    = ch.Mode;
         txtOPCServer.Text        = ch.CPU;
         txtOPCServerPath.Enabled = false;
         if (db == null)
         {
             Text = "Add DataBlock";
             txtDataBlockId.Text = Convert.ToString(dv.DataBlocks.Count + 1);
             txtDataBlock.Text   = "DataBlock" + Convert.ToString(dv.DataBlocks.Count + 1);
         }
         else
         {
             Text = "Edit DataBlock";
             txtChannelId.Text = db.ChannelId.ToString();
             txtDeviceId.Text  = db.DeviceId.ToString();
             txtDataBlock.Text = db.DataBlockName;
             //CboxTypeOfRead.Text = db.TypeOfRead;
             //txtOPCServerPath.Text = ch.Mode;
             //txtOPCServer.Text = ch.CPU;
             txtDataBlockId.Text = $"{db.DataBlockId}";
         }
     }
     catch (Exception ex)
     {
         EventscadaException?.Invoke(GetType().Name, ex.Message);
     }
 }
        /// <summary>
        /// Converts a value to a <see cref="string"/>.
        /// </summary>
        /// <param name="value">The object to convert.</param>
        /// <returns>The converted <paramref name="value"/>.</returns>
        public string ToString(object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            return(SConvert.ToString(value, CultureInfo.InvariantCulture));
        }
        private string GetStringValue(object value)
        {
            var tmp = value is string?value as string : SysConvert.ToString(value, CultureInfo.InvariantCulture);

            // Correct for differences between C booleans and C# booleans
            tmp = tmp == "True" ? "true" : tmp;
            tmp = tmp == "False" ? "false" : tmp;
            return(tmp);
        }
Beispiel #7
0
        private void _SetObjectSetting(IntPtr settings, string name, object value)
        {
            var tmp = value is string?value as string : SysConvert.ToString(value, CultureInfo.InvariantCulture);

            if (!wkhtmltopdf_set_object_setting(settings, name, tmp))
            {
                var msg = string.Format("Set ObjectSetting '{0}' as '{1}': operation failed!", name, tmp);
                throw new ApplicationException(msg);
            }
        }
Beispiel #8
0
        public static string GetBlogPagination(BlogSettings settingsItem, int currentPage, int totalRows, int maximumRows)
        {
            StringBuilder pagination = new StringBuilder();

            double decMaxPages = Convert.ToDouble(totalRows) / Convert.ToDouble(maximumRows);
            int    maxPages    = Convert.ToInt32(Math.Ceiling(decMaxPages));

            if (maxPages > 1)
            {
                if (currentPage > maxPages)
                {
                    // outside our range, make first page
                    currentPage = 1;
                }

                if (currentPage != 1)
                {
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, "1", settingsItem.FirstPageText));
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(currentPage - 1), settingsItem.PreviousPageText));
                }

                if (currentPage - 2 > 0)
                {
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(currentPage - 2), Convert.ToString(currentPage - 2)));
                }

                if (currentPage - 1 > 0)
                {
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(currentPage - 1), Convert.ToString(currentPage - 1)));
                }

                pagination.Append(String.Format("{0} ", Convert.ToString(currentPage)));

                if (currentPage + 1 <= maxPages)
                {
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(currentPage + 1), Convert.ToString(currentPage + 1)));
                }

                if (currentPage + 2 <= maxPages)
                {
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(currentPage + 2), Convert.ToString(currentPage + 2)));
                }

                if (currentPage + 1 <= maxPages)
                {
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(currentPage + 1), settingsItem.NextPageText));
                    pagination.Append(String.Format("<a href=\"?{0}={1}\">{2}</a> ", XBSettings.XBPageQS, Convert.ToString(maxPages), settingsItem.LastPageText));
                }
            }



            return(pagination.ToString());
        }
        private void LoadVariables()
        {
            SteamIDIcon = Convert.ToUInt64(GetConfig("Chat Settings", "SteamIDIcon", "76561198357983957"));        // SteamID FOR PLUGIN ICON - STEAM PROFILE CREATED FOR THIS PLUGIN / NONE YET /
            Prefix      = Convert.ToString(GetConfig("Chat Settings", "Plugin Prefix", "[MBC] "));
            flamingtime = Convert.ToSingle(GetConfig("Flames Settings", "Duration in seconds", "30"));
            cakename    = Convert.ToString(GetConfig("Cake Settings", "Name", "Birthday SPECIAL EDITION"));

            if (!ConfigChanged)
            {
                return;
            }
            SaveConfig();
            ConfigChanged = false;
        }
Beispiel #10
0
        private void LoadVariables()
        {
            allowWhenBlocked = Convert.ToBoolean(GetConfig("Global", "Allow spawn when building blocked", false));
            Prefix           = Convert.ToString(GetConfig("Chat Settings", "Prefix", "[My MiniCopter] :")); // Chat prefix
            cooldownmin      = Convert.ToSingle(GetConfig("Cooldown (on permission)", "Value in minutes", "60"));
            useCooldown      = Convert.ToBoolean(GetConfig("Cooldown (on permission)", "Use Cooldown", true));

            if (!ConfigChanged)
            {
                return;
            }
            SaveConfig();
            ConfigChanged = false;
        }
        private void LoadVariables()
        {
            Prefix         = Convert.ToString(GetConfig("Chat Settings", "Prefix", "[CANNIBAL] "));                                                              // CHAT PLUGIN PREFIX
            PrefixColor    = Convert.ToString(GetConfig("Chat Settings", "PrefixColor", "#bf0000"));                                                             // CHAT PLUGIN PREFIX COLOR
            ChatColor      = Convert.ToString(GetConfig("Chat Settings", "ChatColor", "#dd8e8e"));                                                               // CHAT MESSAGE COLOR
            SteamIDIcon    = Convert.ToUInt64(GetConfig("Chat Settings", "SteamIDIcon", 76561198261703362));                                                     // SteamID FOR PLUGIN ICON - STEAM PROFILE CREATED FOR THIS PLUGIN / 76561198842176097 /
            experiencetime = Convert.ToInt32(GetConfig("Minimum time to play as cannibal, before being able to toggle it off", "in real time minutes", "1440")); // WINNER NAME COLOR

            if (!ConfigChanged)
            {
                return;
            }
            SaveConfig();
            ConfigChanged = false;
        }
Beispiel #12
0
        protected void RadGridExpenseDetail_OnBatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            foreach (var command in e.Commands)
            {
                if (command.Type.ToString() != "Cancel")
                {
                    command.NewValues["ExpenseId"]     = Convert.ToInt32(ViewState["NewIndex"]);
                    command.NewValues["Date"]          = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Date"]))) ? new DateTime(9999, 12, 31) : command.NewValues["Date"];
                    command.NewValues["Office"]        = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Office"]))) ? 0 : Convert.ToDecimal(command.NewValues["Office"]);
                    command.NewValues["Lodging"]       = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Lodging"]))) ? 0 : Convert.ToDecimal(command.NewValues["Lodging"]);
                    command.NewValues["Ground"]        = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Ground"]))) ? 0 : Convert.ToDecimal(command.NewValues["Ground"]);
                    command.NewValues["Meals"]         = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Meals"]))) ? 0 : Convert.ToDecimal(command.NewValues["Meals"]);
                    command.NewValues["Advertising"]   = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Advertising"]))) ? 0 : Convert.ToDecimal(command.NewValues["Advertising"]);
                    command.NewValues["Mail"]          = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Mail"]))) ? 0 : Convert.ToDecimal(command.NewValues["Mail"]);
                    command.NewValues["Telephone"]     = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Telephone"]))) ? 0 : Convert.ToDecimal(command.NewValues["Telephone"]);
                    command.NewValues["Km"]            = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Km"]))) ? 0 : Convert.ToDecimal(command.NewValues["Km"]);
                    command.NewValues["Kilometrage"]   = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Kilometrage"]))) ? 0 : Convert.ToDecimal(command.NewValues["Kilometrage"]);
                    command.NewValues["Miscellaneous"] = (string.IsNullOrEmpty(Convert.ToString(command.NewValues["Miscellaneous"]))) ? 0 : Convert.ToDecimal(command.NewValues["Miscellaneous"]);

                    command.NewValues["CreatedId"]   = CurrentUserId;
                    command.NewValues["CreatedDate"] = DateTime.Now;
                }
            }
        }
Beispiel #13
0
        //private static string ReducePrecision(string s, int precision = 2)
        //{
        //    string old = s;
        //    if (old.Length == 0 || old.Length < precision)
        //    {
        //        return old;
        //    }

        //    int begin = 0;
        //    int end   = 0;

        //    while (true)
        //    {
        //        begin = old.IndexOf('.', begin);
        //        if (begin == -1) break;

        //        // get past the period
        //        begin++;

        //        for (int i = 0; i < precision; i++)
        //        {
        //            if (old[begin] >= '0' && old[begin] <= '9')
        //                begin++;
        //            if (begin >= old.Length)
        //                break;
        //        }
        //        if (begin >= old.Length)
        //            break;

        //        end = begin;

        //        while (end < old.Length && old[end] >= '0' && old[end] <= '9') end++;

        //        old = old.Substring(0, begin) + old.Substring(end, old.Length - end);

        //        begin++;
        //        if (begin >= old.Length)
        //            break;
        //    }
        //    return old;
        //}

        private void WriteObject(object key, object obj, XmlWriter writer, bool isRoot)
        {
            List <MarkupProperty> propertyElements = new List <MarkupProperty>();
            MarkupProperty        contentProperty  = null;
            string       contentPropertyName       = null;
            MarkupObject markupObj  = MarkupWriter.GetMarkupObjectFor(obj);
            Type         objectType = markupObj.ObjectType;

            string ns     = _namespaceCache.GetNamespaceUriFor(objectType);
            string prefix = _namespaceCache.GetDefaultPrefixFor(ns);

            if (isRoot)
            {
                if (string.IsNullOrWhiteSpace(prefix))
                {
                    if (string.IsNullOrWhiteSpace(ns))
                    {
                        writer.WriteStartElement(markupObj.ObjectType.Name, NamespaceCache.DefaultNamespace);
                        writer.WriteAttributeString("xmlns", NamespaceCache.XmlnsNamespace, NamespaceCache.DefaultNamespace);
                    }
                    else
                    {
                        writer.WriteStartElement(markupObj.ObjectType.Name, ns);
                        writer.WriteAttributeString("xmlns", NamespaceCache.XmlnsNamespace, ns);
                    }
                }
                else
                {
                    writer.WriteStartElement(prefix, markupObj.ObjectType.Name, ns);
                }
                writer.WriteAttributeString("xmlns", "x", NamespaceCache.XmlnsNamespace, NamespaceCache.XamlNamespace);

                foreach (NamespaceMap map in _dicNamespaceMap.Values)
                {
                    if (!string.IsNullOrWhiteSpace(map.Prefix) && !string.Equals(map.Prefix, "x"))
                    {
                        writer.WriteAttributeString("xmlns", map.Prefix, NamespaceCache.XmlnsNamespace, map.XmlNamespace);
                    }
                }
            }
            else
            {
                //TODO: Fix - the best way to handle this case...
                if (markupObj.ObjectType.Name == "PathFigureCollection" && markupObj.Instance != null)
                {
                    WriteState writeState = writer.WriteState;

                    if (writeState == WriteState.Element)
                    {
                        //writer.WriteAttributeString("Figures",
                        //    markupObj.Instance.ToString());
                        writer.WriteAttributeString("Figures", StringConvert.ToString(markupObj.Instance, _culture));
//                        writer.WriteAttributeString("Figures", ReducePrecision(StringConvert.ToString(markupObj.Instance, _culture)));
                    }
                    else
                    {
                        if (string.IsNullOrWhiteSpace(prefix))
                        {
                            writer.WriteStartElement("PathGeometry.Figures");
                        }
                        else
                        {
                            writer.WriteStartElement("PathGeometry.Figures", ns);
                        }
                        //writer.WriteString(markupObj.Instance.ToString());
                        writer.WriteString(StringConvert.ToString(markupObj.Instance, _culture));
                        writer.WriteEndElement();
                    }
                    return;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(prefix))
                    {
                        writer.WriteStartElement(markupObj.ObjectType.Name);
                    }
                    else
                    {
                        writer.WriteStartElement(markupObj.ObjectType.Name, ns);
                    }
                }
            }

            // Add the x:Name for object like Geometry/Drawing not derived from FrameworkElement...
            DependencyObject dep = obj as DependencyObject;

            if (dep != null)
            {
                string nameValue = dep.GetValue(FrameworkElement.NameProperty) as string;
                if (!string.IsNullOrWhiteSpace(nameValue) && !(dep is FrameworkElement))
                {
                    writer.WriteAttributeString("x", "Name", NamespaceCache.XamlNamespace, nameValue);
                }
            }

            if (key != null)
            {
                string keyString = key.ToString();
                if (keyString.Length > 0)
                {
                    writer.WriteAttributeString("x", "Key", NamespaceCache.XamlNamespace, keyString);
                }
                else
                {
                    //TODO: key may not be a string, what about x:Type...
                    throw new NotImplementedException(
                              "Sample XamlWriter cannot yet handle keys that aren't strings");
                }
            }

            //Look for CPA info in our cache that keeps contentProperty names per Type
            //If it doesn't have an entry, go get the info and store it.
            if (!_contentProperties.ContainsKey(objectType))
            {
                string lookedUpContentProperty = string.Empty;
                foreach (Attribute attr in markupObj.Attributes)
                {
                    ContentPropertyAttribute cpa = attr as ContentPropertyAttribute;
                    if (cpa != null)
                    {
                        lookedUpContentProperty = cpa.Name;
                        //Once content property is found, come out of the loop.
                        break;
                    }
                }

                _contentProperties.Add(objectType, lookedUpContentProperty);
            }

            contentPropertyName = _contentProperties[objectType];
            string contentString = string.Empty;

            foreach (MarkupProperty markupProperty in markupObj.Properties)
            {
                if (markupProperty.Name != contentPropertyName)
                {
                    if (markupProperty.IsValueAsString)
                    {
                        contentString = markupProperty.Value as string;
                    }
                    else if (markupProperty.Value == null)
                    {
                        if (_nullExtension)
                        {
                            writer.WriteAttributeString(markupProperty.Name, "{x:Null}");
                        }
                    }
                    else if (!markupProperty.IsComposite)
                    {
                        string temp = markupProperty.StringValue;

                        if (markupProperty.IsAttached)
                        {
                            string ns1     = _namespaceCache.GetNamespaceUriFor(markupProperty.DependencyProperty.OwnerType);
                            string prefix1 = _namespaceCache.GetDefaultPrefixFor(ns1);

                            if (temp.IndexOfAny("{}".ToCharArray()) >= 0)
                            {
                                temp = "{}" + temp;
                            }
                            if (string.IsNullOrWhiteSpace(prefix1))
                            {
                                writer.WriteAttributeString(markupProperty.Name, temp);
                            }
                            else
                            {
                                writer.WriteAttributeString(markupProperty.Name, ns1, temp);
                            }
                        }
                        else
                        {
                            if (markupProperty.Name == "FontUri" &&
                                (_wpfSettings != null && _wpfSettings.IncludeRuntime))
                            {
                                string fontUri = temp.ToLower();
                                fontUri = fontUri.Replace(_windowsDir, _windowsPath);

                                StringBuilder builder = new StringBuilder();
                                builder.Append("{");
                                builder.Append("svg");
                                builder.Append(":");
                                builder.Append("SvgFontUri ");
                                builder.Append(fontUri.Replace('\\', '/'));
                                builder.Append("}");

                                writer.WriteAttributeString(markupProperty.Name, builder.ToString());
                            }
                            else
                            {
                                if (temp.IndexOfAny("{}".ToCharArray()) >= 0)
                                {
                                    temp = "{}" + temp;
                                }
                                writer.WriteAttributeString(markupProperty.Name, temp);
                            }
                        }
                    }
                    else if (markupProperty.Value.GetType() == _nullType)
                    {
                        if (_nullExtension)
                        {
                            writer.WriteAttributeString(markupProperty.Name, "{x:Null}");
                        }
                    }
                    else
                    {
                        propertyElements.Add(markupProperty);
                    }
                }
                else
                {
                    contentProperty = markupProperty;
                }
            }

            if (contentProperty != null || propertyElements.Count > 0 || contentString != string.Empty)
            {
                foreach (MarkupProperty markupProp in propertyElements)
                {
                    string ns2     = _namespaceCache.GetNamespaceUriFor(markupObj.ObjectType);
                    string prefix2 = null;
                    if (!string.IsNullOrWhiteSpace(ns2))
                    {
                        prefix2 = _namespaceCache.GetDefaultPrefixFor(ns2);
                    }

                    string propElementName = markupObj.ObjectType.Name + "." + markupProp.Name;
                    if (string.IsNullOrWhiteSpace(prefix2))
                    {
                        writer.WriteStartElement(propElementName);
                    }
                    else
                    {
                        writer.WriteStartElement(prefix2, propElementName, ns2);
                    }

                    WriteChildren(writer, markupProp);
                    writer.WriteEndElement();
                }

                if (contentString != string.Empty)
                {
                    writer.WriteValue(contentString);
                }
                else if (contentProperty != null)
                {
                    if (contentProperty.Value is string)
                    {
                        writer.WriteValue(contentProperty.StringValue);
                    }
                    else
                    {
                        WriteChildren(writer, contentProperty);
                    }
                }
            }
            writer.WriteEndElement();
        }
Beispiel #14
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Age = Age + Time.deltaTime;
        Test   transformvalue = gameObject.GetComponent <Test>();
        int    temp           = (int)testc.Truncate(transformvalue.xmag * 100);
        string x = Conva.ToString(temp, 2);

        temp = (int)testc.Truncate(transformvalue.ymag * 100);
        string y = Conva.ToString(temp, 2);

        temp = (int)testc.Truncate(transform.localScale.x * 100);
        string size = Conva.ToString(temp, 2);

        temp = (int)testc.Truncate(metabolism * 100);
        string meta = Conva.ToString(temp, 2);
        //Acondicionamiento
        var xlen = x.Length;

        if (xlen < 10)
        {
            for (int i = xlen; i < 10; i++)
            {
                x = "0" + x;
            }
        }
        var ylen = y.Length;

        if (ylen < 10)
        {
            for (int i = ylen; i < 10; i++)
            {
                y = "0" + y;
            }
        }
        var metalen = meta.Length;

        if (metalen < 10)
        {
            for (int i = metalen; i < 10; i++)
            {
                meta = "0" + meta;
            }
        }
        var sizelen = size.Length;

        if (sizelen < 10)
        {
            for (int i = sizelen; i < 10; i++)
            {
                size = "0" + size;
            }
        }
        geneticcode = x + y + size + meta;

        if (!sik)
        {
            gen = geneticcode;
            sik = true;
        }

        Debug.Log("PREY: Life: " + totallife + ", Age: " + Age + ", Max Age: " + maxage + ", Metabolism: " + metabolism + ", GenCode: " + gen);
        if (Time.time > nexactiontime)
        {
            nexactiontime += metabolism;
            totallife      = totallife - 1;
            if (totallife <= 0)
            {
                Destroy(this.gameObject);
            }
            if (Age >= maxage)
            {
                Destroy(this.gameObject);
            }
        }
    }
Beispiel #15
0
 public string ToString(object value)
     => SystemConvert.ToString(value);
Beispiel #16
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
 SysConvert.ToString(value, culture);