Exemplo n.º 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);
        }
    }
    void DealPoints(Transform collidedWith)
    {
        HasPoints points = collidedWith.Require <HasPoints>();

        if (points.Deal(source, amount))
        {
            if (afterDealing == AfterDealing.Deactivate)
            {
                gameObject.SetActive(false);
            }
            else if (afterDealing == AfterDealing.Destroy)
            {
                Destroy(gameObject);
            }
        }
    }
    public void AButtheadWith__HpIsNearby(float hp)
    {
        butthead = new GameObject();
        butthead.transform.Require <BoxCollider>().isTrigger = true;
        butthead.transform.Require <Rigidbody>().isKinematic = true;
        butthead.transform.position = transform.position + Vector3.left * 5;

        HasPoints buttheadPoints = butthead.transform.Require <HasPoints>();

        buttheadPoints.Set("hp", hp);

        ReceivesPointsFromSource modifier = butthead.transform.Require <ReceivesPointsFromSource>();

        modifier.type     = "hp";
        modifier.source   = "damage";
        modifier.modifier = -1;
    }
Exemplo n.º 5
0
 void Awake()
 {
     points = transform.Require <HasPoints>();
 }
Exemplo n.º 6
0
 public void ItHas____(float amount, string type)
 {
     it = transform.Require <HasPoints>();
     it.Set(type, amount);
 }
Exemplo n.º 7
0
 public void ItHas__Unsavable__Points(float amount, string type)
 {
     it = it ?? transform.Require <HasPoints>();
     it.Set(type, amount);
     it.SetSavable(type, false);
 }
Exemplo n.º 8
0
 void Awake()
 {
     module = transform.GetModuleRoot();
     points = module.Require <HasPoints>();
 }
 void Awake()
 {
     points = transform.Require <HasPoints>();
     thresholds.Sort((a, b) => a.threshold.CompareTo(b.threshold));
 }
Exemplo n.º 10
0
 public void HeHas____Points(float amount, string type)
 {
     points = transform.Require <HasPoints>();
     points.Set(type, amount);
 }