当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.CircleCollider2D类代码示例

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


CircleCollider2D类属于UnityEngine命名空间,在下文中一共展示了CircleCollider2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 // Use this for initialization
 void Start()
 {
     currRadius = 0f;
     circleCollider = GetComponent<CircleCollider2D>();
     circleCollider.radius = currRadius;
     Instantiate(shockwaveFXPrefab, transform.position, Quaternion.identity);
 }
开发者ID:MangoSister,项目名称:Doot-Doot-Cat,代码行数:8,代码来源:Shockwave.cs

示例2: Awake

 void Awake()
 {
     transform = GetComponent<Transform>();
     Gravity = GetComponent<CircleCollider2D>();
     _player = GameObject.FindGameObjectWithTag("Player").GetComponent<LookAtMouseMove>();
    
 }
开发者ID:GCBox,项目名称:WouldUConquer,代码行数:7,代码来源:Planet_Gravity.cs

示例3: Start

 public void Start()
 {
     findedEnemys = new List<BaseEnemy>();
     _player = transform.parent.GetComponent<Player>();
     _collider = transform.GetComponent<CircleCollider2D>();
     _baseRadius = _collider.radius;
 }
开发者ID:teamzeroth,项目名称:retroboy,代码行数:7,代码来源:EnemiesRadar.cs

示例4: IgnoreCollisions

 public void IgnoreCollisions(CircleCollider2D coll)
 {
     foreach (Transform child in transform)
     {
         Physics2D.IgnoreCollision(child.GetComponent<BoxCollider2D>(), coll);
     }
 }
开发者ID:vernw,项目名称:Torque2D,代码行数:7,代码来源:WallController.cs

示例5: Awake

    void Awake()
    {
        rigidbody = GetComponent<Rigidbody2D>();
        body = GetComponent<PolygonCollider2D>();
        feet = GetComponent<CircleCollider2D>();
        health = GetComponent<Health>();
        standing = body.points;
        crouched = new Vector2[standing.Length];
        grounded = false;
        onWall = false;
        upSlope = false;
        downSlope = false;

        int min = 0;
        for (int i = 0; i < standing.Length; i++)
        {
            if (standing[i].y < standing[min].y)
                min = i;
        }
        for (int i = 0; i < standing.Length; i++)
        {
            float newY = (standing[i].y - standing[min].y) * 0.5f + standing[min].y;
            crouched[i] = new Vector2(standing[i].x, newY);
        }
    }
开发者ID:pueblak,项目名称:ProjectDarkZone,代码行数:25,代码来源:PlayerController.cs

示例6: IsOverLappingWithAnother

	private bool IsOverLappingWithAnother(CircleCollider2D col){
		Collider2D[] colliders = FindObjectsOfType<Collider2D>();

		float checkGap = 0.1f;

		int ySign = 1;
		foreach(Collider2D testCol in colliders){
			if (testCol.gameObject != col.gameObject){
				for (int i = 1; i <= 2; i++){

					for (float x = col.transform.position.x - col.radius; x <= col.transform.position.x + col.radius; x += checkGap){
						Vector2 checkPoint = new Vector2(x, ySign * Mathf.Sqrt(Mathf.Pow(col.radius,2) - Mathf.Pow((x - col.transform.position.x ),2)) + col.transform.position.y);
						Debug.Log("PIE");
						if (testCol.OverlapPoint(checkPoint)){
							return true;
						}
							
					}
					ySign = -1;
				}
			}

		}
		return false;
	}
开发者ID:james-sullivan,项目名称:StickeyBallGame,代码行数:25,代码来源:PrintINtersection.cs

示例7: Start

	// Use this for initialization
	void Start () {
        rbody = GetComponent<Rigidbody2D>();
        collider = GetComponent<CircleCollider2D>();
        selectorRenderer = selector.GetComponent<SpriteRenderer>();
        selectorRenderer.enabled = false;
        charController = GameObject.FindWithTag("Player").GetComponent<CharacterController>();
    }
开发者ID:mvancompernolle,项目名称:Cyber-Monday,代码行数:8,代码来源:InteractionController.cs

示例8: Awake

 // Use this for initialization
 protected override void Awake()
 {
     base.Awake();
     vfx = GetComponent<ParticleSystem>();
     coll = GetComponent<CircleCollider2D>();
     effector = GetComponent<PointEffector2D>();
 }
开发者ID:AlbearKamoo,项目名称:Witches-vs-Aliens-2015-2016,代码行数:8,代码来源:PushAbilityCircle.cs

示例9: Awake

 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigid2d = GetComponent<Rigidbody2D>();
     collider2d = GetComponent<CircleCollider2D>();
     catapult = spring.connectedBody.transform;
 }
开发者ID:dogwynn,项目名称:AngryMeteor,代码行数:7,代码来源:ProjectileDragging.cs

示例10: Start

    // Use this for initialization
    public override void Start()
    {
        base.Start();

        exploded = false;
        explosionRadius = gameObject.GetComponent<CircleCollider2D>();
    }
开发者ID:BrockyBoi,项目名称:Block-buster-mobile-game,代码行数:8,代码来源:FrezeBlockScript.cs

示例11: charge

 void charge()
 {
     numShots = 0;
     if (chargedShot==null) {
         charge_anim.SetBool("charge", true);
         chargedShot = Instantiate (gun.bullet, gun.firingLocation.position, Quaternion.identity) as Rigidbody2D;
         chargedShot.gameObject.SetActive(true);
         chargedCollider = chargedShot.GetComponent<CircleCollider2D>();
         chargedCollider.enabled = false;// disable the collider first
         script = chargedShot.GetComponent<BulletScript>(); // assign the script
         if (master.shipMode){
             chargedShot.rotation = 90; // 270 degrees means facing north
         }
         else {
             master.setCharge(1f); // set 'charging' layer to activate
         }
         chargedShot.GetComponent<SpriteRenderer>().enabled = false;
     } else { //if (chargeLevel<=totalCharge)
         Vector3 size = chargedShot.transform.localScale;
         chargedShot.transform.localScale = new Vector3(size.x*1.5f, size.y*1.5f, 1f);
         script.damage = script.damage*2;
     }
     // make the charged shot stronger
     chargeLevel++;
 }
开发者ID:Vylantze,项目名称:Chaos-Children,代码行数:25,代码来源:Charge.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     col = GetComponent<CircleCollider2D>();
     men = GameObject.Find("Menu");
     win = new Window(new Vector4((Screen.width - 100)/2,(Screen.height - 100)/2, 100, 100));
     script = men.GetComponent<Menu>();
 }
开发者ID:JoeyKanaly,项目名称:todoUnity,代码行数:8,代码来源:AddTask.cs

示例13: Start

 void Start()
 {
     //moveVector = new Vector2(;
     col = GetComponent<CircleCollider2D> ();
     anim = GetComponent<Animator> ();
     //test arguments
 }
开发者ID:campbellcompton,项目名称:Disasteroids,代码行数:7,代码来源:Bullet.cs

示例14: Start

		// Use this for initialization
		void Start () {
			particles = GetComponent<ParticleSystem>();
			circleColider = GetComponent <CircleCollider2D>();
			animator = GetComponent<Animator>();

			timeToRespawn = timeToRespawn + Random.Range ( timeToRespawn * 0.96f , timeToRespawn * 1.04f);
		}
开发者ID:Kundara,项目名称:project1,代码行数:8,代码来源:BunchOfLeaves.cs

示例15: Start

    public void Start()
    {
        // 30 rays at minimum
        var alpha = Mathf.Acos(Resources.MinSizeOfEnemy / 2 * Radius) * Mathf.Rad2Deg;
        _minAngle = 180 - 2 * alpha;
        _minAngle -= SkinRadius;
        _detectedEnemies = new List<BoxCollider2D>();

        _sonarCollider = GetComponent<CircleCollider2D>();
        if (_sonarCollider == null)
            Debug.LogError("Sonar Collider component has not been assigned");
        if (Type == Resources.FriendlyReconType.Sonar)
        {
            _sonarDetection = true;
            _sonarCollider.radius = Radius;
            _sonarCollider.isTrigger = true;
        }

        _circularDetectionAngle = 0f;
        _angleBetweenRays = 360f / NumberOfRays;

        _backgroundManager = GetComponent<FriendlyBackgroundManager>();
        if (_backgroundManager == null)
            Debug.LogError("Background Mananger is null");
    }
开发者ID:sathiyavrs,项目名称:Hit-The-Green-Cube,代码行数:25,代码来源:FriendlyReconManager.cs


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