本文整理汇总了C#中MapObject类的典型用法代码示例。如果您正苦于以下问题:C# MapObject类的具体用法?C# MapObject怎么用?C# MapObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapObject类属于命名空间,在下文中一共展示了MapObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddObject
public void AddObject(Point index, MapObject obj)
{
if (!_objects.ContainsKey(index))
_objects.Add(index, new List<MapObject>());
_objects[index].Add(obj);
}
示例2: CreateGeometry
public void CreateGeometry(MapObject parent)
{
foreach (Aerofoil aerofoil in aerofoils)
{
aerofoil.CreateGeometry(parent, this);
}
}
示例3: OnGetObjectBounds
protected override void OnGetObjectBounds( MapObject obj, List<Rect> rectangles )
{
//RTSCharacter
RTSCharacter character = obj as RTSCharacter;
if( character != null )
{
float radius = character.Type.Radius;
rectangles.Add( new Rect(
obj.Position.ToVec2() - new Vec2( radius, radius ),
obj.Position.ToVec2() + new Vec2( radius, radius ) ) );
return;
}
//all other objects
if( obj.PhysicsModel != null )
{
foreach( Body body in obj.PhysicsModel.Bodies )
{
foreach( Shape shape in body.Shapes )
{
if( shape.ContactGroup == (int)ContactGroup.NoContact )
continue;
Bounds bounds = shape.GetGlobalBounds();
rectangles.Add( new Rect( bounds.Minimum.ToVec2(), bounds.Maximum.ToVec2() ) );
}
}
return;
}
//base.OnGetObjectBounds( obj, rectangles );
}
示例4: Start
protected override void Start()
{
base.Start();
mapObject = GetComponent<MapObject>();
movement = GetComponent<SimpleMovement>();
}
示例5: UpdateCollision
internal static Rectangle UpdateCollision(this GameObject gameObject, Rectangle Destination, Rectangle old, MapObject currentMap)
{
foreach (GameTile tile in currentMap.Tiles)
{
if (tile.ValidTile && Destination.Intersects(tile.Destination))
{
Rectangle newDestinationXOnly = new Rectangle(Destination.X, old.Y, gameObject.Width, gameObject.Height);
Rectangle newDestinationYOnly = new Rectangle(old.X, Destination.Y, gameObject.Width, gameObject.Height);
if (newDestinationXOnly.Intersects(tile.Destination))
{
Destination.X = old.X;
}
if (newDestinationYOnly.Intersects(tile.Destination))
{
Destination.Y = old.Y;
if (gameObject.Center.Y < tile.Destination.Y)
{
gameObject.IsJumping = false;
gameObject.CurrentSpeed = 0;
}
}
}
}
return Destination;
}
示例6: addMapObject
public void addMapObject(MapObject mapObject)
{
if (this.mapObjects == null)
this.mapObjects = new List<MapObject>();
this.mapObjects.Add(mapObject);
}
示例7: AddObjectClone
public void AddObjectClone(MapObject obj)
{
MapObject o = (MapObject)obj.Clone();
o.MapX %= 2 * (Config.BigTileEdgeSize + 1);
o.MapY %= 2 * (Config.BigTileEdgeSize + 1);
Objects.Add(o);
}
示例8: ObjectWrapper
public ObjectWrapper(MapObject mapObject, Point index)
{
_object = mapObject;
_index = index;
DrawPrioirty = _index.X * 1000 + _index.Y;
IsDrawable = true;
}
示例9: TestMoveUp
public void TestMoveUp()
{
var movableObject = new MapObject {Position = new MapPosition(5, 7)};
movableObject.Position = new MapPosition(movableObject.Position, new PositionChange {Y = 1});
Assert.AreEqual(new MapPosition(5, 8), movableObject.Position);
}
示例10: TestMoveRight
public void TestMoveRight()
{
var movableObject = new MapObject {Position = new MapPosition(6, 2)};
movableObject.Position = new MapPosition(movableObject.Position, new PositionChange{X = 1});
Assert.AreEqual(new MapPosition(7, 2), movableObject.Position);
}
示例11: TestMoveLeft
public void TestMoveLeft()
{
var movableObject = new MapObject {Position = new MapPosition(4, 4)};
movableObject.Position = new MapPosition(movableObject.Position, new PositionChange {X = -1});
Assert.AreEqual(new MapPosition(3, 4), movableObject.Position);
}
示例12: TestMoveDown
public void TestMoveDown()
{
var movableObject = new MapObject {Position = new MapPosition(8, 1)};
movableObject.Position = new MapPosition(movableObject.Position, new PositionChange{Y = -1});
Assert.AreEqual(new MapPosition(8, 0), movableObject.Position);
}
示例13: TestAddOneMovableObject
public void TestAddOneMovableObject()
{
var map = new Map();
var movableObject = new MapObject();
map.AddObject(movableObject);
Assert.AreEqual(1, map.GetNumDrawables());
Assert.AreEqual(movableObject, map.GetDrawable(0));
}
示例14: Map
public Map(int mapSize)
{
this.mapSize = mapSize;
this.map = new MapObject [mapSize][];
for (int i = 0; i < map.Length; ++i)
{
map[i] = new MapObject[mapSize];
}
}
示例15: MapChangeRegion_ObjectIn
void MapChangeRegion_ObjectIn( Entity entity, MapObject obj )
{
if( PlayerIntellect.Instance != null && PlayerIntellect.Instance.ControlledObject == obj )
{
PlayerCharacter.ChangeMapInformation playerCharacterInformation =
( (PlayerCharacter)PlayerIntellect.Instance.ControlledObject ).GetChangeMapInformation( this );
GameWorld.Instance.SetShouldChangeMap( mapName, spawnPointName,
playerCharacterInformation );
}
}