本文整理汇总了C#中GameObject.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.Equals方法的具体用法?C# GameObject.Equals怎么用?C# GameObject.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPositionForGO
public BoardPosition GetPositionForGO(GameObject go)
{
BoardPosition position = default(BoardPosition);
foreach (KeyValuePair<BoardPosition, GameObject> tile in board)
{
if (go.Equals(tile.Value))
{
position = tile.Key;
break;
}
Renderer r = tile.Value.GetComponent<Renderer>();
if (r != null)
{
Bounds b = r.bounds;
if (go.transform.position.x >= b.min.x && go.transform.position.x <= b.max.x && go.transform.position.y >= b.min.y && go.transform.position.y <= b.max.y)
{
position = tile.Key;
break;
}
}
}
return position;
}
示例2: OnParticleCollision
void OnParticleCollision( GameObject other)
{
if ( other.Equals( GameObject.FindWithTag( "Player" ) ) )
{
mm.increaseMovementSpeedTemporarily();
}
}
示例3: OnDied
void OnDied(GameObject enemy)
{
if (enemy.Equals (gameObject))
{
innerRotate.StopSmooth();
outterRotate.StopSmooth();
if(dropMinionsOnDeath)
{
foreach(Transform t in transform.FindChild("Minions"))
{
t.parent = transform.parent;
foreach(EnemyMovement enemyMovement in t.GetComponents<EnemyMovement>())
{
if(enemyMovement.GetType() == typeof(RandomMovement))
enemyMovement.enabled = true;
else
enemyMovement.enabled = false;
}
//collider was disabled when parent changed
t.GetComponentInChildren<Collider2D>().enabled = true;
if(OnMinionReleased != null)
OnMinionReleased(t.gameObject);
}
}
else
{
RemoveMinions();
}
}
}
示例4: leavePoop
public void leavePoop(GameObject collectable)
{
if (collectable.Equals (currentCollectable))
{
onPoop = false;
currentCollectable = null;
}
}
示例5: OnDestroyChild
void OnDestroyChild(GameObject target)
{
if (target.Equals(maxCautionEnemy))
{
maxCautionEnemy = null;
if(ui)ui.BroadcastMessage("OnUpdateCaution", 0, SendMessageOptions.DontRequireReceiver);
}
}
示例6: updateSelector
public void updateSelector(GameObject newText)
{
// Gets called from the text itself to tell this script a mouse is pointing at it.
for (int i = 0; i < selectedArray.Length; i++) {
if ( newText.Equals (selectedArray[i])) {
selectNum = i;
changeSelector ();
}
}
}
示例7: otherCollisionEnter
public override void otherCollisionEnter(GameObject enemy,Vector3 point)
{
if(enemy.GetComponent<HydraPlatform>()!=null){
enemy.GetComponent<HydraPlatform>().hasBeenTouched();
if(iaParent.platformDestroyed !=null && !enemy.Equals(iaParent.platformDestroyed)){
iaParent.platformDestroyed.GetComponent<HydraPlatform>().repositionPlatform();
}
iaParent.platformDestroyed = enemy;
}
}
示例8: hasConnectingPath
public bool hasConnectingPath(GameObject node)
{
foreach (GameObject path in connectedPaths)
{
if (node.Equals(path))
{
return true;
}
}
return false;
}
示例9: GetRandomDestination
public GameObject GetRandomDestination(GameObject current)
{
bool foundDest = false;
GameObject go = null;
while(!foundDest){
int i = Random.Range (0, navPoints.Length);
go = navPoints[i];
foundDest = (go.GetComponent<NavpointScript>().isDestination && !current.Equals (go));
}
return go;
}
示例10: isItemTouchingInventory
public bool isItemTouchingInventory(GameObject itemToCheck)
{
foreach(GameObject item in itemInInventoryTrigger)
{
if(itemToCheck.Equals(item))
{
return true;
}
}
return false;
}
示例11: isItemStoredInInventory
public bool isItemStoredInInventory(GameObject itemToCheck)
{
foreach(ItemParentSave item in itemInInventory)
{
if(itemToCheck.Equals(item.ItemGameObject))
{
return true;
}
}
return false;
}
示例12: getParentFromItem
public Transform getParentFromItem(GameObject itemToCheck)
{
foreach(ItemParentSave item in itemInInventory)
{
if(itemToCheck.Equals(item.ItemGameObject))
{
return item.parent;
}
}
return null;
}
示例13: ShootTarget
public void ShootTarget(GameObject target)
{
if(!target.Equals(targetCharacter))
{
if(OnBeginAttacking != null)
OnBeginAttacking(target);
StopCoroutine("castShot");
targetCharacter = target;
StartCoroutine("castShot");
}
}
示例14: Bounce
public void Bounce(GameObject bounce)
{
if (bounce.Equals(bouncePointer1)) {
bouncePointer2.SetActive(true);
bouncePointer1.SetActive(false);
realDeepThroat.destination = bouncePointer2.transform.position;
} else {
bouncePointer1.SetActive(true);
bouncePointer2.SetActive(false);
realDeepThroat.destination = bouncePointer1.transform.position;
}
}
示例15: MoveToward
public void MoveToward(GameObject targetCharacter)
{
if(!targetCharacter.Equals(moveTarget))
{
moveTarget = targetCharacter;
MoveTo(targetCharacter.transform.position);
}
else
{
moveTargetPosition = targetCharacter.transform.position;
//moveTargetPosition.z = 0;
}
}