本文整理匯總了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);
}
}
}
示例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);
}
}
}
示例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));
}
示例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;
}
}
}