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

C# CollisionInfo类代码示例

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

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



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

示例1: OnCollision

 protected virtual void OnCollision(GameObject other, CollisionInfo info)
 {
     if (Collision != null && other.activeSelf)
     {
         Collision(this, other, info);
     }
 }
开发者ID:Juskelis,项目名称:Champloo,代码行数:7,代码来源:Controller2D.cs


示例2: RunnerStatsMessage

 public RunnerStatsMessage(RunnerState currentState, Vector3 velocity, CollisionInfo contacts, InputState currentInput)
 {
     CurrentState = currentState;
     Velocity = velocity;
     Contacts = contacts;
     CurrentInput = currentInput;
 }
开发者ID:Trifectgaming,项目名称:2D-Runner,代码行数:7,代码来源:RunnerStatsMessage.cs


示例3: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObjectGroup = collisionInfo.HitObject.CollisionGroup ;
     if (hitObjectGroup == CollisionGroup.Ground)
     {
     }
 }
开发者ID:ROSSFilipov,项目名称:CSharp,代码行数:7,代码来源:Snowflake.cs


示例4: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     if (collisionInfo.HitObject.CollisionGroup == CollisionGroup.Explosion)
     {
         this.Exists = false;
     }
 }
开发者ID:borko9696,项目名称:SoftwareUniversity,代码行数:7,代码来源:StaticStar.cs


示例5: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     if (collisionInfo.HitObject is Ground || collisionInfo.HitObject is StarShrapnel)
     {
         this.Exists = false;
     }
 }
开发者ID:hkostadinov,项目名称:SoftUni,代码行数:7,代码来源:Star.cs


示例6: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var fallingStar = collisionInfo.HitObject.CollisionGroup;
     if (fallingStar == CollisionGroup.Ground || fallingStar == CollisionGroup.Explosion)
     {
         this.Exists = false;
     }
 }
开发者ID:IlianStefanov,项目名称:SoftUni,代码行数:8,代码来源:FallingStar.cs


示例7: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObject = collisionInfo.HitObject;
     if (hitObject is Explosion)
     {
         this.Exists = false;
     }
 }
开发者ID:GeorgiDinev,项目名称:Projects,代码行数:8,代码来源:Explosion.cs


示例8: RespondToCollision

 // ако снежинката удари земята да изчезва
 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObject = collisionInfo.HitObject;
     if (hitObject is Ground || hitObject is Snow)
     {
         this.Exists = false;
     }
 }
开发者ID:alagalia,项目名称:Object-Oriented-Programming,代码行数:9,代码来源:Snowflake.cs


示例9: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObjectGroup = collisionInfo.HitObject.CollisionGroup;
     if (hitObjectGroup == CollisionGroup.Ground || hitObjectGroup == CollisionGroup.Snow)
     {
         this.Exists = false;
     }
 }
开发者ID:IlianStefanov,项目名称:SoftUni,代码行数:8,代码来源:Snowflake.cs


示例10: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObjectGroup = collisionInfo.HitObject.CollisionGroup ;
     if (hitObjectGroup == CollisionGroup.Ground || hitObjectGroup == CollisionGroup.Snow)
     {
         this.Exists = false; // added to stop snowflakes passing through the ground (1)
     }
 }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:8,代码来源:Snowflake.cs


示例11: Valid

 public bool Valid(CollisionInfo other)
 {
     var equals =
         (!Above.HasValue || Above.Equals(other.Above)) &&
         (!Below.HasValue || Below.Equals(other.Below)) &&
         (!Left.HasValue || Left.Equals(other.Left)) &&
         (!Right.HasValue || Right.Equals(other.Right));
     return equals;
 }
开发者ID:Trifectgaming,项目名称:2D-Runner,代码行数:9,代码来源:CollisionInfo.cs


示例12: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObject = collisionInfo.HitObject;
     if (hitObject is Star)
     {
         Star st = (Star) hitObject;
         st.Exists = false;
     }
 }
开发者ID:GeorgiDinev,项目名称:Projects,代码行数:9,代码来源:UnstableStar.cs


示例13: RespondToCollision

 public override void RespondToCollision(CollisionInfo collisionInfo)
 {
     var hitObjectGroup = collisionInfo.HitObject.CollisionGroup;
     if (hitObjectGroup == CollisionGroup.Star)
     {
         var hitObj = collisionInfo.HitObject;
         //(hitObj as EnvironmentObject).Exists = false;
     }
 }
开发者ID:nadiahristova,项目名称:OOP,代码行数:9,代码来源:Explostion.cs


示例14: InitializeDefault

    void InitializeDefault()
    {
        GetComponent<Renderer>().material.SetFloat("_Chanel", currentShaderIndex);
        ++currentShaderIndex;
        if (currentShaderIndex == 3) currentShaderIndex = 0;
        line.SetPosition(0, tRoot.position);
        if (IsVertical)
        {
          if (Physics.Raycast(tRoot.position, Vector3.down, out hit))
          {
        line.SetPosition(1, hit.point);
        if (StartGlow != null) StartGlow.transform.position = tRoot.position;
        if (HitGlow != null) HitGlow.transform.position = hit.point;
        if (GoLight != null) GoLight.transform.position = hit.point + new Vector3(0, LightHeightOffset, 0);
        if (Particles != null) Particles.transform.position = hit.point + new Vector3(0, ParticlesHeightOffset, 0);
        if (Explosion != null) Explosion.transform.position = hit.point + new Vector3(0, ParticlesHeightOffset, 0);
          }
        }
        else
        {
          if (effectSettings.Target != null) tTarget = effectSettings.Target.transform;
          else if (!effectSettings.UseMoveVector) { Debug.Log("You must setup the the target or the motion vector"); }
          Vector3 targetDirection;
          if (!effectSettings.UseMoveVector) {
        targetDirection = (tTarget.position - tRoot.position).normalized;
          }
          else {
        targetDirection = tRoot.position + effectSettings.MoveVector * effectSettings.MoveDistance;
          }
          var direction = tRoot.position + targetDirection * effectSettings.MoveDistance;
          if (Physics.Raycast(tRoot.position, targetDirection, out hit, effectSettings.MoveDistance + 1, effectSettings.LayerMask)) {
        direction = (tRoot.position + Vector3.Normalize(hit.point - tRoot.position) * (effectSettings.MoveDistance + 1)).normalized;
          }
          line.SetPosition(1, hit.point - effectSettings.ColliderRadius * direction);
          var particlesOffsetPos = hit.point - direction * ParticlesHeightOffset;
          if (StartGlow!=null) StartGlow.transform.position = tRoot.position;
          if (HitGlow!=null) HitGlow.transform.position = particlesOffsetPos;
          if (GoLight!=null) GoLight.transform.position = hit.point - direction * LightHeightOffset;
          if (Particles!=null) Particles.transform.position = particlesOffsetPos;
          if (Explosion!=null) Explosion.transform.position = particlesOffsetPos;
        }

        var collInfo = new CollisionInfo { Hit = hit };
        effectSettings.OnCollisionHandler(collInfo);
        if (hit.transform != null)
        {
          var shield = hit.transform.GetComponent<ShieldCollisionBehaviour>();
          if (shield != null) shield.ShieldCollisionEnter(collInfo);
        }
    }
开发者ID:JerethChampagne,项目名称:ArenaLegends,代码行数:50,代码来源:LineRendererBehaviour.cs


示例15: EffectSettings_CollisionEnter

 void EffectSettings_CollisionEnter(object sender, CollisionInfo e)
 {
     if (Effect==null)
       return;
     var colliders = Physics.OverlapSphere(transform.position, EffectSettings.EffectRadius, EffectSettings.LayerMask);
     foreach (var coll in colliders) {
       var hitGO = coll.transform;
       var renderer = hitGO.GetComponentInChildren<Renderer>();
       var effectInstance = Instantiate(Effect) as GameObject;
       effectInstance.transform.parent = renderer.transform;
       effectInstance.transform.localPosition = Vector3.zero;
       effectInstance.GetComponent<AddMaterialOnHit>().UpdateMaterial(coll.transform);
     }
 }
开发者ID:naskew100,项目名称:Fired-Up,代码行数:14,代码来源:DebuffOnEnemyFromCollision.cs


示例16: DeactivateAttachedPoints

 void DeactivateAttachedPoints(RaycastHit hit)
 {
     for (int i = 0; i < AttachedPoints.Length; i++) {
       var ap = AttachedPoints[i];
       ap.SetActive(false);
     }
     var collInfo = new CollisionInfo { Hit = hit };
     effectSettings.OnCollisionHandler(collInfo);
     if (hit.transform != null)
     {
       var shield = hit.transform.GetComponent<ShieldCollisionBehaviour>();
       if (shield != null) shield.ShieldCollisionEnter(collInfo);
     }
     onCollision = true;
 }
开发者ID:seonwifi,项目名称:bongbong,代码行数:15,代码来源:ClothGridCollisionBehaviour.cs


示例17: ShieldCollisionEnter

    public void ShieldCollisionEnter(CollisionInfo e)
    {
        if (e.Hit.transform!=null) {
          if (IsWaterInstance) {
        var go = Instantiate(ExplosionOnHit) as GameObject;
        var t = go.transform;
        t.parent = transform;
        var scale = transform.localScale.x * ScaleWave;
        t.localScale = new Vector3(scale, scale, scale);
        t.localPosition = new Vector3(0, 0.001f, 0);
        t.LookAt(e.Hit.point);
          }
          else  {
        if (EffectOnHit!=null) {
          if (!CreateMechInstanceOnHit) {
            var hitGO = e.Hit.transform;
            var renderer = hitGO.GetComponentInChildren<Renderer>();
            var effectInstance = Instantiate(EffectOnHit) as GameObject;
            effectInstance.transform.parent = renderer.transform;
            effectInstance.transform.localPosition = Vector3.zero;
            var addMat = effectInstance.GetComponent<AddMaterialOnHit>();
            addMat.SetMaterialQueue(currentQueue);
            addMat.UpdateMaterial(e.Hit);
          }
          else {
            var effectInstance = Instantiate(EffectOnHit) as GameObject;
            var tr = effectInstance.transform;
            tr.parent = GetComponent<Renderer>().transform;
            tr.localPosition = Vector3.zero;
            tr.localScale = transform.localScale * ScaleWave;
            tr.LookAt(e.Hit.point);
            tr.Rotate(AngleFix);
            effectInstance.GetComponent<Renderer>().material.renderQueue = currentQueue-1000;
          }
        }
        if (currentQueue > 4000) currentQueue = 3001;
        else ++currentQueue;

        if (ExplosionOnHit!=null) {
          var inst2 = Instantiate(ExplosionOnHit, e.Hit.point, new Quaternion()) as GameObject;
          inst2.transform.parent = transform;
        }
          }
        }

        //Debug.Log(e.Hit.textureCoord);
    }
开发者ID:naskew100,项目名称:Fired-Up,代码行数:47,代码来源:ShieldCollisionBehaviour.cs


示例18: OnCollisionHandler

 public void OnCollisionHandler(CollisionInfo e)
 {
   for (int i = 0; i < lastActiveIndex; i++)
   {
     Invoke("SetGoActive", active_value[i]);
   }
   for (int i = 0; i < lastInactiveIndex; i++)
   {
     Invoke("SetGoInactive", inactive_value[i]);
   }
   var handler = CollisionEnter;
   if (handler != null)
     handler(this, e);
   if (DeactivateAfterCollision && !deactivatedIsWait)
   {
     deactivatedIsWait = true;
     Invoke("Deactivate", DeactivateTimeDelay);
   }
 }
开发者ID:ziyihu,项目名称:LordOfSinU3D,代码行数:19,代码来源:EffectSettings.cs


示例19: CollisionDetection

        public CollisionInfo CollisionDetection(Tile mobile, Point destination)
        {
            var target = this[destination];
            var collisionInfo = new CollisionInfo{
                Tile = mobile,
                Vector = mobile.Location.NormalizedVector(destination)};

            if (target != null)
            {
                collisionInfo.Collision = _collisionRules.All(r => r(mobile, target));
                collisionInfo.Object = target;
            }

            if (collisionInfo.Tile != null && collisionInfo.Object != null && collisionInfo.Object != collisionInfo.Tile)
            {
                if (collisionInfo.Tile.OnCollision != null)
                    collisionInfo.Messages.AddRange(collisionInfo.Tile.GetCollisionResponse(collisionInfo));

                if (collisionInfo.Object.OnCollision != null)
                    collisionInfo.Messages.AddRange(collisionInfo.Object.GetCollisionResponse(collisionInfo));
            }
            return collisionInfo;
        }
开发者ID:jdoig,项目名称:monster-maze,代码行数:23,代码来源:TileSet.cs


示例20: CollisionEnter

    private void CollisionEnter()
    {
        if (EffectOnHitObject!=null && hit.transform!=null) {
          var hitGO = hit.transform;
          var renderer = hitGO.GetComponentInChildren<Renderer>();
          var effectInstance = Instantiate(EffectOnHitObject) as GameObject;
          effectInstance.transform.parent = renderer.transform;
          effectInstance.transform.localPosition = Vector3.zero;
          effectInstance.GetComponent<AddMaterialOnHit>().UpdateMaterial(hit);
        }

        if (AttachAfterCollision)
          tRoot.parent = hit.transform;

        if (SendCollisionMessage) {
          var collInfo = new CollisionInfo {Hit = hit};
          effectSettings.OnCollisionHandler(collInfo);
          if (hit.transform != null) {
        var shield = hit.transform.GetComponent<ShieldCollisionBehaviour>();
        if (shield != null) shield.ShieldCollisionEnter(collInfo);
          }
        }
        onCollision = true;
    }
开发者ID:JerethChampagne,项目名称:ArenaLegends,代码行数:24,代码来源:ProjectileCollisionBehaviour.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CollisionObject类代码示例发布时间:2022-05-24
下一篇:
C# CollisionFlags类代码示例发布时间: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