當前位置: 首頁>>代碼示例>>C#>>正文


C# UnityEngine.CapsuleCollider類代碼示例

本文整理匯總了C#中UnityEngine.CapsuleCollider的典型用法代碼示例。如果您正苦於以下問題:C# CapsuleCollider類的具體用法?C# CapsuleCollider怎麽用?C# CapsuleCollider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CapsuleCollider類屬於UnityEngine命名空間,在下文中一共展示了CapsuleCollider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Awake

	void Awake ()
	{
		capsuleCollider = GetComponent <CapsuleCollider> ();
		currentHealth = startingHealth;
		hitParticles = GetComponentInChildren <ParticleSystem> ();
		animator = GetComponent<Animator> ();
	}
開發者ID:klemen-skoda,項目名稱:RGTI-2016-unity-game,代碼行數:7,代碼來源:enemyHP.cs

示例2: Start

    void Start()
    {
        anim = GetComponent<Animator>();
        characterController = GetComponent<CharacterController>();

        col = GetComponent<CapsuleCollider>();
    }
開發者ID:kodemax,項目名稱:Medieval_Riots,代碼行數:7,代碼來源:CharacterMovementController.cs

示例3: Awake

    void Awake()
    {
        skeletonManager = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager;
        if(skeletonController != null)
            playerId = skeletonController.playerId;
        else
            Debug.LogError(   "The public variable 'Skeleton Controller' is not assigned! Using skeleton "
                            + "ID 0 as the pivot source.");

        if(gameObject.transform.parent != null)
        {
            if(gameObject.transform.parent.GetComponentInChildren<RUISKinectAndMecanimCombiner>())
                kinectAndMecanimCombinerExists = true;
        }

        capsuleCollider = GetComponent<CapsuleCollider>();
        if(capsuleCollider == null)
            Debug.LogError("GameObject " + gameObject.name + " must have a CapsuleCollider!");
        defaultColliderHeight = capsuleCollider.height;
        defaultColliderPosition = transform.localPosition;

        positionKalman = new KalmanFilter();
        positionKalman.initialize(3,3);
        positionKalman.skipIdenticalMeasurements = true;
    }
開發者ID:Zerphed,項目名稱:miscellaneous,代碼行數:25,代碼來源:RUISCharacterStabilizingCollider.cs

示例4: Awake

	/*----------------------------------------------------------|
	| UNITY METHODS	      		    	                        |
	|----------------------------------------------------------*/

	private void Awake ()
	{
		charState = GetComponent<RomanCharState>();
		animator = GetComponent<Animator>();
		rb = GetComponent<Rigidbody>();
		cCollider = GetComponent<CapsuleCollider>();
	}
開發者ID:pencilking2002,項目名稱:TOF_Movement_Protype,代碼行數:11,代碼來源:LandingController.cs

示例5: Awake

 void Awake()
 {
     rigidbody.freezeRotation = true;
     rigidbody.useGravity = false;
     cc = GetComponent<CapsuleCollider>();
     //Time.timeScale = 0.25f;
 }
開發者ID:wow4all,項目名稱:Scripts,代碼行數:7,代碼來源:CharacterControls.cs

示例6: Awake

 void Awake()
 {
     Rigidbody = GetComponent<Rigidbody>();
     CapsuleCollider = GetComponent<CapsuleCollider>();
     Creature = GetComponent<Creature>();
     TargetPosition = transform.position;
 }
開發者ID:eduardolm87,項目名稱:thingseatthingsjam,代碼行數:7,代碼來源:Locomotor.cs

示例7: Awake

 public override void Awake()
 {
     base.Awake();
     beamtf = tf.FindChild("Beam").transform;
     ps = tf.FindChild("Particle System").GetComponent<ParticleSystem>();
     capsule = gameObject.GetComponent<CapsuleCollider>();
 }
開發者ID:spi8823,項目名稱:Sudenona,代碼行數:7,代碼來源:TestBeamBulletScript.cs

示例8: Awake

 void Awake()
 {
     rigidbody = this.GetComponent<Rigidbody>();
     mCollider = this.GetComponent<CapsuleCollider>();
     rigidbody.freezeRotation = true;
     rigidbody.useGravity = false;
 }
開發者ID:windywyll,項目名稱:test3D,代碼行數:7,代碼來源:RigiBodyController.cs

示例9: Awake

 public void Awake()
 {
     capsule = GetComponent<Collider>() as CapsuleCollider;					// Set up a reference to the capsule collider.
     grounded = true;
     Cursor.lockState = (lockCursor)?(CursorLockMode.Locked):(CursorLockMode.None);
     rayHitComparer = new RayHitComparer();
 }
開發者ID:evan-erdos,項目名稱:pathways,代碼行數:7,代碼來源:FirstPersonCharacter.cs

示例10: Start

	void Start ()
	{
		if (GameManager.componentActivatorOn) 
		{
			ComponentActivator.Instance.Register (this, new Dictionary<GameEvent, bool> { 

				//{ GameEvent.Land, true },
				{ GameEvent.ClimbOverEdge, true },
				{ GameEvent.StopClimbing, true },
				{ GameEvent.FinishClimbOver, true },
				//{ GameEvent.Land, true },

				//{ GameEvent.LandedFirstTime, false },
				{ GameEvent.StartVineClimbing, false }, 
				{ GameEvent.StartEdgeClimbing, false },
				{ GameEvent.StartWallClimbing, false }

			});
		}

		charState = GetComponent<RomanCharState>();
		animator = GetComponent<Animator>();
		rb = GetComponent<Rigidbody>();
		cam = Camera.main.transform;
		cController = GetComponent<CharacterController>();
		cCollider = GetComponent<CapsuleCollider>();
		vineClimbCollider = GetComponent<VineClimbController2>();
		tunnelObserver = GameManager.Instance.tunnelObserver;
		combatController = GetComponent<CombatController> ();
	}
開發者ID:pencilking2002,項目名稱:TOF_Movement_Protype,代碼行數:30,代碼來源:RomanCharController.cs

示例11: Start

    // Use this for initialization
    void Start () {
	    if(monsterCollider == null)
        {
            monsterCollider = GetComponent<CapsuleCollider>();
            if(monsterCollider ==null)
            {
                monsterCollider = new CapsuleCollider();
            }
        }

        spellInstances = new Spell[spells.Length];
        for(int i = 0; i < spellInstances.Length; i++)
        {
            if(spells[i] != null)
            {
                spellInstances[i] = Instantiate<Spell>(spells[i]);
                spellInstances[i].Initialize(gameObject);
            }
            
        }

        monsterHP = monsterMaxHP;
        startPos = transform.position;
        isAlive = true;
	}
開發者ID:BaptisteMarechaux,項目名稱:Blow-Game-2016,代碼行數:26,代碼來源:MonsterCharacter.cs

示例12: SubInitializeAboutProperties

	private void SubInitializeAboutProperties(string kind){
		switch(kind){	
			case "KIND1":
				velocity = new Vector3(-200.0f, 0, 0);
				//sprite = GameObject.Instantiate(spritePrefabs) as SingleSprite_;
				sprite.transform.parent = transform;
				//sprite.Initialize("EnemyFish");
				col = transform.collider as CapsuleCollider;
				col.radius = 45.0f;
				col.height = 220.0f;
				col.direction = 0;
			break;
				
			case "KIND2":
				velocity = new Vector3(-100.0f, 0, 0);
				//sprite = GameObject.Instantiate(spritePrefabs) as SingleSprite_;
				sprite.transform.parent = transform;
				//sprite.Initialize("EnemyFish");
				col = transform.collider as CapsuleCollider;
				col.radius = 80.0f;
				col.height = 200.0f;
				col.direction = 0;
			break;
		}
	}
開發者ID:21garam,項目名稱:SW_Maestro,代碼行數:25,代碼來源:EnemyFish_.cs

示例13: Start

 public override void Start( )
 {
     m_data = GetComponent<GreenDragonData>();
     base.Start();
     m_playerTF = player.transform;
     m_collider = GetComponent<CapsuleCollider>();
 }
開發者ID:10123815,項目名稱:Diabloo,代碼行數:7,代碼來源:GreenDragonAction.cs

示例14: Awake

	void Awake()
	{
		capsule = GetComponent<CapsuleCollider>();
		grabTriggerCol = GetComponent<BoxCollider>();
		anim = GetComponent<Animator> ();
		_charStatus = GetComponent<CharacterStatus> ();
		_charAttacking = GetComponent<CharacterAttacking> ();
		_charAI = GetComponent<CharacterAI> ();
        if (!IsEnemy)
        {
            _playerInput = GetComponent<PlayerInput>();
            //_playerInputMobile = GetComponent<PlayerInputMobile>();
        }
		// I use these since when we have low health, we will move a bit slower.
		// When we get more than 25% health again, we will go back to our
		// default speeds for these.
		defaultAirSpeed = airSpeed;
		m_Loco_0Id = Animator.StringToHash ("Base Layer.Locomotion");
		m_Loco_1Id = Animator.StringToHash ("LowHealth.Locomotion");
		myRigidbody = GetComponent<Rigidbody> ();
		if (!grabTriggerCol)
			Debug.LogWarning("PLEASE ASSIGN YOUR Player's GRAB TRIGGER COLLIDER");
		else
			grabTriggerCol.enabled = false;
	}
開發者ID:MMEstrada,項目名稱:GoGoGrandmas,代碼行數:25,代碼來源:CharacterMotor.cs

示例15: Awake

 private void Awake()
 {
     _collider = GetComponent<CapsuleCollider>();
     Height = _collider.height;
     Width = _collider.radius;
     BodyBounds = _collider.bounds;
 }
開發者ID:fuboss,項目名稱:aiProject,代碼行數:7,代碼來源:Body.cs


注:本文中的UnityEngine.CapsuleCollider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。