本文整理汇总了C#中UnityEngine.CapsuleCollider类的典型用法代码示例。如果您正苦于以下问题:C# CapsuleCollider类的具体用法?C# CapsuleCollider怎么用?C# CapsuleCollider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CapsuleCollider类属于UnityEngine命名空间,在下文中一共展示了CapsuleCollider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Awake
void Awake()
{
sSm = this.gameObject.transform.localScale;
sSm = new Vector3 (sSm.x, sSm.y, sSm.z);
refT = this.GetComponent<CapsuleCollider> ();
sRcc = refT.radius;
}
开发者ID:BlueWizardGames,项目名称:SwanSong,代码行数:7,代码来源:ShieldHit.cs
示例17: Awake
void Awake()
{
col1 = p1.GetComponent <CapsuleCollider> ();
col2 = p2.GetComponent <CapsuleCollider> ();
col3 = p3.GetComponent <CapsuleCollider> ();
col4 = p4.GetComponent <CapsuleCollider> ();
}
开发者ID:Drakeny,项目名称:GameJam,代码行数:7,代码来源:Switch_party.cs
示例18: Start
void Start()
{
m_EquipShopPanel = GameObject.Find("MainUICanvas/EquipShopPanel").GetComponent<EquipShopPanel>();
m_Collider = GetComponent<CapsuleCollider>();
m_MousePos = new Vector3();
}
开发者ID:spiritpig,项目名称:3DGame,代码行数:7,代码来源:WeaponShopControl.cs
示例19: Awake
void Awake()
{
enemyScrpt = this.GetComponent<smallEnemy>();
sensor = new GameObject("sensor");
sensor.transform.SetParent(this.transform);
sensor.transform.position = this.transform.position;
DetectorChild childScript = sensor.gameObject.AddComponent<DetectorChild>();
childScript.debug_ColCheckOff = debug_ColCheckOff; // TEMP DEBUG ADITION
sensor.layer = 2;
rB = sensor.AddComponent<Rigidbody>();
rB.useGravity = false;
rB.constraints = RigidbodyConstraints.FreezeAll;
if(GetComponentInParent<smallEnemy>().movementType == smallEnemy.MovementType.A)
{
detSphere = sensor.AddComponent<SphereCollider>();
detSphere.radius = sensorDistance;
detSphere.isTrigger = true;
Physics.IgnoreCollision(detSphere, this.GetComponent<Collider>());
}
else if(GetComponentInParent<smallEnemy>().movementType == smallEnemy.MovementType.B || GetComponentInParent<smallEnemy>().movementType == smallEnemy.MovementType.C)
{
detCap = sensor.AddComponent<CapsuleCollider>();
detCap.radius = sensorDistance;
detCap.height = capsuleWidth*2;
detCap.direction = 2;
Physics.IgnoreCollision(detCap, this.GetComponent<Collider>());
}
}
开发者ID:RobertLP,项目名称:PortfolioCode,代码行数:32,代码来源:Detector.cs
示例20: Initialize
public virtual void Initialize(int i_Health_Max_, float f_FireTimer_Max_, GameObject go_ParentBoxCollider_, BoxCollider col_BaseCollider_ = null, CapsuleCollider col_RadiusCollider_ = null)
{
i_Health = i_Health_Max_;
i_Health_Max = i_Health_Max_;
go_GridObject_Parent = go_ParentBoxCollider_;
b_IsDead = false;
// Material newMat = Resources.Load("DEV_Orange", typeof(Material)) as Material;
SetMaterialElements();
SetNewMaterialColor(Colors.Default);
f_FireTimer = 0;
f_FireTimer_Max = f_FireTimer_Max_;
if (col_BaseCollider_ != null) col_BaseCollider = col_BaseCollider_; else
{
if (gameObject.transform.Find("Col_BaseCollider")) col_BaseCollider = gameObject.transform.Find("Col_BaseCollider").GetComponent<BoxCollider>();
}
if(col_RadiusCollider_ != null) col_RadiusCollider = col_RadiusCollider_; else
{
if (gameObject.transform.Find("Col_Radius")) col_RadiusCollider = gameObject.transform.Find("Col_Radius").GetComponent<CapsuleCollider>();
}
EnemyList = new List<GameObject>();
}
开发者ID:ChrisCrossed,项目名称:CodeExamples,代码行数:27,代码来源:Cs_DefaultBase.cs
注:本文中的UnityEngine.CapsuleCollider类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论