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


C# CollisionInfo类代码示例

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


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


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