本文整理汇总了C#中Sector类的典型用法代码示例。如果您正苦于以下问题:C# Sector类的具体用法?C# Sector怎么用?C# Sector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sector类属于命名空间,在下文中一共展示了Sector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public void Load(string Filename)
{
List levelLisp = Util.Load(Filename, "supertux-level");
Properties props = new Properties(levelLisp);
int version = 1;
props.Get("version", ref version);
if(version == 1)
throw new Exception("Old Level format not supported");
if(version > 2)
Console.WriteLine("Warning: Level Format newer than application");
props.Get("name", ref Name);
props.Get("author", ref Author);
LispIterator iter = new LispIterator(levelLisp);
while(iter.MoveNext()) {
switch(iter.Key) {
case "sector":
Sector sector = new Sector();
sector.Parse(this, iter.List);
break;
default:
Console.WriteLine("Ignoring unknown tag '" + iter.Key + "' in level");
break;
}
}
}
示例2: CanBeExited
//Check if a spot has access to the exit of a track.
public bool CanBeExited(Sector sec)
{
Track strck = null;
int idx=-1;
foreach(Track trck in Tracks)
{
idx = trck.Sectors.FindIndex(p => p.Id == sec.Id);
if(idx != -1)
{
strck = trck;
break;
}
}
if (strck == null || idx == -1) //Invalid sector (track could not be found)
return false;
if (idx == strck.Sectors.Count)
return true;
for(int i=idx+1; i<strck.Sectors.Count; i++) //Check if any of the above laying sectors are occupied
{
if (strck.Sectors[i].Blocked)
return false;
}
return true;
}
示例3: CheckIds
public static void CheckIds(Application application, Sector sector, bool AlertGood)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder("These tilemaps have bad ids in sector " + sector.Name + ":");
List<int> invalidtiles;
// Any bad found yet?
bool bad = false;
foreach (Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
invalidtiles = CheckIds(tilemap, application.CurrentLevel.Tileset);
if (invalidtiles.Count != 0) {
bad = true;
if (String.IsNullOrEmpty(tilemap.Name))
sb.Append(Environment.NewLine + "Tilemap (" + tilemap.Layer + ")");
else
sb.Append(Environment.NewLine + tilemap.Name + " (" + tilemap.Layer + ")");
}
}
MessageType msgtype;
string message;
if (! bad) {
if (! AlertGood)
return;
msgtype = MessageType.Info;
message = "No invalid tile ids in any tilemap in sector " + sector.Name + ".";
} else {
msgtype = MessageType.Warning;
message = sb.ToString();
}
MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent,
msgtype, ButtonsType.Close, message);
md.Run();
md.Destroy();
}
示例4: ObjectsChanged
private void ObjectsChanged(Sector sector, IGameObject Object)
{
if((Object is IObject) || (Object is Tilemap))
return;
UpdateList();
}
示例5: SpawnPeople
public void SpawnPeople(Sector sector)
{
int numPeopleOptions = mPeoplePrefabs.Length;
if(numPeopleOptions <= 0)
{
return;
}
int numSlots = mSpawnPositions.Length;
int forceSpawnIndex = Random.Range(0, numSlots); // ensure that at least one person is on this boat
for(int i = 0; i < numSlots; ++i)
{
if(i != forceSpawnIndex && Random.value > 0.6f)
{
continue;
}
int leftOrRight = (Random.value > 0.5f)?1:-1;
float range = mBuoyancy.mEndsOffset;
Vector3 personPos = mSpawnPositions[i].position;
GameObject prefab = mPeoplePrefabs[Random.Range(0, numPeopleOptions)];
sector.SpawnEntity(prefab, personPos, transform.up, Vector3.forward*leftOrRight);
}
}
示例6: Create
public Sector Create(Block blockArg, uint sector)
{
uint block = blockArg.BlockIndex;
long totalSectors = blockArg.SectorCount;
if (sector > totalSectors)
{
string message = String.Format("TotalSectors: {0}, Requested Sector:{1}", totalSectors, sector);
throw new ArgumentOutOfRangeException("sector", message);
}
if (!blockFactory.HasData(block))
{
return CreateEmptySector(block, sector);
}
long currentAddress = blockFactory.GetBlockAddress(block);
vhdFile.DataReader.SetPosition(currentAddress + (int)VhdConstants.VHD_SECTOR_LENGTH * sector);
var result = new Sector
{
BlockIndex = block,
SectorIndex = sector,
GlobalSectorIndex = this.blockFactory.GetBlockSize() * block + sector,
Data = vhdFile.DataReader.ReadBytes((int)VhdConstants.VHD_SECTOR_LENGTH)
};
return result;
}
示例7: ResizeDialog
public ResizeDialog(Sector sector, Tilemap tilemap)
{
this.sector = sector;
this.tilemap = tilemap;
Glade.XML gxml = new Glade.XML("editor.glade", "resizeDialog");
gxml.Autoconnect(this);
if (resizeDialog == null ||
XOffsetEntry == null ||
YOffsetEntry == null ||
WidthEntry == null ||
HeightEntry == null)
{
throw new Exception("Couldn't load resize Dialog");
}
if (tilemap == null) {
XOffsetEntry.Text = "0";
YOffsetEntry.Text = "0";
WidthEntry.Text = sector.Width.ToString();
HeightEntry.Text = sector.Height.ToString();
undoTitleBase = "Sector \"" + sector.Name + "\"";
} else {
XOffsetEntry.Text = "0";
YOffsetEntry.Text = "0";
WidthEntry.Text = tilemap.Width.ToString();
HeightEntry.Text = tilemap.Height.ToString();
undoTitleBase = "Tilemap \"" + tilemap.Name + "\"";
}
resizeDialog.Title += " " + undoTitleBase;
resizeDialog.Icon = EditorStock.WindowIcon;
resizeDialog.ShowAll();
}
示例8: Parse
public override Sector Parse(TextReader reader)
{
Sector sector = new Sector();
StringBuilder accum = new StringBuilder();
while (true)
{
string line = reader.ReadLine();
if (line == null)
break;
if (Regex.IsMatch(line, @"^\s*$"))
continue;
if (Regex.IsMatch(line, @"^\s*#"))
continue;
if (Char.IsWhiteSpace(line[0]))
{
accum.Append(" ");
accum.Append(Regex.Replace(line, @"^\s+", ""));
continue;
}
if (accum.Length > 0)
Apply(accum.ToString(), sector);
accum.Clear();
accum.Append(line);
}
if (accum.Length > 0)
{
Apply(accum.ToString(), sector);
}
return sector;
}
示例9: ObjectCreationTool
public ObjectCreationTool(Application application,
Sector sector, Type objectType, Sprite Icon)
{
this.application = application;
this.sector = sector;
this.objectType = objectType;
this.Icon = Icon;
}
示例10: Ship
public Ship(string name, Ships ships, Sector sector, SectorPosition sectorPosition, Vector3 angle, Tile tile)
{
this.name = name;
this.ships = ships;
this.sector = sector;
this.sectorPosition = sectorPosition;
this.angle = angle;
this.tilesList.Add(tile);
}
示例11: Parse
public static Sector Parse(SqlDataReader dr)
{
Sector Sector = new Sector();
Sector.Id = Convert.ToInt32(dr["Id"]);
Sector.Name = Convert.ToString(dr["Name"]);
return Sector;
}
示例12: Tram
/// <summary>
/// Initializes a new instance of the <see cref="Tram"/> class.
/// </summary>
/// <param name="id">The database ID of the tram.</param>
/// <param name="number">The identification number (string) of the tram.</param>
/// <param name="state">The current status of the tram.</param>
/// <param name="tramType">The tram type of the tram.</param>
/// <param name="usedForEducationalPurposes">Whether the tram is used for lessons or not.</param>
/// <param name="sector">The sector on which the tram is standing.</param>
public Tram(int id, string number, State state, TramType tramType, bool usedForEducationalPurposes, Sector sector)
: this(id)
{
this.Number = number;
this.State = state;
this.TramType = tramType;
this.UsedForEducationalPurposes = usedForEducationalPurposes;
this.Sector = sector;
}
示例13: Add
internal void Add( Sector sector )
{
sector.PhysicsSpace = world;
lock ( active_sectors )
{
active_sectors.Add( sector );
}
world.Add( sector.grid );
}
示例14: Player
public Player(GameObject playerObject)
{
this.playerObject = playerObject;
sector = new Sector();
sectorPosition = new SectorPosition();
Vector3 angle = new Vector3(0,0,0);
ObjectVelocity velocity = new ObjectVelocity();
Vector3 angularVelocity = new Vector3(0,0,0);
updateScriptRef();
}
示例15: CreateTabList
private void CreateTabList()
{
foreach(Sector sector in level.Sectors) {
SectorRenderer Renderer = new SectorRenderer(level, sector);
Renderer.ShowAll();
AppendPage(Renderer, new Label(sector.Name));
}
if(this.sector == null && level.Sectors.Count > 0)
this.sector = level.Sectors[0];
}