本文整理汇总了C#中IGameObject类的典型用法代码示例。如果您正苦于以下问题:C# IGameObject类的具体用法?C# IGameObject怎么用?C# IGameObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGameObject类属于命名空间,在下文中一共展示了IGameObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Check
//[MethodImpl(MethodImplOptions.Synchronized)] // single threaded
public void Check(IGameObject me, FrameUpdateEventArgs e)
{
Rect rme = me.Shape;
bool hitsGround = false;
foreach (var other in Obstacles)
{
if (other != me)
{
Rect rother = other.Shape;
if (rme.IntersectsWith(rother))
{
Rect overlap = Rect.Intersect(rme,rother);
if (other is GroundObject)
hitsGround = true;
if (other.IsObstacle)
{
ProcessCollision(me, other, overlap, rme, rother, e.ElapsedMilliseconds / 1000);
}
me.RaiseOnCollision(me, other, true); // bool: me = caller of CheckCollision
other.RaiseOnCollision(other, me, false);
}
}
}
me.IsGrounded = hitsGround;
}
示例2: Contains
public static bool Contains(this ILayer layer, IGameObject gameObject)
{
foreach (IReference<IGameObject> reference in layer.GameObjectReferences)
if (reference.Target == gameObject)
return true;
return false;
}
示例3: Equals
public bool Equals(IGameObject other)
{
return
TypeIsSame(other) &&
FieldNumIsSame(((IChessBoard)other).GetAllFields()) &&
FieldsAreEqual(((IChessBoard) other).GetAllFields());
}
示例4: ObjectsChanged
private void ObjectsChanged(Sector sector, IGameObject Object)
{
if((Object is IObject) || (Object is Tilemap))
return;
UpdateList();
}
示例5: MailedSuccesfully
public override void MailedSuccesfully(Mailbox box, IGameObject obj)
{
try
{
Metal metal = obj as Metal;
Collecting collecting = Actor.SkillManager.AddElement(SkillNames.Collecting) as Collecting;
if (metal != null)
{
// Custom
if (!collecting.mMetalData.ContainsKey(metal.Guid))
{
collecting.mMetalData.Add(metal.Guid, new Collecting.MetalStats(0));
}
}
base.MailedSuccesfully(box, obj);
}
catch (ResetException)
{
throw;
}
catch (Exception e)
{
Common.Exception(Actor, Target, e);
}
}
示例6: Fireball
public Fireball(Image image, GameWorld gameWorld, IGameObject source)
{
this.source = source;
gw = gameWorld;
Image = image;
Init();
}
示例7: AddHuntableToInventory
public static bool AddHuntableToInventory(DogHuntingSkill ths, IGameObject huntable)
{
if (huntable == null)
{
return false;
}
bool flag = false;
if (SimTypes.IsSelectable(ths.SkillOwner))
{
flag = Inventories.TryToMove(huntable, ths.SkillOwner.CreatedSim);
}
else
{
// Add the item to head of family
SimDescription head = SimTypes.HeadOfFamily(ths.SkillOwner.Household);
if (head != null)
{
flag = Inventories.TryToMove(huntable, head.CreatedSim);
}
}
if (!flag)
{
huntable.RemoveFromWorld();
huntable.Destroy();
}
else
{
StoryProgression.Main.Skills.Notify("SniffOut", ths.SkillOwner.CreatedSim, Common.Localize("SniffOut:Success", ths.SkillOwner.IsFemale, new object[] { ths.SkillOwner, huntable.GetLocalizedName() }));
}
return flag;
}
示例8: EventEntry
public EventEntry(IGameObject owner, string name)
{
Owner = new WeakReference(owner);
Name = name;
_comparison = owner.Id;
_hashCode = Name.GetHashCode() ^ Owner.GetHashCode();
}
示例9: Raise
public static void Raise(string eventName, IGameObject sender, EventArgs args)
{
var key = new EventEntry(sender, eventName);
if(!Entries.ContainsKey(key))
{
Log.Warning("A handler for the event '{0}' was not found while attempting to raise the event.", eventName);
return;
}
var list = Entries[key];
var removes = new List<WeakReference>();
foreach (var weakRef in list)
{
if (!weakRef.IsAlive || weakRef.Target != null)
{
removes.Add(weakRef);
continue;
}
var action = (Action<IGameObject, EventArgs>) weakRef.Target;
if (action == null)
continue;
action(sender, args);
}
foreach (var weakReference in removes)
{
Entries[key].Remove(weakReference);
}
}
示例10: DrawObject
public static void DrawObject(this Graphics g, IGameObject obj, Bitmap bitmap, Camera camera)
{
var location = obj.Body.Position - camera.Body.Position;
g.DrawImage(bitmap, location.X, location.Y);
g.DrawAABB(obj, camera);
}
示例11: GrowingImageDrawBehavior
public GrowingImageDrawBehavior(IGameObject gameObject)
{
GameObject = gameObject;
size = new Size(50, 50);
SpeedX = 1;
SpeedY = 1;
}
示例12: Window
public Window(Game game, Vector2 position, int width, int height)
: base(game)
{
_GameRef = (IGameObject)game;
ScreenPosition = position;
WindowSize = new Rectangle(0, 0, width, height);
}
示例13: IGameObjectCollisionCheck
public static bool IGameObjectCollisionCheck(IGameObject object1, IGameObject object2)
{
if (object1.Rect.Intersects(object2.Rect))
return true;
else
return false;
}
示例14: Collision
public Collision(IGameObject gameObject)
{
ColliderComponent = gameObject.ColliderComponent;
GameObject = gameObject;
RigidBody = GameObject.RigidBody;
Transform = GameObject.Transform;
}
示例15: UpdateGameObject
public override void UpdateGameObject(IGameObject gameObject)
{
if (!this.Equals(gameObject))
{
this.chessBoard = gameObject as IChessBoard;
}
}