当前位置: 首页>>代码示例>>C#>>正文


C# Collider.ToString方法代码示例

本文整理汇总了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.
                }
            }
        }
    }
开发者ID:BlueHuskyStudios,项目名称:TheSeasHaveEyes,代码行数:34,代码来源:EnemySlabBehavior.cs

示例2: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if (GameController.Testing)
     {
         print("Trigger Entered by: " + other.ToString());
     }
 }
开发者ID:BlueHuskyStudios,项目名称:TheSeasHaveEyes,代码行数:7,代码来源:EnemyBoogerBehavior.cs

示例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);
    }
开发者ID:haykath,项目名称:Unity-Runner-Final,代码行数:7,代码来源:ObjectDestroyer.cs

示例4: OnTriggerExit

 void OnTriggerExit(Collider other)
 {
     if (GameController.Testing)
     {
         print("Trigger Left by: " + other.ToString());
     }
 }
开发者ID:BlueHuskyStudios,项目名称:TheSeasHaveEyes,代码行数:7,代码来源:EnemyBoogerBehavior.cs

示例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);
         }
     }
 }
开发者ID:CyberCRI,项目名称:Hero.Coli,代码行数:10,代码来源:EndGameCollider.cs

示例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;
        }
    }
开发者ID:tudorgk,项目名称:unity-build-demo,代码行数:12,代码来源:hitHat.cs

示例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();
        }
    }
开发者ID:rhysp,项目名称:picnic,代码行数:16,代码来源:PlayerController.cs

示例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.
            }
        }
    }
开发者ID:BlueHuskyStudios,项目名称:TheSeasHaveEyes,代码行数:47,代码来源:EnemyBoogerBehavior.cs

示例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);
    }
开发者ID:PetarIvancevic,项目名称:zavrsniRad,代码行数:9,代码来源:CarMovement.cs

示例10: OnTriggerEnter

 void OnTriggerEnter(Collider other) {
   Logger.Log("InfoWindowCollisionTrigger::OnTriggerEnter("+other.ToString()+") _alreadyDisplayed="+_alreadyDisplayed.ToString(), Logger.Level.INFO);
   if(other == heroCollider) {
     displayInfoWindow();
   }
 }
开发者ID:CyberCRI,项目名称:Hero.Coli,代码行数:6,代码来源:InfoWindowCollisionTrigger.cs

示例11: OnTriggerStay

 void OnTriggerStay( Collider other )
 {
     Debug.Log("OnTriggerStay ["+ other.ToString() + "]");
 }
开发者ID:kingstop,项目名称:crashmo,代码行数:4,代码来源:on_Collision_stay.cs

示例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!!!!!";
        }
		 
        
    }
开发者ID:UW-Enlight,项目名称:FirstPersonSnake,代码行数:29,代码来源:SnakeHeadController.cs

示例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;
		}
	}
开发者ID:wangyg0826,项目名称:ttRinHNdZeuvBw,代码行数:44,代码来源:PlayerMovement.cs

示例14: OnTriggerEnter

	void OnTriggerEnter(Collider other)
	{
		Debug.Log(other.ToString());
	}
开发者ID:eaclou,项目名称:Master_CreatureTrainer01,代码行数:4,代码来源:Playground_CollisionTrigger.cs

示例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);
            }
        }
    }
开发者ID:TeamNoContest,项目名称:Resonance,代码行数:30,代码来源:GenericUnitBehavior.cs


注:本文中的Collider.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。