本文整理汇总了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;
}
}
}