当前位置: 首页>>代码示例>>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;未经允许,请勿转载。