本文整理汇总了C#中CollisionType类的典型用法代码示例。如果您正苦于以下问题:C# CollisionType类的具体用法?C# CollisionType怎么用?C# CollisionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollisionType类属于命名空间,在下文中一共展示了CollisionType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CheckBuildingCollision
public CollisionType CheckBuildingCollision(Base3DObject bob)
{
//3 types of collision: no collision, crash and landing
ct = CollisionType.None;
for (int c = 0; c < blocks.Length; c++)
{
if (blocks[c].Collided(bob))
{
blocks[c].HitTest = true;
bob.HitTest = true;
ct = CollisionType.Building;
if (bob.Bounds.Min.Y > (blocks[c].Bounds.Max.Y - playerSafeZones.Y) && (bob.Bounds.Min.X > blocks[c].Bounds.Min.X + playerSafeZones.X && bob.Bounds.Max.X < blocks[c].Bounds.Max.X - playerSafeZones.X && bob.Bounds.Min.Z > blocks[c].Bounds.Min.Z + playerSafeZones.Z && bob.Bounds.Max.Z < blocks[c].Bounds.Max.Z - playerSafeZones.Z))
{
ct = CollisionType.Roof;
}
break;
}
else
{
blocks[c].HitTest = false;
bob.HitTest = false;
}
}
return ct;
}
开发者ID:thestonefox,项目名称:XNA-Alien-Lander,代码行数:25,代码来源:Map.cs
示例2: Collision
public Collision(Rectangle S,Rectangle D,CollisionType T,CollisionDirection Di)
{
Src = S;
Dest = D;
Type = T;
Dir = Di;
}
开发者ID:jazzyjester,项目名称:Mario-Game,代码行数:7,代码来源:Objects.cs
示例3: SimpleButton
private float ReleaseTime; //tmp ?
public SimpleButton(Vector2 position, Vector2 size, float reltime = 0.3f, CollisionType ctype = CollisionType.Rectangle, Texture2D textureoff = null, Texture2D textureon = null)
{
Position = position;
Size = size;
ReleasedTexture = textureoff;
PressedTexture = textureon;
// button area is set whatever collision type because it is also use for drawing
if (ctype == CollisionType.Rectangle)
{
ButtonArea = new Rectangle((int)position.X, (int)position.Y, (int)Size.X, (int)size.Y);
collisionType = CollisionType.Rectangle;
}
else
{
ButtonAreaCircle = new Circle(Size.X /2.0f, new Vector2(position.X, position.Y));
// a bit complicated this way
ButtonArea = new Rectangle((int)position.X - (int)Size.X / 2, (int)position.Y - (int)Size.Y / 2, (int)Size.X, (int)size.Y);
collisionType = CollisionType.Circle;
}
buttonState = buttonState.Released;
currentTexture = ReleasedTexture;
Enabled = true;
EnableTint = false;
tintColour = Color.White;
pressedTime = 0;
ReleaseTime = reltime;
}
开发者ID:InfiniteProductions,项目名称:InfiniteControls,代码行数:36,代码来源:SimpleButton.cs
示例4: Missile
public Missile(Game game, Model m, CollisionType type, Vector3 start, Entity target, float speed)
: base(game,m,type,start,Vector3.Zero,speed,50)
{
var exhaust = new MissileExhaustParticleSystem(game, ((Game1)Game).Content);
ParticleEmitterManager.addParticleEmitter(new ParticleEmitter(Game, exhaust, 1000, lifeTime, getExhaustPosition));
addComponent(new PathingChase(game, this, target, speed, true));
}
开发者ID:RyanAdamsGD,项目名称:City-Defense,代码行数:7,代码来源:Missile.cs
示例5: CollisionComponent
//List<Polygon> polygons
public CollisionComponent(GameObject gameObject, List<Polygon> polygons, List<AABB> axisAlignedBoxes)
: base(gameObject)
{
Name = "CollisionComponent";
this.axisAlignedBoxes = axisAlignedBoxes;
this.polygons = polygons;
hasCollided = false;
if (polygons != null && axisAlignedBoxes != null)
{
collisionType = CollisionType.POLYGON_AND_AABB;
ParentObject.Properties.updateProperty<List<AABB>>("AABB", axisAlignedBoxes);
ParentObject.Properties.updateProperty<List<Polygon>>("Polygon", polygons);
}
else if (polygons != null)
{
collisionType = CollisionType.POLYGON;
ParentObject.Properties.updateProperty<List<Polygon>>("Polygon", polygons);
}
else if (axisAlignedBoxes != null)
{
collisionType = CollisionType.AABB;
ParentObject.Properties.updateProperty<List<AABB>>("AABB", axisAlignedBoxes);
}
else
{
collisionType = CollisionType.NO_TYPE;
}
ParentObject.Properties.updateProperty<CollisionType>("CollisionType", collisionType);
ParentObject.Properties.updateProperty<bool>("HasCollided", hasCollided);
ParentObject.Properties.updateProperty<bool>("IsCollisionActive", true);
}
开发者ID:Gardern,项目名称:Imagine_Cup_code,代码行数:35,代码来源:CollisionComponent.cs
示例6: Awake
void Awake()
{
// initialization
collisionType = CollisionType.Box;
setCollisionType(collisionType);
}
开发者ID:tavoe,项目名称:blocker,代码行数:7,代码来源:WorldBounds.cs
示例7: setCollisionType
//This toggles if the world bounds are a sphere or a rectangle.
void setCollisionType(CollisionType ct)
{
// mutate dat shit
collisionType = ct;
// remove any collider currently on the worldbounds.
Destroy (gameObject.GetComponent<BoxCollider>());
Destroy (gameObject.GetComponent<SphereCollider>());
// based on the collisionType variable, add a new collider with some default
// parameters.
switch(collisionType)
{
case CollisionType.Sphere:
collScript = this.gameObject.AddComponent<SphereCollider>();
collScript.isTrigger = true;
setScale(500, 0, 0);
break;
case CollisionType.Box:
collScript = this.gameObject.AddComponent<BoxCollider>();
collScript.isTrigger = true;
setScale (1000,1000, 1000);
break;
}
}
开发者ID:tavoe,项目名称:blocker,代码行数:26,代码来源:WorldBounds.cs
示例8: Collision
public Collision(CollisionType type = CollisionType.CourseCollision)
{
Result = 0;
TeacherId = -1;
SlotId = -1;
Type = type;
CrashingCourses = new List<Course>();
}
开发者ID:cemusta,项目名称:NSGAII_UCT,代码行数:8,代码来源:Collision.cs
示例9: Reset
public override void Reset()
{
collision = CollisionType.OnCollisionEnter;
collideTag = "Untagged";
sendEvent = null;
storeCollider = null;
storeForce = null;
}
开发者ID:nermakov777,项目名称:Unity_Tests,代码行数:8,代码来源:CollisionEvent+1.cs
示例10: CollisionUnit
/// <summary>
/// Instantiate a new CollisionUnit. This constructor is for circle based collisions.
/// </summary>
/// <param name="owner">The "owner" Entity that this CollisionUnit will be for.</param>
/// <param name="center">The location of the circle center.</param>
/// <param name="radius">The radius of the circle.</param>
/// <param name="collisionMask">Collision mask for the object.</param>
/// <param name="bUsePixelCollision">Is pixel-perfect collisions should be used.</param>
public CollisionUnit(Entity owner, Vector2 center, int radius, Texture2D collisionMask, bool bUsePixelCollision)
{
InitializeCommonStuff(owner, collisionMask, bUsePixelCollision);
mCircleCenter = center;
mCircleRadius = radius;
mOrigRadius = radius;
mCollisionType = CollisionType.COLLISION_CIRCLE;
}
开发者ID:sgdc,项目名称:sgdc-old,代码行数:16,代码来源:CollisionUnit.cs
示例11: AddNewData
protected override int AddNewData()
{
m_collisionType = DataManager.Generate<CollisionType>();
m_collisionType.Name = m_textBox_name.Text;
DataManager.CollisionTypes.Add(m_collisionType);
return m_collisionType.Id;
}
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:9,代码来源:UserControl_CollisionType.cs
示例12: Start
void Start()
{
// Set collision
// toggle ON/OFF your choice of raycast
//collisionType = CollisionType.CLICKHITONE; // hit just one object
collisionType = CollisionType.CLICKHITALL; // hit multiple objects overlapping
//collisionType = CollisionType.MOUSEPOSITION; // continuous mouse position detection
}
开发者ID:blackstrings,项目名称:knife,代码行数:9,代码来源:RayCastingClick9.cs
示例13: CanTraverse
/// <summary>
/// Indicates whether the class can traverse this CollisionType or not.
/// </summary>
/// <param name="toTraverse">
/// The CollisionType to traverse.
/// </param>
/// <returns>
/// True if the unit can traverse it.
/// False if the unit cannot.
/// </returns>
public override bool CanTraverse(CollisionType toTraverse)
{
if (toTraverse == CollisionType.None)
{
return true;
}
return false;
}
开发者ID:AkaiBaraue,项目名称:AgeOfDragons,代码行数:19,代码来源:BladesmasterClass.cs
示例14: Trile
public Trile(CollisionType faceType)
: this()
{
this.Faces.Add(FaceOrientation.Back, faceType);
this.Faces.Add(FaceOrientation.Front, faceType);
this.Faces.Add(FaceOrientation.Left, faceType);
this.Faces.Add(FaceOrientation.Right, faceType);
this.MissingTrixels.OnDeserialization();
}
开发者ID:tanis2000,项目名称:FEZ,代码行数:9,代码来源:Trile.cs
示例15: Collidable
public Collidable(Game game, Entity.Entity parent, CollisionType type, CollisionEvent e, int health, int damage, Collidable parentCollidable, BoundingBox boundingBox)
: base(game, parent)
{
this.onCollision = e;
this.type = type;
this.health = health;
this.damage = damage;
children = new List<Collidable>();
parentCollidable.addChild(this);
this.boundingBox = boundingBox;
}
开发者ID:kozupi,项目名称:--,代码行数:11,代码来源:Collidable.cs
示例16: OnAwakeByPool
public void OnAwakeByPool( bool used )
{
if( !used )
{
this.cachedRadius = this.radius;
}
ReferenceManager.Instance.refCollisionManager.AddEnemyShotCollider( this );
this.radius = grazeRadius;
this.collisionType = CollisionType.Graze;
this.enabled = true;
}
开发者ID:hiroki-kitahara,项目名称:Shoooooooooooooting-kitahara,代码行数:11,代码来源:EnemyShotCollider.cs
示例17: Tile
/* set up the tile -> figure out it's position in the level, it's size relative to the screen & load the sprite+set the collision behaviour */
public Tile(Texture2D texture, CollisionType type, int xIndex, int yIndex, int screenWidth, int screenHeight)
{
LoadContent(texture, type);
position = new Rectangle();
position.Width = screenWidth/64;
position.Height = screenHeight/32;
position.X = xIndex * position.Width;
position.Y = yIndex * position.Height;
}
开发者ID:Terhands,项目名称:LazerSharktopus,代码行数:12,代码来源:Tile.cs
示例18: CanTraverse
/// <summary>
/// Indicates whether the unit can traverse this CollisionType or not.
/// </summary>
/// <param name="toTraverse">
/// The CollisionType to traverse.
/// </param>
/// <returns>
/// True if the unit can traverse it.
/// False if the unit cannot.
/// </returns>
public override bool CanTraverse(CollisionType toTraverse)
{
if (toTraverse == CollisionType.None ||
toTraverse == CollisionType.Mountain ||
toTraverse == CollisionType.Water ||
toTraverse == CollisionType.Flyable)
{
return true;
}
return false;
}
开发者ID:AkaiBaraue,项目名称:AgeOfDragons,代码行数:22,代码来源:FlyingUnitClass.cs
示例19: Tile
/* set up the tile -> figure out it's position in the level, it's size relative to the screen & load the sprite+set the collision behaviour */
public Tile(Game game, Texture2D texture, CollisionType type, int xIndex, int yIndex, int screenWidth, int screenHeight, int rowsPerScreen, int colsPerScreen)
: base(game)
{
LoadContent(texture, type);
position = new Rectangle();
position.Width = screenWidth/colsPerScreen;
position.Height = screenHeight/rowsPerScreen;
position.X = xIndex * position.Width;
position.Y = yIndex * position.Height;
}
开发者ID:Terhands,项目名称:LazerSharktopus,代码行数:13,代码来源:Tile.cs
示例20: SetValue
public void SetValue(int x, int y, CollisionType value)
{
if (x >= 0 && y >= 0 && x < width && y < height)
{
values[x, y] = value;
}
else
{
Console.WriteLine("Attempted to set collisionType outside of the grid at " + x.ToString() + "," + y.ToString() + ".");
Console.WriteLine("Ignoring.");
}
}
开发者ID:siltutorials,项目名称:TKPlatformer,代码行数:12,代码来源:CollisionGrid.cs
注:本文中的CollisionType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论