本文整理汇总了C#中EnemyController类的典型用法代码示例。如果您正苦于以下问题:C# EnemyController类的具体用法?C# EnemyController怎么用?C# EnemyController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnemyController类属于命名空间,在下文中一共展示了EnemyController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
public override void Start()
{
myRigidBody = GetComponent<Rigidbody2D>();
enemyController = GetComponent<EnemyController>();
timeOut = turnDelay;
base.Start();
}
示例2: Start
void Start()
{
bandera = true;
tiempo = Time.time;
//aux_tiempo = Time.time;
Parent = gameObject.GetComponentInParent<EnemyController> ();
}
示例3: Shoot
private void Shoot()
{
Ray ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward);
RaycastHit hitInfo;
if (Physics.Raycast(ray, out hitInfo) || !Physics.Raycast(ray, out hitInfo))//wheter we hit something or not shoot
{
try {
Vector3 hitPoint = hitInfo.point;
Instantiate(bulletPrefab, hitPoint, Quaternion.identity);
if(bulletPrefab != null)
{
audio.PlayOneShot(shotSound);
bullets--;
enemy = hitInfo.collider.GetComponent<EnemyController>();
if (hitInfo.collider.tag == "Enemy")
{
enemy.Damage();
}
}
}
catch (NullReferenceException e)
{//if no object is hit
//do nothing because we want to shoot anyway
}
}
}
示例4: Awake
//Rigidbody enemyRigidbody;
void Awake()
{
//enemyRigidbody = GetComponent <Rigidbody> ();
ec = GetComponent <EnemyController> ();
anim = GetComponent <Animator> ();
nav = GetComponent <NavMeshAgent> ();
}
示例5: Start
// Use this for initialization
void Start () {
//init
wallFlag = false;
maps = new GameObject[NUMBER_OBJ];
CreateMapOnStart();
//Find GameController
gameControllerObj = GameObject.Find ("GameController");
clt = gameControllerObj.GetComponent <GameController>();
//Debug.Log ("AAAAAAAAAAAAAAAAAAAAAA: sss" + clt.character.transform.position.x);
//Find EnemyController
enemyControllerObj = GameObject.Find ("EnemyController");
enemyController = enemyControllerObj.GetComponent <EnemyController>();
mapsPath = new string[NUMBER_MAPS_TYPE];
mapsPath [0] = "Prefabs/Maps/way";
mapsPath [1] = "Prefabs/Maps/way_duongreu";
mapsPath [2] = "Prefabs/Maps/way_ground";
wallPath = "Prefabs/Maps/wall_easy";
wallsHardPath = new string[3];
wallsHardPath [0] = "Prefabs/Maps/wall_hard_left";
wallsHardPath [1] = "Prefabs/Maps/wall_hard_center";
wallsHardPath [2] = "Prefabs/Maps/wall_hard_right";
walls = new List<GameObject> ();
}
示例6: Start
private void Start()
{
if (GameController.Instance.battleType == BattleType.Team && GameController.Instance.isMaster)
{
enemyController = TranscriptManager._instance.GetComponent<EnemyController>();
}
}
示例7: CalculateCoeficient
/// <summary>
/// Calculates the coeficients for scaling
/// </summary>
/// <param name="player"></param>
/// <param name="enemy"></param>
/// <returns></returns>
public float CalculateCoeficient(PlayerController player, EnemyController enemy)
{
if (player.GetSize() > player.startsize * 2f)
{
return coeficient = 0.012f;
}
if (player.GetSize() > player.startsize * 4f)
{
return coeficient = 0.015f;
}
if (player.GetSize() > player.startsize * 6f)
{
return coeficient = enemy.GetSize() * 0.016f;
}
else
{
if (player.GetSize() < player.startsize * 2)
{
if (player.GetSize() <= player.startsize * 0.5f)
{
return coeficient = enemy.GetSize() * 0.02f;
}
else
{
return coeficient = enemy.GetSize() * 0.025f;
}
}
}
return coeficient;
}
示例8: FindTarget
void FindTarget()
{
// pick closest enemy
float smallestDistance = 0;
EnemyController closest = null;
foreach (Transform t in Game.EnemyGroup) {
float distance = (transform.position-t.position).magnitude;
if (closest == null || distance < smallestDistance) {
smallestDistance = distance;
closest = t.GetComponent<EnemyController>();
}
}
if (closest != null && smallestDistance < enemySearchRadius) {
boidComponent.GetBehaviour("ToPlayer").SetWeight(0);
boidComponent.GetBehaviour("ToEnemy").SetWeight(1);
target = closest;
(boidComponent.GetBehaviour("ToEnemy") as ArrivalBehaviour).targetObject = target.transform;
}
else if ((closest == null || smallestDistance > enemySearchRadius) && boidComponent.GetBehaviour("ToEnemy").weight != 0) {
boidComponent.GetBehaviour("ToEnemy").SetWeight(0);
boidComponent.GetBehaviour("ToPlayer").SetWeight(1);
}
}
示例9: Start
// Use this for initialization
void Start () {
currentCooldownTime = 0;
envr = GameObject.FindObjectOfType<Environment> ();
partyController = envr.gameObject.GetComponent<PartyController> ();
enemyController = envr.gameObject.GetComponent<EnemyController> ();
mainCamera = Camera.main;
}
示例10: AppearNext
/// <summary>
/// 出現時処理。
/// </summary>
public void AppearNext()
{
// 次の敵へ
currentID++;
var go = Instantiate(enemyObjectBase) as GameObject;
enemyObject = go.GetComponent<EnemyController>();
enemyObject.ID = currentID;
EnemyData data = EnemyData.Get(currentID - 1);
if (data == null)
{
GameManager.Instance().OnAllKilled();
return;
}
enemyObject.HP = data.hp;
enemyObject.MaxHP = data.hp;
enemyObject.hpGauge = hpGauge;
enemyObject.hpGauge.SetPercent(1);
enemyObject.Appear();
enemyObject.data = data;
enemyObject.damageNumber = damageNumber;
enemyObject.hpGauge.SetElement(data.element);
Debug.Log("Enemy was appeard.");
Debug.Log("ID : " + enemyObject.ID);
Debug.Log("HP : " + enemyObject.HP);
}
示例11: MoveLogic
public Vector3 MoveLogic(EnemyController enemy, GameObject player)
{
if (LMHelper.IsInRange(enemy, player))
{
enemy.SetAggroState(true); //aggroed if within aggro range
float pm = enemy.GetPrevMvt().magnitude;
Vector3 mvt;
// If hitting a wall and moving slowly, take a detour sideways
// (prevents behavior if out in the open or if it happens to graze a wall while moving rapidly)
if (enemy.GetWallHit() && pm <= .05)
{
Vector3 direct = LMHelper.BaseMoveLogic(enemy, player); //first get direct approach
mvt = Vector3.Cross(direct, new Vector3(0f, 1f, 0f)); //cross with vertical to get left perpendicular
if (Time.time % 4 <= 0.02)
{
mvt *= -1; //flip direction every 5 seconds
}
mvt -= direct * (Random.value - 0.5f); //take random angle from straight perpendicular
mvt.Normalize(); //re-normalize
}
else // otherwise chase as normal
{
mvt = LMHelper.BaseMoveLogic(enemy, player);
}
return mvt;
}
enemy.SetAggroState(false);
return new Vector3(0f, 0f, 0f);
}
示例12: NewGame
public static void NewGame()
{
auto = false;
data = new GameData();
enemyController = new EnemyController();
ILevelBuilder generator = new LevelGenerator();
data.level = generator.Generate();
for (int i = 0; i < data.level.doors.Count; i++)
{
data.level.doors[i].Init();
}
data.SpawnPlayer();
//DEBUG STUFF
//data.inventory.Add(ItemLibrary.Get().items[5], 1);
foreach (IGameDataChangeListener listener in GAMEDATA_CHANGE_LISTENERS)
{
listener.OnGameDataChange(data);
}
//ConsolePseudoRaycast.CastRay(new Vector2(14, 1), new Vector2(16, 3));
//Console.ReadKey();
}
示例13: GoToEnemy
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void GoToEnemy(GameObject enemy)
{
if(!_isAttacking){
_target = enemy.GetComponent<EnemyController>();
navMeshAgent.SetDestination(enemy.transform.position);
}
}
示例14: RealRadiansOfEnemy
public float RealRadiansOfEnemy(EnemyController ec)
{
float degrees = (ec.GetTrackID()-1)*60; //clockwise of y-axis
degrees += 15*ec.GetTrackLane(); //negative trackpos is left side, positive is right side, 0 is middle
degrees = ((360-degrees) + 90)%360; //convert to counterclockwise of x axis
degrees *= Mathf.Deg2Rad;
return degrees;
}
示例15: KillTarget
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
IEnumerator KillTarget()
{
yield return new WaitForSeconds(0.25f);
_target.GetComponent<EnemyController>().OnKilled();
//gameController.OnEnemyKilled(); //Not necessary, using events to reduce coupling
_isAttacking = false;
_target = null;
}