本文整理汇总了C#中GameObject.Get方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.Get方法的具体用法?C# GameObject.Get怎么用?C# GameObject.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResetSoldier
/// <summary>
/// Resets the soldier
/// </summary>
/// <param name="soldier">Soldier to reset</param>
private void ResetSoldier(GameObject soldier)
{
soldier.Get<HealthComponent>().Life = HealthComponent.MaxLife;
soldier.Get<ShieldComponent>().Power = ShieldComponent.MaxPower;
soldier.Remove<PoisonComponent>();
}
示例2: CreateParticles
public void CreateParticles(GameObject obj)
{
var collision = obj.Get<CollisionComponent>();
var explodable = obj.Get<ExplodableComponent>();
var spawnArea = collision.Box.ToRectangle();
for (int i = 0; i < explodable.MaxParticles; i++)
{
AddParticle(explodable.ParticleFactory.CreateParticle(spawnArea, random));
}
}
示例3: GetsDestroyed
private bool GetsDestroyed(GameObject object1, GameObject object2)
{
var destroy = object1.Get<DestroyableComponent>();
if (destroy.getsDestroyedBy.Count == 0 || destroy.getsDestroyedBy.Contains(object2.GroupName))
return true;
return false;
}
示例4: ExplodesWith
private bool ExplodesWith(GameObject object1, GameObject object2)
{
var explodable = object1.Get<ExplodableComponent>();
if (explodable.explodesWith.Count == 0 || explodable.explodesWith.Contains(object2.GroupName))
return true;
return false;
}