本文整理汇总了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> ();
}
示例2: Start
void Start()
{
anim = GetComponent<Animator>();
characterController = GetComponent<CharacterController>();
col = GetComponent<CapsuleCollider>();
}
示例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;
}
示例4: Awake
/*----------------------------------------------------------|
| UNITY METHODS |
|----------------------------------------------------------*/
private void Awake ()
{
charState = GetComponent<RomanCharState>();
animator = GetComponent<Animator>();
rb = GetComponent<Rigidbody>();
cCollider = GetComponent<CapsuleCollider>();
}
示例5: Awake
void Awake()
{
rigidbody.freezeRotation = true;
rigidbody.useGravity = false;
cc = GetComponent<CapsuleCollider>();
//Time.timeScale = 0.25f;
}
示例6: Awake
void Awake()
{
Rigidbody = GetComponent<Rigidbody>();
CapsuleCollider = GetComponent<CapsuleCollider>();
Creature = GetComponent<Creature>();
TargetPosition = transform.position;
}
示例7: Awake
public override void Awake()
{
base.Awake();
beamtf = tf.FindChild("Beam").transform;
ps = tf.FindChild("Particle System").GetComponent<ParticleSystem>();
capsule = gameObject.GetComponent<CapsuleCollider>();
}
示例8: Awake
void Awake()
{
rigidbody = this.GetComponent<Rigidbody>();
mCollider = this.GetComponent<CapsuleCollider>();
rigidbody.freezeRotation = true;
rigidbody.useGravity = false;
}
示例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();
}
示例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> ();
}
示例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;
}
示例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;
}
}
示例13: Start
public override void Start( )
{
m_data = GetComponent<GreenDragonData>();
base.Start();
m_playerTF = player.transform;
m_collider = GetComponent<CapsuleCollider>();
}
示例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;
}
示例15: Awake
private void Awake()
{
_collider = GetComponent<CapsuleCollider>();
Height = _collider.height;
Width = _collider.radius;
BodyBounds = _collider.bounds;
}