• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.SphereCollider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnityEngine.SphereCollider的典型用法代码示例。如果您正苦于以下问题:C# SphereCollider类的具体用法?C# SphereCollider怎么用?C# SphereCollider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SphereCollider类属于UnityEngine命名空间,在下文中一共展示了SphereCollider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);

    }
开发者ID:OliviaVespera,项目名称:Assets,代码行数:33,代码来源:FSM.cs


示例2: Start

 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent<Animation> ();
     sc = gameObject.GetComponent<SphereCollider> ();
     bc = gameObject.GetComponent<BoxCollider> ();
     initSound ();
 }
开发者ID:hanric,项目名称:runnerVJ,代码行数:8,代码来源:SpiderWorm.cs


示例3: Start

 void Start()
 {
     print( "Start Sphere spawn area" );
     spawnArea = GetComponent<SphereCollider>();
     spawnArea.isTrigger = true;
     base.Start();
 }
开发者ID:MashGames,项目名称:Flourny,代码行数:7,代码来源:SphereAreaSpawner.cs


示例4: ClothSphereColliderPair

 public ClothSphereColliderPair(SphereCollider a, SphereCollider b)
 {
     this.m_First = null;
     this.m_Second = null;
     this.first = a;
     this.second = b;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:ClothSphereColliderPair.cs


示例5: Start

 void Start()
 {
     audio = GetComponent<AudioSource>();
     player = PlayerHealth.instance;
     collider = GetComponentInChildren<SphereCollider>();
     anim = GetComponentInChildren<Animator>();
 }
开发者ID:PuddingLaterne,项目名称:Floptopus,代码行数:7,代码来源:Health.cs


示例6: Awake

 // Use this for initialization
 void Awake()
 {
     _gameManager = GameObject.FindGameObjectWithTag(Tags.GameManager).GetComponent<GameManager>();
     sphereCol = GetComponent<SphereCollider>();
     animator = GetComponentInChildren<Animator>();
     audioSource = GetComponent<AudioSource>();
 }
开发者ID:choang05,项目名称:Puzzle-2,代码行数:8,代码来源:Chick.cs


示例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;
         }
     }
 }
开发者ID:TheWarriorPoet,项目名称:Pirate-Life,代码行数:31,代码来源:MagneticUpgrade.cs


示例8: Start

 // Use this for initialization
 void Start()
 {
     _explosionRange = this.GetComponent<SphereCollider>();
     _mesh = this.GetComponent<MeshRenderer>();
     _hasExploded = false;
     _explosionRange.enabled = false;
 }
开发者ID:danysousa,项目名称:pointAndClick,代码行数:8,代码来源:TzarBomb.cs


示例9: Awake

 void Awake()
 {
     _radientOfsense = gameObject.GetComponent<SphereCollider> ();
     player = GameObject.FindWithTag ("Player");
     GirlSentence = false;
     //personaLastSighting =
 }
开发者ID:sirlightsmile,项目名称:thesis,代码行数:7,代码来源:EnemySight.cs


示例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();
    }
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:28,代码来源:ProviderAIWheels.cs


示例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);
        }
    }
开发者ID:ScopatGames,项目名称:ShojiSplice,代码行数:25,代码来源:MeleeInfo.cs


示例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;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:12,代码来源:ClothSphereColliderPair.cs


示例13: Start

 void Start()
 {
     MiMi = GameObject.FindGameObjectWithTag("MiMi");
     B4 = GameObject.FindGameObjectWithTag("B4");
     triggerZone = GetComponent<SphereCollider>();
     lightSource = GetComponent<Light>();
 }
开发者ID:PatrikkSorensen,项目名称:GAMEDEV2016,代码行数:7,代码来源:EnemyLightScript.cs


示例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
                }
    }
开发者ID:jgarcy1080,项目名称:StompCurrentBuild,代码行数:27,代码来源:PlaneShot.cs


示例15: Start

 public override void Start()
 {
     this.theUnit.triggerTackle = this;
     this.triggering = theUnit;
     this.collider = this.GetComponent<SphereCollider>();
     base.Start();
 }
开发者ID:sylafrs,项目名称:rugby,代码行数:7,代码来源:NearUnit.cs


示例16: Start

    //Vector3 eulerAngleVelocity;

    // Use this for initialization
    void Start()
    {

        rb = GetComponent<Rigidbody>();
        sph = GetComponent<SphereCollider>();

    }
开发者ID:s4mmc,项目名称:BallGameProto,代码行数:10,代码来源:PlayerControls.cs


示例17: Awake

    void Awake()
    {
        unit = GetComponent<Unit>();
        sphereCol = GetComponent<SphereCollider>();

        attackTimer = unit.attackInterval;
    }
开发者ID:KennyDBacon,项目名称:FYP-Personal,代码行数:7,代码来源:Tower.cs


示例18: Awake

    // Use this for initialization
    void Awake()
    {
        // initialize variables
        //size = GetComponent<Renderer>().size;

        // initially false
        santaInSight = false;

        gameController = GetComponent<GameController>();
        anim = GetComponent<Animator>();
        nav = GetComponent<NavMeshAgent>();
        col = GetComponent<SphereCollider>();

        // Get reference to Santa
        santa = GameObject.FindWithTag("Player");

        // initially set vision to true
        checkVision = true;

        // Ignore layer 2. Layer 2 is default layer provided by unity which is Ignore Raycast
        layerMask = 1 << 2;
        layerMask = ~layerMask;

        // initialize ray position
        // slightly above ground level
        rayPos1 = new Vector3(0, 0.5f, 0);
    }
开发者ID:gdsl,项目名称:SOFTENG-306-PROJECT-2,代码行数:28,代码来源:PersonSight.cs


示例19: Awake

 private void Awake()
 {
     triggerCollider = GetComponent<SphereCollider>();
     triggerCollider.enabled = Enabled;
     tracker = GetComponentInChildren<CollectibleTracker>();
     SceneManager.CollectibleCount++;
 }
开发者ID:talford2,项目名称:Destroy2,代码行数:7,代码来源:Collectible.cs


示例20: Awake

 void Awake()
 {
     detectionZone = GetComponent<SphereCollider>();
     rigidbody = GetComponent<Rigidbody>();
     playerStats = References.player.GetComponent<PlayerStats>();
     References.stateManager.changeState += onChangeState;
 }
开发者ID:B-LiTE,项目名称:MemeTeam,代码行数:7,代码来源:ArrowTargetting.cs



注:本文中的UnityEngine.SphereCollider类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.Sprite类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.SkinnedMeshRenderer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap