本文整理汇总了C#中UnityEngine.SphereCollider类的典型用法代码示例。如果您正苦于以下问题:C# SphereCollider类的具体用法?C# SphereCollider怎么用?C# SphereCollider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SphereCollider类属于UnityEngine命名空间,在下文中一共展示了SphereCollider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start () {
//instantiating the states
idleState = new Idle (this);
lostState = new Lost (this);
distractedState = new Distracted (this);
chasingState = new Chasing (this);
alertedState = new Alerted (this);
recoverState = new Recover (this);
runState = new Run (this);
scaredState = new Scared (this);
tripState = new Trip (this);
crouchState = new Crouch (this);
//obtain components from the guard
detection = GetComponent<SphereCollider>();
agent = GetComponent<NavMeshAgent>();
anim = GetComponent<Animator>();
//stop rotation of guard when navigating
agent.updateRotation = false;
vision = transform.FindChild("Vision").gameObject; //obtain child object info
startPos = transform.position; //obtain the start position of the guard
//set first state as idle
currentState = idleState;
changeState(State._Idle);
}
示例2: Start
// Use this for initialization
void Start()
{
anim = gameObject.GetComponent<Animation> ();
sc = gameObject.GetComponent<SphereCollider> ();
bc = gameObject.GetComponent<BoxCollider> ();
initSound ();
}
示例3: Start
void Start()
{
print( "Start Sphere spawn area" );
spawnArea = GetComponent<SphereCollider>();
spawnArea.isTrigger = true;
base.Start();
}
示例4: ClothSphereColliderPair
public ClothSphereColliderPair(SphereCollider a, SphereCollider b)
{
this.m_First = null;
this.m_Second = null;
this.first = a;
this.second = b;
}
示例5: Start
void Start()
{
audio = GetComponent<AudioSource>();
player = PlayerHealth.instance;
collider = GetComponentInChildren<SphereCollider>();
anim = GetComponentInChildren<Animator>();
}
示例6: Awake
// Use this for initialization
void Awake()
{
_gameManager = GameObject.FindGameObjectWithTag(Tags.GameManager).GetComponent<GameManager>();
sphereCol = GetComponent<SphereCollider>();
animator = GetComponentInChildren<Animator>();
audioSource = GetComponent<AudioSource>();
}
示例7: Start
void Start()
{
Debug.Log("MagneticUpgrade Starting");
_GameManager = GameManager.instance;
_ScenePlayer = Player.instance;
_coinRangeCollider = GetComponent<SphereCollider>(); ;
if (_GameManager != null)
{
foreach (UpgradeStruct u in _GameManager._allUpgrades)
{
if (u.upgradeGOName == this.name)
{
_UpgradeInfo = u;
u.upgradeScript = this;
Debug.Log("Upgrade Info Found");
}
}
}
foreach (UpgradeValue uv in _UpgradeInfo.upgradeValues)
{
if (uv.upgradeType == UpgradeType.CoinAttractRange)
{
_magnetRadius = uv.value;
_coinRangeCollider.radius = uv.value;
}
else if (uv.upgradeType == UpgradeType.CoinAttractSpeed)
{
_magnetSpeed = uv.value;
}
}
}
示例8: Start
// Use this for initialization
void Start()
{
_explosionRange = this.GetComponent<SphereCollider>();
_mesh = this.GetComponent<MeshRenderer>();
_hasExploded = false;
_explosionRange.enabled = false;
}
示例9: Awake
void Awake()
{
_radientOfsense = gameObject.GetComponent<SphereCollider> ();
player = GameObject.FindWithTag ("Player");
GirlSentence = false;
//personaLastSighting =
}
示例10: Awake
private void Awake()
{
receiver = GetComponent<ControllerWheels>();
sphereCollider = this.GetComponent<SphereCollider>();
//Debug.LogWarning("HARDCODED");
sphereCollider.isTrigger = true;
sphereCollider.radius = 20f;
receiverColliders = GetComponents<Collider>().ToList();
receiverColliders = GetComponentsInChildren<Collider>().ToList();
receiverColliders.ForEach(hC => Physics.IgnoreCollision(sphereCollider, hC));
m_hRigidbody = this.GetComponent<Rigidbody>();
//FSM
idle = new StateIdle(this);
patrol = new StatePatrol(this);
onAir = new StateOnAir(this);
wait = new StateWait(this);
patrol.Idle = idle;
patrol.OnAir = onAir;
onAir.Wait = wait;
wait.Patrol = patrol;
currentState = idle;
currentState.OnStateEnter();
}
示例11: Update
void Update()
{
if(gameObject.GetComponentInParent<weaponIndex>().ammoCount == 0 && !noAmmoBool && !doNotRunAgain){
//Set weapon collider back to unarmed...
col = GameObject.FindGameObjectWithTag ("Player").GetComponentInChildren<SphereCollider> ();
col.enabled = false;
noAmmoBool = true;
nextAttack = Time.time + attackRate; //Prevents auto melee attack on ammo running out
anim.SetTrigger(noAmmoHash);
doNotRunAgain = true;
}
if (Input.GetButton ("Attack") && !Input.GetButton ("Shift") && Time.time > nextAttack && gameObject.GetComponentInParent<weaponIndex>().ammoCount == 0) {
nextAttack = Time.time + attackRate;
//Instantiate (meleeAudio, shotSpawn.position, shotSpawn.rotation);
//Perform attack animation...
anim.SetTrigger(meleeHash);
}
if(playSwing){
Instantiate (meleeAudio, transform.position, transform.rotation);
}
}
示例12: ClothSphereColliderPair
/// <summary>
/// <para>Creates a ClothSphereColliderPair. If only one SphereCollider is given, the ClothSphereColliderPair will define a simple sphere. If two SphereColliders are given, the ClothSphereColliderPair defines a conic capsule shape, composed of the two spheres and the cone connecting the two.</para>
/// </summary>
/// <param name="a">The first SphereCollider of a ClothSphereColliderPair.</param>
/// <param name="b">The second SphereCollider of a ClothSphereColliderPair.</param>
public ClothSphereColliderPair(SphereCollider a)
{
this.m_First = (SphereCollider) null;
this.m_Second = (SphereCollider) null;
this.first = a;
this.second = (SphereCollider) null;
}
示例13: Start
void Start()
{
MiMi = GameObject.FindGameObjectWithTag("MiMi");
B4 = GameObject.FindGameObjectWithTag("B4");
triggerZone = GetComponent<SphereCollider>();
lightSource = GetComponent<Light>();
}
示例14: Start
// Use this for initialization
void Start()
{
collider = GetComponent<SphereCollider> ();
exploded = false;
if (shotType == 0) {
//Bomb
speed = 1f;
damage = 25f;
fullSize = 5f;
timer = Random.Range (5f, 25f);
shotScale = 1f;
gameObject.transform.localScale = new Vector3 (fullSize, fullSize, fullSize);
//Set appearance of Projectile
}
if (shotType == 1) {
//Bullet
speed = -.8f;
damage = 5f;
fullSize = 1f;
timer = 16f;
shotScale = 1f;
//Set appearance of Projectile
}
}
示例15: Start
public override void Start()
{
this.theUnit.triggerTackle = this;
this.triggering = theUnit;
this.collider = this.GetComponent<SphereCollider>();
base.Start();
}