本文整理汇总了C#中Health类的典型用法代码示例。如果您正苦于以下问题:C# Health类的具体用法?C# Health怎么用?C# Health使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Health类属于命名空间,在下文中一共展示了Health类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
myTransform = GetComponent<Transform>();
myRigidBody = GetComponent<Rigidbody>();
myHealth = GetComponent<Health>();
BloodParticle = GetComponentInChildren<ParticleSystem>();
}
示例2: Start
// Use this for initialization
void Start () {
if( GameObject.Find ("Player" + playerNumber.ToString ()) != null)
health = GameObject.Find ("Player" + playerNumber.ToString ()).GetComponent<Health>();
if (health == null) {
health = GameObject.Find ("DetachedTop" + playerNumber.ToString ()).GetComponent<Health>();
}
}
示例3: GetHealthComponent
void GetHealthComponent()
{
if (gameObject.tag == "Player"){
HealthRemainingText = GameObject.Find("CurrentHealth").GetComponent<Text>();
PlayerHealth = NetworkManager.MyPlayer.GetComponent<Health>();
}
}
示例4: Awake
void Awake()
{
rigidbody = GetComponent<Rigidbody2D>();
body = GetComponent<PolygonCollider2D>();
feet = GetComponent<CircleCollider2D>();
health = GetComponent<Health>();
standing = body.points;
crouched = new Vector2[standing.Length];
grounded = false;
onWall = false;
upSlope = false;
downSlope = false;
int min = 0;
for (int i = 0; i < standing.Length; i++)
{
if (standing[i].y < standing[min].y)
min = i;
}
for (int i = 0; i < standing.Length; i++)
{
float newY = (standing[i].y - standing[min].y) * 0.5f + standing[min].y;
crouched[i] = new Vector2(standing[i].x, newY);
}
}
示例5: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
scriptMove = player.GetComponent<CharacterMovement> ();
scriptHP = player.GetComponent<Health> ();
if (other.tag == "Hero"){
Destroy(gameObject);
float rekt = Random.value;
if (rekt <= 0.2) {
scriptMove.speed = 3f;
//textbox.text = "Faster Speed! :)";
} else if (rekt > 0.2 && rekt <= 0.3) {
scriptMove.speed = 1.5f;
//textbox.text = "Slower Speed! :(";
} else if (rekt > 0.3 && rekt <= 0.5) {
scriptHP.Heal (1);
//textbox.text = "+1 HP!! :D";
} else if (rekt > 0.5 && rekt <= 0.6) {
scriptHP.TakeDamage (1);
//textbox.text = "-1 HP!";
} else if (rekt > 0.6 && rekt <= 0.9) {
scriptArrow.arrowDamage = 2;
} else {
scriptMove.speed = 2.5f;
scriptArrow.arrowDamage = 1;
}
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
示例6: hurt
void hurt(Health otherHealth)
{
if (otherHealth && damageGroups.Contains(otherHealth.damageGroup))
{
if(damageCount == 0) {
otherHealth.hurt(damage);
}
else {
int hits = 0;
if (gameObjectHits.TryGetValue(otherHealth, out hits))
{
if (hits < damageCount)
{
gameObjectHits[otherHealth] = hits + 1;
otherHealth.hurt(damage);
}
}
else
{
gameObjectHits[otherHealth] = 1;
otherHealth.hurt(damage);
}
}
}
}
示例7: Start
// Use this for initialization
void Start()
{
_wheel = GetComponent<WheelCollider>();
//bikerhealth = transform.parent.Find( "bodyHealthTrigger" ).GetComponent<Health>();
bikerhealth = transform.parent.GetComponentInChildren<Health>();
bikerscore = transform.parent.GetComponent<Score>();
}
示例8: Start
// Use this for initialization
void Start () {
blackStyle.normal.textColor = Color.black;
rb2D = GetComponent<Rigidbody2D>();
labelRect = new Rect (0, 0, 100, 100);
offset = new Vector2 (-5, -5);
health = gameObject.GetComponent<Health> ();
}
示例9: Add
public ActionResult Add(Health.Areas.Prescription.Models.Prescription model)
{
PrescriptionContext pc = new PrescriptionContext();
HealthDB.Model.Prescription p = new HealthDB.Model.Prescription();
p.DoctorId = model.PrescribedByUserId;
p.Dosage = model.Strength;
p.DrugName = model.DrugName;
if (model.GroupName != null)
p.GroupName = model.GroupName;
p.Instruction = model.Direction;
p.Invoice = DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + "_" + model.PatientUserId + "_" + model.PrescribedByUserId;
p.PatientId = model.PatientUserId;
p.PharmacistId = model.PharmacistUserId;
p.PrescriptionTypeId = model.PrescriptionTypeId;
p.Quantity = model.Quantity;
p.PrescriptionStatusId = 1;
pc.Prescriptions.InsertOnSubmit(p);
IEnumerable<DrugName> DrugNames = from drugs in pc.DrugNames
where drugs.Name == model.DrugName
select drugs;
if (DrugNames == null)
{
DrugName dn = new DrugName();
dn.Name = model.DrugName;
pc.DrugNames.InsertOnSubmit(dn);
}
pc.SubmitChanges();
model = GetPrescription(model.PatientUserId, model.PrescribedByUserId, DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + "_" + model.PatientUserId + "_" + model.PrescribedByUserId, model);
return View(model);
}
示例10: GetMatchingDnsRecords
public DnsRecord[] GetMatchingDnsRecords(string domainName, Health.Direct.Common.DnsResolver.DnsStandard.RecordType typeID)
{
DnsRecord[] records = Store.DnsRecords.Get(domainName, typeID);
if (!records.IsNullOrEmpty())
{
return records;
}
// For NS and SOA records, check if we own the question domain.
if (typeID == DnsStandard.RecordType.SOA ||
typeID == DnsStandard.RecordType.NS)
{
string owningDomain = QuestionDomainToOwnedDomain(domainName);
if (owningDomain == null)
{
return null;
}
records = Store.DnsRecords.Get(owningDomain, typeID);
// apply the question's domain before returning the records.
foreach (DnsRecord record in records)
{
DnsResourceRecord newRecord = record.Deserialize();
newRecord.Name = domainName;
record.DomainName = domainName;
record.RecordData = newRecord.Serialize();
}
}
return records;
}
示例11: Awake
void Awake()
{
rb = GetComponent<Rigidbody2D> ();
rb.centerOfMass = new Vector2 (0, 0);
health = GetComponent<Health> ();
}
示例12: WithHealth
public CharacterBuilder WithHealth()
{
if (_stats == null)
throw new NullReferenceException("Stats cannot be null otherwise character cannot have health");
_health = new Health((int)_stats.HealthPoints).HealthGeneration();
return this;
}
示例13: Start
//more setup
void Start()
{
checkpoints = GameObject.FindGameObjectsWithTag("Respawn");
health = GameObject.FindGameObjectWithTag("Player").GetComponent<Health>();
if(!health)
Debug.LogError("For Checkpoint to work, the Player needs 'Health' script attached", transform);
}
示例14: Sell
public Sell(Actor self)
{
health = self.TraitOrDefault<Health>();
sellableInfo = self.Info.TraitInfo<SellableInfo>();
playerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
IsInterruptible = false;
}
示例15: OnEnable
private void OnEnable()
{
SO = new SerializedObject(target);
myHealth = (Health)target;
statusEffects = Enum.GetNames(typeof (HitInfo.Effects));
}