当前位置: 首页>>代码示例>>C#>>正文


C# Collider2D.GetComponentsInParent方法代码示例

本文整理汇总了C#中UnityEngine.Collider2D.GetComponentsInParent方法的典型用法代码示例。如果您正苦于以下问题:C# Collider2D.GetComponentsInParent方法的具体用法?C# Collider2D.GetComponentsInParent怎么用?C# Collider2D.GetComponentsInParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Collider2D的用法示例。


在下文中一共展示了Collider2D.GetComponentsInParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ActionCheck

        public override void ActionCheck(Collider2D c)
        {
            base.ActionCheck(c);
              if (IsPreformingAction && AttackEffectTags.Contains(c.gameObject.tag) && AttactkCollider2D.enabled)
              {
            if (c.gameObject.tag == "Enemy")
            {
              //var enemies = c.GetComponentsInParent<Damagable>();
              var enemies = c.GetComponents<Damagable>();
              for (var i = 0; i < enemies.Count(); i++)
              {
            enemies[i].TakeDamage("Player", DamageAmt);
            //todo: figure out the angle of approach and bounce enemy\player off when damaged
            //c.GetComponentsInParent( )
            ////c.OverlapPoint()
            //enemies[i].transform.Move();
              }
            }

            if (c.gameObject.tag == "Player")
            {
              var player = c.GetComponentsInParent<Damagable>();
              for (var i = 0; i < player.Count(); i++)
              {
            player[i].TakeDamage("Enemy", DamageAmt);
            //todo: figure out the angle of approach and bounce enemy\player off when damaged

            //c.GetComponentsInParent( )
            ////c.OverlapPoint()
            //enemies[i].transform.Move();
              }
            }
              }
        }
开发者ID:musicm122,项目名称:The-Depths-of-H-E-double-hockey-stick,代码行数:34,代码来源:MeleeAttackAction.cs

示例2: ActionCheck

 public override void ActionCheck(Collider2D c)
 {
     base.ActionCheck(c);
     if (AttackEffectTags.Contains(c.gameObject.tag) && this.DamageAreaCollider2D.enabled)
     {
         if (AttackEffectTags.Contains(c.gameObject.tag))
         {
             var enemies = c.GetComponentsInParent<Damagable>();
             for (int i = 0; i < enemies.Count(); i++)
             {
                 enemies[i].TakeDamage("Obstacle", DamageAmt);
             }
         }
     }
 }
开发者ID:musicm122,项目名称:The-Depths-of-H-E-double-hockey-stick,代码行数:15,代码来源:DamagableObstacle.cs

示例3: OnTriggerExit2D

 void OnTriggerExit2D(Collider2D other)
 {
     if (other.tag == "PlayerObject" && opened) {
         other.GetComponentsInParent<Score_Counter> ()[0].in_portal = false;
     }
 }
开发者ID:mwdewey,项目名称:GameDev2,代码行数:6,代码来源:PortalScript.cs


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