本文整理汇总了C#中Collider.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Collider.ToString方法的具体用法?C# Collider.ToString怎么用?C# Collider.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collider
的用法示例。
在下文中一共展示了Collider.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerStay
void OnTriggerStay(Collider other)
{
if (genericEnemy != null)
{
if (GameController.Testing)
{
print("Trigger Stay by: " + other.ToString());
}
PlayerController playerController = other.transform.parent.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.AttackCooldownTime <= 0)
{
genericEnemy.SmoothLookAt(playerController.transform.position);
if (genericEnemy.IsFacingPlayer(attackRange))
{
playerController.TakeDamage(DAMAGE * LibRevel.GetScalarFromDistanceThreshold(genericEnemy.playerHitRay.distance, genericEnemy.attackRangeAdjusted));
if (GameController.Testing)
{
print (Vector3.Distance(transform.position, other.transform.position));
print("Base Damage: " + DAMAGE);
print("Distance from player: " + genericEnemy.playerHitRay.distance);
print("Attack Range Adjusted: " + genericEnemy.attackRangeAdjusted);
print("Distance / Attack Range Adjusted: " + (genericEnemy.playerHitRay.distance / genericEnemy.attackRangeAdjusted));
print(" 1 - (Distance / Attack Range Adjusted): " + ( 1 - (genericEnemy.playerHitRay.distance / genericEnemy.attackRangeAdjusted)));
print(LibRevel.GetScalarFromDistanceThreshold(genericEnemy.playerHitRay.distance, genericEnemy.attackRangeAdjusted));
print(DAMAGE * LibRevel.GetScalarFromDistanceThreshold(genericEnemy.playerHitRay.distance, genericEnemy.attackRangeAdjusted));
}
genericEnemy.AttackCooldownTime = attackRate; //Wait one second before able to attack again.
}
}
}
}
示例2: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
if (GameController.Testing)
{
print("Trigger Entered by: " + other.ToString());
}
}
示例3: OnTriggerEnter
void OnTriggerEnter(Collider col)
{
Debug.Log("Collided with destroyer : " + col.ToString());
GameObject obj = col.gameObject;
while (obj.transform.parent != null) obj = obj.transform.parent.gameObject;
Destroy(obj);
}
示例4: OnTriggerExit
void OnTriggerExit(Collider other)
{
if (GameController.Testing)
{
print("Trigger Left by: " + other.ToString());
}
}
示例5: OnTriggerEnter
void OnTriggerEnter (Collider other)
{
Logger.Log ("EndGameCollider::OnTriggerEnter(" + other.ToString () + ")" + alreadyDisplayed.ToString (), Logger.Level.INFO);
if (alreadyDisplayed == false) {
if (other == hero.GetComponent<Collider> ()) {
alreadyDisplayed = true;
GameStateController.get ().triggerEnd (this);
}
}
}
示例6: OnTriggerEnter
// Destroy everything that enters the trigger
void OnTriggerEnter( Collider other)
{
Debug.Log("Trigger enter! hat collided with: " + other.ToString());
//TODO: Attach the hat to the player ball.
//With the hat the ball can destroy obstacles.
if (other.gameObject.tag == "Player") {
attachedPlayerObject = other.gameObject;
}
}
示例7: OnTriggerEnter
void OnTriggerEnter(Collider collider)
{
if (collider.tag == "Enemy" && d.PlayerCanDie()) {
d.set ("Hit enemy", collider.ToString());
app.score = 0;
app.playing = false;
for (int i = 0; i < app.enemies.transform.childCount; i++) {
Destroy(app.enemies.transform.GetChild(i).gameObject);
}
}
if (collider.tag == "Goals") {
collider.GetComponent<CoinController>().RemoveCoin();
}
}
示例8: OnTriggerStay
void OnTriggerStay(Collider other)
{
if (genericEnemy != null)
{
if (GameController.Testing)
{
print("Trigger Stay by: " + other.ToString());
}
PlayerController playerController;
//If the parent of the object we're colliding with is the player, Check to see if we are looking at eachother before dealing damage.
playerController = other.transform.parent.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.AttackCooldownTime <= 0)
{
genericEnemy.SmoothLookAt(playerController.transform.position);
if (genericEnemy.IsFacingPlayer(attackRange))
{
playerController.TakeDamage(DAMAGE * LibRevel.GetScalarFromDistanceThreshold(genericEnemy.playerHitRay.distance, genericEnemy.attackRangeAdjusted));
if (GameController.Testing)
{
print(Vector3.Distance(transform.position, other.transform.position));
print("Base Damage: " + DAMAGE);
print("Distance from player: " + genericEnemy.playerHitRay.distance);
print("Attack Range Adjusted: " + genericEnemy.attackRangeAdjusted);
print("Distance / Attack Range Adjusted: " + (genericEnemy.playerHitRay.distance / genericEnemy.attackRangeAdjusted));
print(" 1 - (Distance / Attack Range Adjusted): " + (1 - (genericEnemy.playerHitRay.distance / genericEnemy.attackRangeAdjusted)));
print(LibRevel.GetScalarFromDistanceThreshold(genericEnemy.playerHitRay.distance, genericEnemy.attackRangeAdjusted));
print(DAMAGE * LibRevel.GetScalarFromDistanceThreshold(genericEnemy.playerHitRay.distance, genericEnemy.attackRangeAdjusted));
}
genericEnemy.AttackCooldownTime = attackRate; //Reset the cooldown wait time.
}
}
//If the object we're colliding with is the player, immediately attempt to deal damage.
playerController = other.GetComponent<PlayerController>();
if (playerController != null && genericEnemy.AttackCooldownTime <= 0)
{
genericEnemy.SmoothLookAt(playerController.transform.position);
playerController.TakeDamage(DAMAGE * LibRevel.GetScalarFromDistanceThreshold(transform.position, other.transform.position, attackRange));
genericEnemy.AttackCooldownTime = attackRate; //Wait a bit before able to attack again.
}
}
}
示例9: OnTriggerEnter
//dodat cemo za skupljanje kutija
void OnTriggerEnter(Collider col)
{
if (col.gameObject.layer == LayerMask.NameToLayer ("RoadMarkers"))
this.checkTheRightMarker (col.ToString ().Split (' ') [0]);
if (col.tag == "CollectableBox")
this.collectBox (col.gameObject);
}
示例10: OnTriggerEnter
void OnTriggerEnter(Collider other) {
Logger.Log("InfoWindowCollisionTrigger::OnTriggerEnter("+other.ToString()+") _alreadyDisplayed="+_alreadyDisplayed.ToString(), Logger.Level.INFO);
if(other == heroCollider) {
displayInfoWindow();
}
}
示例11: OnTriggerStay
void OnTriggerStay( Collider other )
{
Debug.Log("OnTriggerStay ["+ other.ToString() + "]");
}
示例12: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
string type = other.ToString();
System.Console.WriteLine("Collided wiyh {0}", type);
if (other.gameObject.CompareTag("Food"))
{
other.gameObject.SetActive(false);
snakePieces.Add((GameObject)Instantiate(snakePiece, new Vector3(0,0.5f,-2.0f), new Quaternion(0,0,0,0)));
score++;
scoreText.text = "Score: " + score;
Instantiate(food, new Vector3(Random.value * 99, 1.1f, Random.value * 99), new Quaternion(0, 0, 0, 0));
}
if (other.gameObject.CompareTag("Wall"))
{
//loseText.text = "You Died.... Great job bro";
snakeHead.SetActive(false);
}
if (other.gameObject.CompareTag("SnakePiece"))
{
//loseText.text = "Unintended Collision!!!!!";
}
}
示例13: OnTriggerExit
void OnTriggerExit(Collider col) {
switch (col.gameObject.tag) {
case "Enemy":
tileContact.Remove(col.gameObject);
if (tileContact.Count == 0){
stand = false;
Debug.Log("Exit GroundFixed");
}
break;
case "GroundFixed":
tileContact.Remove(col.gameObject);
if (tileContact.Count == 0){
stand = false;
Debug.Log("Exit GroundFixed");
}
break;
case "GroundFlexible":
/*
tileContact.Remove(col.gameObject);
if (tileContact.Count == 0){
stand = false;
Debug.Log("Exit GroundFlexible");
}
*/
break;
case "Pipe":
pipeContact.Remove(col.gameObject);
if (pipeContact.Count == 0){
//dropping = false;
hung = false;
}
break;
case "Ladder":
ladderContact.Remove(col.gameObject);
if (ladderContact.Count == 0){
//dropping = false;
climbing = false;
}
break;
default:
Debug.Log("Triggered with collider " + col.ToString());
break;
}
}
示例14: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
Debug.Log(other.ToString());
}
示例15: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
print ("Trigger Enter Triggered. Other is: " + other.ToString());
if (other.gameObject != null)
{
//If the object we're colliding with is a unitSelection bubble... - Moore
UnitSelection usScript = other.transform.parent.GetComponent<UnitSelection>();
if (usScript != null)
{
//Then we add ourselves to the selection and start following the player. But only if we're not a player.
if (shipType != ShipType.Alpha && shipType != ShipType.Node)
{
CommandHandler.OnCommand += HandleCommandEvent;
UnitSelection.OnDeselect += HandleDeselectEvent;
isSelected = true;
state = State.FollowPlayer;
UpdateStatusIndicator();
}
}
//If the object we're colliding with is a Resonator AoE bubble... - Moore
ResonatorEffectAreaBehavior reab = other.GetComponent<ResonatorEffectAreaBehavior>();
if (reab != null)
{
print ("Trigger Entered. 'Other' is: " + reab.ToString());
reab.OnResonanceChange += SetRateModifer;
print (rateModifier);
}
}
}