当前位置: 首页>>代码示例>>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;未经允许,请勿转载。