Example #1
0
    public string Interpolate(string source)
    {
        return(Regex.Replace(source, @"#{(\.|)(.+?)}", _ =>
        {
            string entryName = _.Groups[2].Value;
            if (_.Groups[1].Value == ".")
            {
                HasPoints points = transform.Require <HasPoints>();

                if (points.Has(entryName))
                {
                    return "" + (int)points.Get(entryName);
                }
                else
                {
                    return _.Value;
                }
            }
            else
            {
                if (Has(entryName))
                {
                    return Get(entryName);
                }
                else
                {
                    return _.Value;
                }
            }
        }));
    }
    void OnEnable()
    {
        HasPoints points = module.Require <HasPoints>();

        if (points.Has(type) && points.Get(type) >= threshold)
        {
            Spark(yes);
        }
        else
        {
            Spark(no);
        }
    }