當前位置: 首頁>>代碼示例>>C#>>正文


C# Character.GetPos方法代碼示例

本文整理匯總了C#中Character.GetPos方法的典型用法代碼示例。如果您正苦於以下問題:C# Character.GetPos方法的具體用法?C# Character.GetPos怎麽用?C# Character.GetPos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Character的用法示例。


在下文中一共展示了Character.GetPos方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Shoot

//	public void FireMulti(Character target){
//		curTarget = target;
//		Transform house = transform.GetChild (0);
//		house.gameObject.GetComponent<Renderer>().sortingOrder = 4;
//		foreach(Character chara in EnemySpawnManager._instance.enemyList){
//			if(Vector3.Distance(chara.GetPos(),curTarget.GetPos()) <= explosionRange){
//				curTargetList.Add(chara);
//			}
//		}
//		distanceToTarget = Vector3.Distance (this.transform.position, target.GetPos());
//		StartCoroutine (Shoot (target));
//	}

	IEnumerator Shoot(Character target){
		while (move) {
			if(target != null){
				Vector3 targetPos = target.GetPos();
				this.transform.LookAt(targetPos);
				float currentDist = Vector3.Distance(this.transform.position, target.GetPos());
				if(currentDist < minDistance){
					move = false;
					if(node.GetPosion && isAntennaFire == false){
						OnDOTEffect();
					}
					OnHited();
				}
				this.transform.Translate(Vector3.forward*Mathf.Min(speed * Time.deltaTime,currentDist));
				yield return null;
			}
			else{
				move = false;
				if(parent1 != null){
					parent1 = null;
					BulletPool.instance.Push(this.gameObject);
				}
				else if(antennaParent != null){
					antennaParent = null;
					AtennaEffectPool.instance.Push(this.gameObject);
				}
				else 
					Destroy(this.gameObject);
			}
		}
	}
開發者ID:ziyihu,項目名稱:Tower-Defence,代碼行數:44,代碼來源:CannonBullet.cs

示例2: Shoot

		IEnumerator Shoot(Character target){
			while (move) {
				if(target != null){
					//change the targetPos 
					//let the game look better
					//TODO
					
					Vector3 targetPos = target.GetPos();
					this.transform.LookAt(targetPos);
					float currentDist = Vector3.Distance(this.transform.position, target.GetPos());
					if(currentDist < 0.5f){
						move = false;
						if(node.GetPosion){
							OnDOTEffect();
						}
						OnHited();
					}
					this.transform.Translate(Vector3.forward*Mathf.Min(speed * Time.deltaTime,currentDist));
					yield return null;
				}
				else{
					move = false;
					GameObject.Destroy(gameObject);
				}
			}
		}
開發者ID:ziyihu,項目名稱:Tower-Defence,代碼行數:26,代碼來源:LaserBullet.cs

示例3: Fire

	public void Fire(Character target){
		curTarget = target;
		Transform house = transform.GetChild (0);
		house.gameObject.GetComponent<Renderer>().sortingOrder = 4;
		distanceToTarget = Vector3.Distance (this.transform.position, target.GetPos());
		StartCoroutine (Shoot (target));
	}
開發者ID:ziyihu,項目名稱:Tower-Defence,代碼行數:7,代碼來源:DiamondCollectionEffect.cs

示例4: CheckEnemy

	//Find the nearest enemy
	public void CheckEnemy(){
		Debug.Log("66666666666");
		if (GameManager.Instance.CurStatus != GameManager.Status.START_GAME) {
			return;
		}
		if (Time.realtimeSinceStartup > lastTime + data.attackInterval) {
			//get the enemy list
			if(EnemySpawnManager._instance.enemyList.Count > 0){
				//attack the enemy
				curEnemy = EnemySpawnManager._instance.enemyList[0];
				if(curEnemy != null){
					status.CurPose = CharacterStatus.Pose.Attack;
					dirPos = this.GetPosition() - curEnemy.GetPos();

					//dir.y = 0;
					RotateTowards();
					ChangeDirection();
				}
				lastTime = Time.realtimeSinceStartup;
			}
		}
	}
開發者ID:ziyihu,項目名稱:TowerDefence,代碼行數:23,代碼來源:Cannon.cs


注:本文中的Character.GetPos方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。