本文整理汇总了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);
}
}
示例2: RunnerStatsMessage
public RunnerStatsMessage(RunnerState currentState, Vector3 velocity, CollisionInfo contacts, InputState currentInput)
{
CurrentState = currentState;
Velocity = velocity;
Contacts = contacts;
CurrentInput = currentInput;
}
示例3: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
var hitObjectGroup = collisionInfo.HitObject.CollisionGroup ;
if (hitObjectGroup == CollisionGroup.Ground)
{
}
}
示例4: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
if (collisionInfo.HitObject.CollisionGroup == CollisionGroup.Explosion)
{
this.Exists = false;
}
}
示例5: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
if (collisionInfo.HitObject is Ground || collisionInfo.HitObject is StarShrapnel)
{
this.Exists = false;
}
}
示例6: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
var fallingStar = collisionInfo.HitObject.CollisionGroup;
if (fallingStar == CollisionGroup.Ground || fallingStar == CollisionGroup.Explosion)
{
this.Exists = false;
}
}
示例7: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
var hitObject = collisionInfo.HitObject;
if (hitObject is Explosion)
{
this.Exists = false;
}
}
示例8: RespondToCollision
// ако снежинката удари земята да изчезва
public override void RespondToCollision(CollisionInfo collisionInfo)
{
var hitObject = collisionInfo.HitObject;
if (hitObject is Ground || hitObject is Snow)
{
this.Exists = false;
}
}
示例9: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
var hitObjectGroup = collisionInfo.HitObject.CollisionGroup;
if (hitObjectGroup == CollisionGroup.Ground || hitObjectGroup == CollisionGroup.Snow)
{
this.Exists = false;
}
}
示例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)
}
}
示例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;
}
示例12: RespondToCollision
public override void RespondToCollision(CollisionInfo collisionInfo)
{
var hitObject = collisionInfo.HitObject;
if (hitObject is Star)
{
Star st = (Star) hitObject;
st.Exists = false;
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}