本文整理汇总了C#中IGameObject.getGameObjectTag方法的典型用法代码示例。如果您正苦于以下问题:C# IGameObject.getGameObjectTag方法的具体用法?C# IGameObject.getGameObjectTag怎么用?C# IGameObject.getGameObjectTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGameObject
的用法示例。
在下文中一共展示了IGameObject.getGameObjectTag方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: deleteGameObject
/// <summary>
///
/// </summary>
/// <param name="gameObject"></param>
/// <param name="targetGameObjectListMapByTag"></param>
private void deleteGameObject(IGameObject gameObject, Dictionary<String, List<IGameObject>> targetGameObjectListMapByTag)
{
Debug.Assert(gameObject != null, "expected gameObject not null.");
Debug.Assert(targetGameObjectListMapByTag != null, "expected targetGameObjectListMapByTypeEnum not null");
String gameObjectTag = gameObject.getGameObjectTag();
if (targetGameObjectListMapByTag.ContainsKey(gameObjectTag)
&& targetGameObjectListMapByTag[gameObjectTag].Contains(gameObject))
{
targetGameObjectListMapByTag[gameObjectTag].Remove(gameObject);
}
}
示例2: registerGameObject
/// <summary>
///
/// </summary>
/// <param name="gameObject"></param>
/// <param name="targetGameObjectListMapByTag"></param>
private void registerGameObject(IGameObject gameObject, Dictionary<String, List<IGameObject>> targetGameObjectListMapByTag)
{
Debug.Assert(gameObject != null, "expected gameObject not null.");
Debug.Assert(targetGameObjectListMapByTag != null, "expected targetGameObjectListMapByTypeEnum not null");
String gameObjectTag = gameObject.getGameObjectTag();
if (!targetGameObjectListMapByTag.ContainsKey(gameObjectTag))
{
targetGameObjectListMapByTag.Add(gameObjectTag, new List<IGameObject>(20));
}
targetGameObjectListMapByTag[gameObjectTag].Add(gameObject);
}
示例3: promoteToCollidableGameObject
/// <summary>
///
/// </summary>
/// <param name="collidableGameObject"></param>
public void promoteToCollidableGameObject(IGameObject collidableGameObject)
{
Debug.Assert(this.gameObjectListMapByTag.ContainsKey(collidableGameObject.getGameObjectTag()), "add the specified object before try to register it as collidable.");
Debug.Assert(this.gameObjectListMapByTag[collidableGameObject.getGameObjectTag()].Contains(collidableGameObject), "add the specified object before try to register it as collidable.");
this.registerGameObject(collidableGameObject, this.collidableGameObjectListMapByTag);
}
示例4: removeGameObject
/// <summary>
///
/// </summary>
/// <param name="gameObject"></param>
public void removeGameObject(IGameObject gameObject)
{
SceneNode targetSceneNode = SceneNode.getSceneNodeByGameObject(this.sceneNodeTree, gameObject);
//if targetSceneNode equals to null then it is the special case when its parent node and this gameObject node has
//expired at the same frame, so sceneBrain calls removeGameObject on both, but it calls removeGameObject on parent node first,
//forcing the sceneManager to delete all the childs node too. Consequentially, the later call to removeGameObject on the child node
//traduces to a tree-search miss.
if (targetSceneNode == null)
{
//assert that all data of this game object was already removed.
Debug.Assert(!this.gameObjectListMapByTag.ContainsKey(gameObject.getGameObjectTag()) || !this.gameObjectListMapByTag[gameObject.getGameObjectTag()].Contains(gameObject));
Debug.Assert(!this.collidableGameObjectListMapByTag.ContainsKey(gameObject.getGameObjectTag()) || !this.collidableGameObjectListMapByTag[gameObject.getGameObjectTag()].Contains(gameObject));
}
else
{
this.recursiveRemoveGameObject(targetSceneNode);
}
}
示例5: gameObjectExist
/// <summary>
///
/// </summary>
/// <param name="gameObject"></param>
/// <returns></returns>
public bool gameObjectExist(IGameObject gameObject)
{
return gameObject == null
|| ( this.gameObjectListMapByTag.ContainsKey(gameObject.getGameObjectTag())
&& this.gameObjectListMapByTag[gameObject.getGameObjectTag()].Contains(gameObject));
}
示例6: onCollisionEnterDelegate
/// <summary>
///
/// </summary>
/// <param name="otherGameObject"></param>
public override void onCollisionEnterDelegate(IGameObject otherGameObject)
{
switch (otherGameObject.getGameObjectTag())
{
case Tags.CUT_TAG:
this.isCut = true;
Random random = new Random();
//create floating death label
GameLoop.getSpawnerManager().specialRequestToSpawn(new GameObjectSpawnRequest(new GameFloatingLabelObject(this, GameFloatingLabelObject.points2string(FRUIT_DEATH_POINTS)), null));
Image stainImage = new Image();
stainImage.Source = new BitmapImage(new Uri(BitmapUtility.getImgResourcePath("stain" + random.Next(1, 21) + ".png")));
stainImage.Height = 260;
stainImage.Width = 390;
StainGameObject stainFadeOutGameObject = new StainGameObject(this._xPosition - stainImage.Width * 0.5, this._yPosition - stainImage.Height * 0.5, stainImage, 4500, 2000);
GameLoop.getSpawnerManager().specialRequestToSpawn(new GameObjectSpawnRequest(stainFadeOutGameObject, null));
break;
case Tags.USER_TAG:
this.isCollected = true;
//create floating death label
GameLoop.getSpawnerManager().specialRequestToSpawn(new GameObjectSpawnRequest(new GameFloatingLabelObject(this, GameFloatingLabelObject.points2string(FRUIT_COLLECTION_POINTS)), null));
{// fruit collected sound
SoundGameObject soundGameObject = new SoundGameObject(new Uri(@"Resources\Sounds\fruit_collected.wav", UriKind.Relative), false);
GameLoop.getSpawnerManager().specialRequestToSpawn(new GameObjectSpawnRequest(soundGameObject, null));
}
break;
}
}
示例7: onCollisionEnterDelegate
/// <summary>
///
/// </summary>
/// <param name="otherGameObject"></param>
public override void onCollisionEnterDelegate(IGameObject otherGameObject)
{
if (otherGameObject.getGameObjectTag() == Tags.FRUIT_TAG)
{
this.cutSuccess = true;
//cut success sound
SoundGameObject soundGameObject = new SoundGameObject(new Uri(@"Resources\Sounds\fruit_cutted.wav", UriKind.Relative), false);
GameLoop.getSpawnerManager().specialRequestToSpawn(new GameObjectSpawnRequest(soundGameObject, null));
}
}
示例8: onCollisionEnterDelegate
/// <summary>
///
/// </summary>
/// <param name="otherGameObject"></param>
public override void onCollisionEnterDelegate(IGameObject otherGameObject)
{
if (otherGameObject.getGameObjectTag() == Tags.USER_TAG)
{
GameLoop.getSceneManager().applyScale(this, 1.2, 1.2, this.getImage().Width * 0.5, this.getImage().Height * 0.5, true);
this.pointedByObject = true;
this.runningHourglass = new HourglassGUIGameObject(otherGameObject, new string[] { @"Hourglass_1.png", @"Hourglass_2.png", @"Hourglass_3.png", @"Hourglass_4.png" });
GameLoop.getSceneManager().addGameObject(runningHourglass, otherGameObject);
}
}
示例9: onCollisionExitDelegate
/// <summary>
///
/// </summary>
/// <param name="otherGameObject"></param>
public override void onCollisionExitDelegate(IGameObject otherGameObject)
{
if (otherGameObject.getGameObjectTag() == Tags.USER_TAG)
{
ISceneManager sceneManager = GameLoop.getSceneManager();
sceneManager.applyScale(this, 1 / 1.2, 1 / 1.2, this.getImage().Width * 0.5, this.getImage().Height * 0.5, true);
this.pointedByObject = false;
this.internalCountDown = USER_INTERACTION_DELAY;
if (this.runningHourglass != null)
{
sceneManager.removeGameObject(runningHourglass);
}
}
}