本文整理汇总了C#中BaseEntity类的典型用法代码示例。如果您正苦于以下问题:C# BaseEntity类的具体用法?C# BaseEntity怎么用?C# BaseEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseEntity类属于命名空间,在下文中一共展示了BaseEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendComment
/// <summary>
/// Appends the comment.
/// </summary>
/// <param name = "entity">The entity.</param>
/// <param name = "node">The node.</param>
/// <param name = "comments">The comments.</param>
protected static void AppendComment(BaseEntity entity, IEnumerable<Comment> comments)
{
foreach (Comment comment in comments) {
String c = comment.CommentText.Trim ();
if (CommentHelper.IsSummary (c)) {
continue;
}
if (CommentHelper.IsAvailability (c)) {
String str = c;
foreach (String s in new[] {"<para>", "</para>", "<para>", "</para>"}) {
str = str.Replace (s, String.Empty);
}
entity.MinAvailability = CommentHelper.ExtractAvailability (str.Trim ());
} else if (CommentHelper.IsParameter (c) || CommentHelper.IsReturn (c) || CommentHelper.IsSignature (c)) {
// Do nothing
} else if (CommentHelper.IsParagraph (c)) {
String str = c;
foreach (String s in new[] {"<para>", "</para>", "<para>", "</para>"}) {
str = str.Replace (s, String.Empty);
}
entity.Summary.Add (str.Trim ());
} else if (CommentHelper.IsRemarks (c)) {
String str = c;
foreach (String s in new[] {"<remarks>", "</remarks>", "<remarks>", "</remarks>"}) {
str = str.Replace (s, String.Empty);
}
entity.Summary.Add (str.Trim ());
} else {
entity.Summary.Add (c);
}
}
}
示例2: createShip
public static IEntity createShip(EntitiesManager manager)
{
IEntity ship = new BaseEntity(manager);
Vector2 Pos = new Vector2();
Pos.X = manager.game.GraphicsDevice.Adapter.CurrentDisplayMode.Height / 8;
Pos.Y = manager.game.GraphicsDevice.Adapter.CurrentDisplayMode.Width / 8;
// for controlling behaviour
ship.addAttribute("position", Pos);
ship.addAttribute("velocity", new Vector2());
ship.addAttribute("weight", 0.0076f);
ship.addAttribute("direction", 0.0f);
ship.addAttribute("scale", 1f);
//for drawing
Texture2D texture = manager.game.Content.Load<Texture2D>("ship");
ship.addAttribute("texture", texture);
//behaviours
ship.addBehaviour(GameLoopPhase.Update, new GameControllingBehavior());
ship.addBehaviour(GameLoopPhase.Update, new TemporaryGravityBehaviour());
ship.addBehaviour(GameLoopPhase.Draw, new DrawTexture2DBehaviour());
return ship;
}
示例3: getAmmo
public static int getAmmo(BaseEntity pro)
{
var pro1 = pro as BaseProjectile;
if (pro1 == null)
return 0;
return pro1.primaryMagazine.contents;
}
示例4: CommitLinks
public override void CommitLinks(BaseEntity entity)
{
if (EnableCommitLinks)
base.CommitLinks (entity);
else
Console.WriteLine ("Bypassed DataLinker.CommitLinks for unit testing purposes.");
}
示例5: ItemRepairEvent
public ItemRepairEvent(RepairBench repairBench, BaseEntity.RPCMessage msg)
{
_repairBench = repairBench;
_player = Server.GetPlayer(msg.player);
_item = new InvItem(repairBench.inventory.GetSlot(0));
_msg = msg;
}
示例6: createGameExit
public static IEntity createGameExit(EntitiesManager manager)
{
IEntity exit = new BaseEntity(manager);
exit.addBehaviour(GameLoopPhase.Update, new ExitGameBehaviour());
return exit;
}
示例7: ItemPickupEvent
public ItemPickupEvent(CollectibleEntity ce, BaseEntity.RPCMessage msg, Item i)
{
_entity = ce;
_msg = msg;
_player = Server.GetPlayer(msg.player);
_item = new InvItem(i);
}
示例8: SaveLinkedEntities
public override void SaveLinkedEntities(BaseEntity entity)
{
if (EnableSaveLinkedEntities)
base.SaveLinkedEntities (entity);
else
Console.WriteLine ("Bypassed DataLinker.SaveLinkedEntities for unit testing purposes.");
}
示例9: JumpToNextEnemy
private void JumpToNextEnemy(BaseEntity enemy)
{
List<BaseEntity> enemies = OGE.CurrentWorld.GetCollisionEntitiesType(Collision.CollisionType.Enemy);
List<BaseEntity> bosses = OGE.CurrentWorld.GetCollisionEntitiesType(Collision.CollisionType.Boss);
enemies.AddRange(bosses);
BaseEntity nextEnemy = null;
foreach (BaseEntity temp in enemies)
{
float enemyAngle = OGE.GetAngle(Position, temp.Position);
float diffAngle = Math.Abs(direction - enemyAngle) % 360;
if (temp == enemy)
{
continue;
}
if (nextEnemy == null)
{
nextEnemy = temp;
}
else if (OGE.GetDistance(Position, temp.Position) < OGE.GetDistance(Position, nextEnemy.Position))
{
nextEnemy = temp;
}
}
if (nextEnemy != null)
{
direction = OGE.GetAngle(Position, nextEnemy.Position);
}
}
示例10: FindAndFixDifferences
public virtual void FindAndFixDifferences(BaseEntity previousEntity, BaseEntity updatedEntity, PropertyInfo property)
{
if (Settings.IsVerbose)
Console.WriteLine (" Finding and fixing all differences between previous and updated '" + updatedEntity.GetType().Name + "' entity on '" + property.Name + "' property.");
var previousLinks = new BaseEntity[]{ };
if (previousEntity != null)
previousLinks = Linker.GetLinkedEntities (previousEntity, property);
var updatedLinks = Linker.GetLinkedEntities (updatedEntity, property);
var linksToAdd = IdentifyEntityLinksToAdd (previousLinks, updatedLinks);
var linksToRemove = IdentifyEntityLinksToRemove (previousLinks, updatedLinks);
if (Settings.IsVerbose) {
Console.WriteLine (" Links to add: " + linksToAdd.Length);
Console.WriteLine (" Links to remove: " + linksToRemove.Length);
}
if (linksToAdd.Length > 0)
CommitNewReverseLinks (updatedEntity, property, linksToAdd);
if (linksToRemove.Length > 0)
RemoveOldReverseLinks (updatedEntity, property, linksToRemove);
}
示例11: RocketShootEvent
public RocketShootEvent(BaseLauncher baseLauncher, BaseEntity.RPCMessage msg, BaseEntity baseEntity)
{
_entity = new Entity(baseEntity);
_player = Server.GetPlayer(msg.player);
_msg = msg;
_launch = baseLauncher;
}
示例12: TestEntityToXml
public void TestEntityToXml(BaseEntity e)
{
XmlDocument xml = e.ToXmlDocument();
Assert.IsNotNull(xml);
Assert.IsNotNullOrEmpty(xml.InnerXml);
Trace.WriteLine(xml.InnerXml);
}
示例13: AddFeedback
public static DataRow AddFeedback(BaseEntity feedback)
{
using (DbCommand cmd = DB.Gt.GetStoredProcCommand(ProcNames.AddFeedback))
{
DB.Gt.AddInParameter(cmd, "@Feedback", DbType.Xml, feedback.ToXmlString());
return DB.Gt.ExecuteDataRow(cmd);
}
}
示例14: AddImage
public static DataRow AddImage(BaseEntity sellingImage)
{
using (DbCommand cmd = DB.Gt.GetStoredProcCommand(ProcNames.AddImage))
{
DB.Gt.AddInParameter(cmd, "@SellingImage", DbType.Xml, sellingImage.ToXmlString());
return DB.Gt.ExecuteDataRow(cmd);
}
}
示例15: getAmmoType
public static ItemDefinition getAmmoType(BaseEntity pro)
{
var pro1 = pro as BaseProjectile;
if (pro1 == null)
return null;
//ConsoleSystem.Broadcast("chat.add", new object[] { 0, pro1.primaryMagazine.ammoType.ToString() });
return pro1.primaryMagazine.ammoType;
}