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; }
void Awake() { points = transform.Require <HasPoints>(); }
public void ItHas____(float amount, string type) { it = transform.Require <HasPoints>(); it.Set(type, amount); }
public void ItHas__Unsavable__Points(float amount, string type) { it = it ?? transform.Require <HasPoints>(); it.Set(type, amount); it.SetSavable(type, false); }
void Awake() { module = transform.GetModuleRoot(); points = module.Require <HasPoints>(); }
void Awake() { points = transform.Require <HasPoints>(); thresholds.Sort((a, b) => a.threshold.CompareTo(b.threshold)); }
public void HeHas____Points(float amount, string type) { points = transform.Require <HasPoints>(); points.Set(type, amount); }