• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Health类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Health的典型用法代码示例。如果您正苦于以下问题:C# Health类的具体用法?C# Health怎么用?C# Health使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Health类属于命名空间,在下文中一共展示了Health类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Awake

 void Awake()
 {
     myTransform = GetComponent<Transform>();
     myRigidBody = GetComponent<Rigidbody>();
     myHealth = GetComponent<Health>();
     BloodParticle = GetComponentInChildren<ParticleSystem>();
 }
开发者ID:Xellss,项目名称:StrangeRituals,代码行数:7,代码来源:EnemyController.cs


示例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>();
		}
	}
开发者ID:yhchun1992,项目名称:PixelJam2014,代码行数:8,代码来源:GUIIndividualHealth.cs


示例3: GetHealthComponent

 void GetHealthComponent()
 {
     if (gameObject.tag == "Player"){
         HealthRemainingText = GameObject.Find("CurrentHealth").GetComponent<Text>();
         PlayerHealth = NetworkManager.MyPlayer.GetComponent<Health>();
     }
 }
开发者ID:sharkbound,项目名称:Unity-Projects,代码行数:7,代码来源:Health.cs


示例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);
        }
    }
开发者ID:pueblak,项目名称:ProjectDarkZone,代码行数:25,代码来源:PlayerController.cs


示例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);
		}
	}
开发者ID:Super-Goat-Herders,项目名称:ProjectGoat,代码行数:28,代码来源:Pickup.cs


示例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);
             }
         }
     }
 }
开发者ID:elliothatch,项目名称:the-old-cold,代码行数:25,代码来源:DamageOnTouch.cs


示例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>();
 }
开发者ID:alect,项目名称:ECGBike,代码行数:8,代码来源:WheelController.cs


示例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> ();
	}
开发者ID:DreamSea,项目名称:GuiShips,代码行数:8,代码来源:EnemyLabel.cs


示例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);
        }
开发者ID:fonnylasmana,项目名称:Health,代码行数:33,代码来源:PrescriptionController.cs


示例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;
        }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:35,代码来源:RecordRetrievalService.svc.cs


示例11: Awake

    void Awake()
    {
        rb = GetComponent<Rigidbody2D> ();
        rb.centerOfMass = new Vector2 (0, 0);

        health = GetComponent<Health> ();
    }
开发者ID:tvance989,项目名称:wizard-game,代码行数:7,代码来源:PlayerController.cs


示例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;
 }
开发者ID:Kavignon,项目名称:Augmented_Tactics,代码行数:7,代码来源:CharacterBuilder.cs


示例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);
	}
开发者ID:ianburnette,项目名称:MarshBirds,代码行数:8,代码来源:Checkpoint.cs


示例14: Sell

 public Sell(Actor self)
 {
     health = self.TraitOrDefault<Health>();
     sellableInfo = self.Info.TraitInfo<SellableInfo>();
     playerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
     IsInterruptible = false;
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:7,代码来源:Sell.cs


示例15: OnEnable

    private void OnEnable()
    {
        SO = new SerializedObject(target);
        myHealth = (Health)target;

        statusEffects = Enum.GetNames(typeof (HitInfo.Effects));
    }
开发者ID:syeager,项目名称:Knighthood,代码行数:7,代码来源:HealthEditor.cs


示例16: Bullet

 public Bullet(Vec2 pos, Vec2 p2)
 {
     Health = new Health(0.5);
     Position = pos;
     this.p2 = p2;
     Velocity = Direction * Speed;
 }
开发者ID:kuviman,项目名称:SMA2,代码行数:7,代码来源:Bullet.cs


示例17: Repair

 public Repair(Actor self, Actor host, WDist closeEnough)
 {
     this.host = Target.FromActor(host);
     this.closeEnough = closeEnough;
     repairsUnits = host.Info.TraitInfo<RepairsUnitsInfo>();
     health = self.TraitOrDefault<Health>();
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:7,代码来源:Repair.cs


示例18: Start

	void Start () {
		anim = GetComponent<Animator> ();
		moveAllowed = true;
		health = (Health)gameObject.GetComponent ("Health");
		//if you start as Mabellle, which I think should be default
		TurnIntoNormal ();
	}
开发者ID:Telek,项目名称:TotemQuest,代码行数:7,代码来源:Controller.cs


示例19: Start

     //private Animator animator;


     public void Start()
     {
          // Components
          moveController = GetComponent<EnemyMoveController>();
          animationController = GetComponent<AnimationController>();
          sprRend = GetComponent<SpriteRenderer>();
          collider = GetComponent<BoxCollider2D>();
          health = GetComponent<Health>();
          player = FindObjectOfType<Player>();

          //laser = GetComponent<Projectile> ();
          //laserObject = GetComponent <Projectile> ();

          //rigidbody2D.mass = 10;

          distance = new Vector2(0, 0);
          speed = new Vector2(0, 0);
          isAgro = false;

          rnd = new System.Random(Guid.NewGuid().GetHashCode());
          t = 3 + rnd.Next(0, 3000) / 1000f;

          teleporting = false;
          teleportCD = 11;
          temp = 0;
          canTeleport = true;

          facing = new Vector2(0, 0);

     }
开发者ID:pmer,项目名称:zombie-ninja-attack-craft,代码行数:33,代码来源:Cyclops.cs


示例20: OnEnable

 void OnEnable()
 {
     m_health = GetComponent<Health> ();
             if (!m_health) {
                     Debug.Log (gameObject.name);
             }
 }
开发者ID:jceipek,项目名称:ionian-eclipse,代码行数:7,代码来源:HealthVisualizer.cs



注:本文中的Health类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Heap类代码示例发布时间:2022-05-24
下一篇:
C# Headers类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap