本文整理汇总了C#中Levels类的典型用法代码示例。如果您正苦于以下问题:C# Levels类的具体用法?C# Levels怎么用?C# Levels使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Levels类属于命名空间,在下文中一共展示了Levels类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameplayScreen
public GameplayScreen(Game1 game, Vector2 worldSize, Levels currentLevel)
: base(game)
{
this.worldSize = worldSize;
eCurrentLevel = currentLevel;
heatmapWriteTimer = 0;
//Make the tree a bit wider for outer walls.
quadTree = new QuadTree(new Rectangle(
-10, -10, (int)worldSize.X + 20, (int)worldSize.Y + 20));
//Add the 4 walls on the outside of the world.
Components.Add(new Wall(GDGame, new Vector2(-10, -10), new Vector2(worldSize.X + 10, 0)));
Components.Add(new Wall(GDGame, new Vector2(worldSize.X, -10), new Vector2(worldSize.X + 10, worldSize.Y)));
Components.Add(new Wall(GDGame, new Vector2(0, worldSize.Y), new Vector2(worldSize.X + 10, worldSize.Y + 10)));
Components.Add(new Wall(GDGame, new Vector2(-10, 0), new Vector2(0, worldSize.Y + 10)));
//Add the player to world.
Components.Add(Player = new PlayerBall(GDGame, new Vector2(300, 300)));
//Give the camera the new world size.
GDGame.Camera.WorldSize = worldSize + new Vector2(0, 100);
gameOver = won = false;
GDGame.IsMouseVisible = false;
}
示例2: Write
protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder)
{
if (level < Levels.Info)
return;
lineNr = Math.Max(0, lineNr);
column = Math.Max(0, column);
switch (level)
{
//case Levels.Info:
// log.LogMessage(messageBuilder());
// break;
case Levels.Info: //TODO: get LogMessage to work.
case Levels.Warning:
if (url != null)
log.LogWarning(null, null, null, url, lineNr, column, 0, 0, messageBuilder());
else
log.LogWarning(messageBuilder());
break;
case Levels.Error:
if (url != null)
log.LogError(null, null, null, url, lineNr, column, 0, 0, messageBuilder());
else
log.LogError(messageBuilder());
break;
}
}
示例3: Write
/// <summary>
/// Record the given log entry if the level is sufficient.
/// </summary>
protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder)
{
if (level < Levels.Error)
return;
outputPane.EnsureLoaded();
outputPane.LogLine(FormatLevel(level) + messageBuilder());
}
示例4: Message
/* ----------------------------------------------------------------- */
///
/// constructor
///
/// Exception、およびその派生クラス(例外クラス)が引数に指定された
/// 場合、Message の内容は指定されたメッセージレベルによって異なる。
/// Info, Warn, Error, Fatal の場合は、指定された例外クラスの
/// Message のみとなる。Trace, Debug の場合は、それに加えて
/// 例外クラスの型名、およびスタックトレースも含まれる。
///
/* ----------------------------------------------------------------- */
public Message(Levels level, Exception e)
{
_level = level;
_time = System.DateTime.Now;
if (level == Levels.Trace || level == Levels.Debug) _message = e.ToString();
else _message = e.Message;
}
示例5: LevelManager
public LevelManager( Levels startingLevel, Level levelObj)
{
m_levelDictionary = new Dictionary<Levels,Level>();
m_currentLevel = startingLevel;
m_levelDictionary.Add( Levels.JungTown, levelObj );
}
示例6: Awake
private Levels levels; // Reference to levels script
void Awake()
{
camera_script = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
levels = GetComponent<Levels>();
brick_array = new GameObject[20, 20];
max_types = 2;
}
示例7: onHit
public override void onHit(Levels.Level l)
{
OffsetY -= 5;
HitSound.Play();
if (HeldItem != null)
{
l.Items.Add(HeldItem);
l.ParticleSystems.Add(new Particles.ParticleSystemCoin(Position.X, Position.Y));
coins--;
if(coins == 0)
HeldItem = null;
}
if(coins == 0)
{
SolidBlock temp = new SolidBlock(Position.X / 24, Position.Y / 24);
temp.OffsetY -= 5;
l.Blocks.Add(temp);
this.destroy(l);
}
}
示例8: CheckShip
// Checks collision of the given object against the edges of the level
public void CheckShip(Object toCheck, Levels.SpaceLevel level)
{
bool currentHit = false;
Vector2 translationVector, centerDiff;
translationVector = Vector2.Zero;
centerDiff = new Vector2(level.GetLevelWidth() - toCheck.GetCenter().X, level.GetLevelHeight() - toCheck.GetCenter().Y);
if (CheckIntersection(toCheck.collisionPolygons, level.collisionPolygons, centerDiff, ref translationVector, true))
{
toCheck.SetPosition(new Vector2(toCheck.GetPosition().X + translationVector.X, toCheck.GetPosition().Y + translationVector.Y));
currentHit = true; ;
}
if (!currentHit)
{
//If they are not currently intersecting, check if they will intersect
Vector2 oldPosition1 = toCheck.GetPosition();
toCheck.SetPosition(new Vector2(oldPosition1.X + toCheck.Velocity.X, oldPosition1.Y + toCheck.Velocity.Y));
bool futureRet = CheckIntersection(toCheck.collisionPolygons, level.collisionPolygons, centerDiff, ref translationVector, true);
if (futureRet)
{
// Set the position back now that the future collision has been checked
toCheck.SetPosition(oldPosition1);
currentHit = true;
}
}
if (currentHit)
{
float speed = toCheck.Velocity.Length();
toCheck.Velocity = Vector2.Normalize(translationVector);
toCheck.Velocity *= speed;
}
}
示例9: Write
protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args)
{
if (level < Levels.Warning)
return;
if ((msg == null) && (exception != null)) msg = exception.Message;
if (msg == null)
return;
lineNr = Math.Max(0, lineNr);
column = Math.Max(0, column);
switch (level)
{
case Levels.Warning:
if (url != null)
log.LogWarning(null, null, null, url, lineNr, column, 0, 0, msg, args);
else
log.LogWarning(msg, args);
break;
case Levels.Error:
if (url != null)
log.LogError(null, null, null, url, lineNr, column, 0, 0, msg, args);
else
log.LogError(msg, args);
break;
}
}
示例10: Awake
private string level_name; // Custom level name
// TODO: custom level names regex check for invalid chars
void Awake ()
{
camera_script = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
level_builder_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<LevelBuilder>();
grid_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Grid>();
levels_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Levels>();
}
示例11: Log
/// <summary>
/// Logs the specified message.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception.</param>
private static void Log(Levels level, object message, Exception exception) {
string msg = message == null ? string.Empty : message.ToString();
if(exception != null) {
msg += ", Exception: " + exception.Message;
}
_logs.Add(new KeyValuePair<Levels, string>(level, msg));
}
示例12: SetMyProperties
protected override void SetMyProperties()
{
myFirstName = properties.myFirstname;
health = properties.health;
timeBetweenShoot = properties.timeBetweenShoots;
initialForce = properties.initialForce;
level = Levels.Level2;
}
示例13: Result
private Result(Levels level, int? line, int? column, int? selectionStart, int? selectionLength, string message)
{
this._level = level;
this._line = line.HasValue ? line.Value : (int?)null;
this._column = column.HasValue ? column.Value : (int?)null;
this._selectionStart = selectionStart.HasValue ? selectionStart.Value : (int?)null;
this._selectionLength = selectionLength.HasValue ? selectionLength.Value : (int?)null;
this._message = (message == null) ? "" : message;
}
示例14: MapLevels2Json
public LevelsJson MapLevels2Json(Levels json)
{
return new LevelsJson()
{
Beginner = json.Beginner,
Expert = json.Expert,
Intermediate = json.Intermediate
};
}
示例15: CreateCode
public void CreateCode(Levels levels, System.IO.Stream stream)
{
foreach (Level nivel in levels)
{
string code;
nivel.Ordena();
code = nivel.ToString(Version.DameVersion(CPUVersion.CPC));
stream.Write(Encoding.UTF8.GetBytes(code), 0, Encoding.UTF8.GetByteCount(code));
}
}