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


C# Collider.GetInstanceID方法代码示例

本文整理汇总了C#中Collider.GetInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C# Collider.GetInstanceID方法的具体用法?C# Collider.GetInstanceID怎么用?C# Collider.GetInstanceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collider的用法示例。


在下文中一共展示了Collider.GetInstanceID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTriggerExit

    //upon exiting the collision status
    void OnTriggerExit(Collider col)
    {
        char side;

        collisionSides.TryGetValue (col.GetInstanceID (), out side);

        collisionSides.Remove (col.GetInstanceID ());

        if(side == 'r')
            Collision_Right = false;
        if(side == 'l')
            Collision_Left = false;
        if(side == 'u')
            Collision_Up = false;
        if(side == 'd')
            Collision_Down = false;

        if (col.gameObject.tag == "floor")
        {
            //	if(maxDiff.z >= 0)
            Collision_Below = false;
        }

        //Debug.Log ("collision exit");
    }
开发者ID:nburo,项目名称:TESTLOL_project,代码行数:26,代码来源:CollisionTrigger.cs

示例2: OnTriggerEnter

 //our ball has landed in the water, lets call the ball bowling pit
 void OnTriggerEnter(Collider col)
 {
     PoolBall pb = col.GetComponent<PoolBall>();
     if (col.CompareTag("Ball"))
     {
         GameManager.Rules.PotBall(pb, m_RefTrigger.PocketIndex);
         Pools.StorageRack.Add(pb);
         if (PocketTrigger.pocketTriggerBallList.Contains(col.GetInstanceID()))
             PocketTrigger.pocketTriggerBallList.Remove(col.GetInstanceID());
     }
 }
开发者ID:y378076136,项目名称:PoolGame-template,代码行数:12,代码来源:PoolRecycler.cs

示例3: OnTriggerEnter

 public void OnTriggerEnter(Collider collider)
 {
     if (collider.tag.Equals("Enemy") && tag.Equals("Player Atk"))
     {
         if (!m_targetDatas.ContainsKey(collider.GetInstanceID()))
             m_targetDatas.Add(collider.GetInstanceID(), collider.GetComponent<BaseData>());
     }
     else if (collider.tag.Equals("Player") && tag.Equals("Enemy Atk"))
     {
         if (!m_targetDatas.ContainsKey(collider.GetInstanceID()))
             m_targetDatas.Add(collider.GetInstanceID(), PlayerData.GetInstance());
     }
 }
开发者ID:10123815,项目名称:Diabloo,代码行数:13,代码来源:FireSprayEffect.cs

示例4: OnTriggerStay

 void OnTriggerStay(Collider other)
 {
     if (other.GetInstanceID() == Pinky.GetComponent<Collider>().GetInstanceID())
     {
         target.position = Pinky.position;
     }
 }
开发者ID:CaptainAubergine,项目名称:Boboballs,代码行数:7,代码来源:RedDetectsPinky.cs

示例5: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        if(other.transform.CompareTag("Planet")){
            /* If the planet has been already destroyed do nothing. */
            if(((PlanetScript) other.GetComponent("PlanetScript")).isDestroyed())
                return;
            /* Set the status of the planet to 0 => Planet destroyed. */
            ((PlanetScript) other.GetComponent("PlanetScript")).setDestroyed();

            /* Update the score. */
            GameObject.Find("Controller").GetComponent<ControllerScript>().updateScore(-other.rigidbody.mass
                       * other.GetComponent<PlanetScript>().getPlanetPoints());
            foreach(GameObject star in GameObject.FindGameObjectsWithTag("Star")){
                    star.GetComponent<StarScript>().removeOrbitantPlanet(other.GetInstanceID());
                    star.GetComponent<StarScript>().updateMultiplier();
            }
            Debug.Log("Score:" + GameObject.Find("Controller").GetComponent<ControllerScript>().getScore());

            /* Get the Detonator script component */
            Detonator det = (Detonator) other.GetComponent("Detonator");
            /* Call Explode method defined in Detonator script. Simply show an explosion. */
            det.Explode();
            /* Play an explosion sound. */
            other.GetComponent<AudioSource>().Play();
            /*Adds the planet mass to the star mass*/
            rigidbody.mass += other.rigidbody.mass;
            /* Destroy the rigidboy of the collided planet. In this way it is no more subject to forces
               and has no speed. */
            Destroy(other.rigidbody);
            /* Hide the collided planet. */
            other.transform.position = transform.position;
            /* Destroy the game object of the planet. */
            Destroy(other.gameObject, 3);
        }
    }
开发者ID:Kariddi,项目名称:Revolution--The-game,代码行数:35,代码来源:StarScript.cs

示例6: OnTriggerStay

 public void OnTriggerStay(Collider collider)
 {
     int id = collider.GetInstanceID();
     if (m_targetDatas.ContainsKey(id))
     {
         m_targetDatas[id].Damaged(fireAtk * Time.deltaTime);
     }
 }
开发者ID:10123815,项目名称:Diabloo,代码行数:8,代码来源:FireSprayEffect.cs

示例7: Broadcast

 protected virtual IEnumerator Broadcast(Collider other)
 {
     while (other)
     {
         Messenger.Broadcast(m_message.ToLower() + other.GetInstanceID(), other.name);
         yield return new WaitForSeconds(m_timer);
     }
 }
开发者ID:QuintonBaudoin,项目名称:PAX,代码行数:8,代码来源:BroadcastOnTriggerStay.cs

示例8: OnTriggerExit

 public void OnTriggerExit(Collider collider)
 {
     int id = collider.GetInstanceID();
     if (m_targetDatas.ContainsKey(id))
     {
         m_targetDatas.Remove(id);
     }
 }
开发者ID:10123815,项目名称:Diabloo,代码行数:8,代码来源:FireSprayEffect.cs

示例9: OnTriggerEnter

	void OnTriggerEnter(Collider other) {
		touchBendingPlayerListener tempPlayerVars = other.GetComponent<touchBendingPlayerListener>();
		// register touch only if collider has the touchBendingPlayerListener script attached and enabled
		if( tempPlayerVars != null && tempPlayerVars.enabled) {
			// no other touch event registered
			if (!touched) {
				//register gameobject ID
				Player_ID = other.GetInstanceID();
				
				Destroy(myRenderer.material);
				
				PlayerVars = tempPlayerVars;
				Player_Direction = PlayerVars.Player_Direction;
				Player_Speed = PlayerVars.Player_Speed;
				intialTouchForce = Player_Speed;
				
				// instantiate mat
				myRenderer.material = touchBendingMaterial;
				myRenderer.material.SetVector("_TouchBendingPosition", new Vector4(myTransform.position.x, myTransform.position.y, myTransform.position.z, 0f) );
				
				axis = PlayerVars.Player_Direction;
				// rotate by 90
				axis = Quaternion.Euler(0,90,0) * axis;
				
				timer = 0.0f;
				touched = true;
				left = false;
				targetTouchBending = 1.0f;
				touchBending = targetTouchBending;
				finished = false;
			}
			else {
				/// 2nd+ touch: we simply drop the first registered collision
				if ( doubletouched == true ) {
					SwapTouchBending ();	
				}
				//register gameobject ID
				Player1_ID = other.GetInstanceID();
				
				PlayerVars1 = tempPlayerVars;
				Player_Direction1 = PlayerVars1.Player_Direction;
				Player_Speed1 = PlayerVars1.Player_Speed;
				intialTouchForce1 = Player_Speed1;
				
				axis1 = Player_Direction1;
				// rotate by 90
				axis1 = Quaternion.Euler(0,90,0) * axis1;
				
				timer1 = 0.0f;
				left1 = false;
				targetTouchBending1 = 1.0f;
				touchBending1 = targetTouchBending1;
				finished1 = false;
				lerptime = duration - timer;
				doubletouched = true;
			}
		}
	}
开发者ID:DarkestDeeps,项目名称:DarkestDeeps,代码行数:58,代码来源:touchBendingCollisionGS.cs

示例10: OnTriggerEnter

	void OnTriggerEnter(Collider col)
    {
        if ((mask.value & 1 << col.gameObject.layer) == 1 << col.gameObject.layer)
        {
            GameObject toAdd = CreateEffect(col.transform);
            toAdd.transform.SetParent(col.transform);
            toAdd.transform.localRotation = Quaternion.Euler(new Vector3(90f, 0f, 0f));
            effects.Add(col.GetInstanceID(), toAdd);
        }
    }
开发者ID:S4D3H,项目名称:ProjectJanitor,代码行数:10,代码来源:ExaGround.cs

示例11: OnTriggerEnter

 void OnTriggerEnter(Collider mob)
 {
     if (mob.gameObject.CompareTag("Creep"))
     {
         for (int i = 0; i < 100; i++)
         {
             if (targetStack[i] != null && targetStack[i].GetInstanceID() == mob.GetInstanceID()) return;
         }
         StackPush(mob.gameObject);
     }
 }
开发者ID:selu285-2015,项目名称:285_02_FA15G2,代码行数:11,代码来源:TikiTower.cs

示例12: OnTriggerEnter

    protected override void OnTriggerEnter(Collider other)
    {
        var direction = other.transform.position - transform.position;
        var ray = new Ray(transform.position, direction);
        RaycastHit firstRayHit;

        if (TriggerEntered != null && Physics.Raycast(ray, out firstRayHit) && firstRayHit.collider.GetInstanceID() == other.GetInstanceID())
        {
            Debug.Log("firstRayHit.collider: " + firstRayHit.collider + "other.collider: " + other);
            TriggerEntered(other.gameObject);
        }
    }
开发者ID:robinpan,项目名称:bear_minimum,代码行数:12,代码来源:CharacterVisionController.cs

示例13: OnTriggerStay

	void OnTriggerStay(Collider csi) 
	{
		int id=csi.GetInstanceID();
		//if(id!=this.GetInstanceID())
		{
			DefBoxCtl dbc=csi.GetComponent<DefBoxCtl>();

			
			Vector3 v3=(transform.parent.localPosition-csi.transform.parent.localPosition);
			
			dbc.f.CombineF(-v3.normalized*10f);
		//	Debug.Log(csi.name);
		}
	}
开发者ID:TowerSay,项目名称:Tower,代码行数:14,代码来源:DefBoxCtl.cs

示例14: AOE

 protected void AOE(Collider collider)
 {
     int id = collider.GetInstanceID();
     if (!m_targets.ContainsKey(id))
     {
         BaseData data = collider.GetComponent<BaseData>();
         if (data != null)
             m_targets.Add(collider.GetInstanceID(), data);
         else
         {
             Debug.LogError("BaseData is not found!");
         }
     }
     if (m_targets[id].curLife > 0)
     {
         m_targets[id].Damaged((atk + PlayerData.GetInstance().GetAttributeValue(fuckRPGLib.GameCode.BasicAttributeName.Intelligence) * 5) * Time.deltaTime);
         if (m_targets[id].curLife <= 0)
         {
             PlayerData.GetInstance().GainExp(m_targets[id].valueExp);
             PlayerData.GetInstance().gold += m_targets[id].valueGold;
         }
     }
 }
开发者ID:10123815,项目名称:Diabloo,代码行数:23,代码来源:BaseAOE.cs

示例15: OnTriggerExit

    void OnTriggerExit(Collider col)
    {
        if ((mask.value & 1 << col.gameObject.layer) == 1 << col.gameObject.layer)
        {
            int id = col.GetInstanceID();

            if (effects.ContainsKey(id))
            {
                GameObject toRemove = effects[id];
                effects.Remove(id);
                Destroy(toRemove);
            } 
        }
    }
开发者ID:S4D3H,项目名称:ProjectJanitor,代码行数:14,代码来源:ExaGround.cs


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