private void TickWeapon() { m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_NodeCircle); if (m_ClosestEnemyData == null) { m_LineRenderer.gameObject.SetActive(false); Debug.Log("Closest enemy null!"); return; } else { var closestEnemyPosition = m_ClosestEnemyData.View.transform.position; m_View.TowerLookAt(closestEnemyPosition); Vector3 projectileOriginPosition = m_View.ProjectileOrigin.position; m_LineRenderer.SetPosition(0, projectileOriginPosition); m_LineRenderer.SetPosition(1, closestEnemyPosition); m_LineRenderer.gameObject.SetActive(true); } TickTower(); Debug.Log("Hit Lazer!"); m_ClosestEnemyData.GetDamage(m_Damage * Time.deltaTime); }
public Player() { GridHolder = Object.FindObjectOfType <GridHolder>(); GridHolder.CreateGrid(); Grid = GridHolder.Grid; TurretMarket = new TurretMarket(); EnemySearch = new EnemySearch(m_EnemyDatas); m_Health = Game.CurrentLevel.StartHealth; }
public void LinkSearchArrow(int enemyNo, TargetIndicator targetIndicator, EnemySearch enemySearch, Transform canvasTran) { this.enemyNo = enemyNo; //this.searchArrow = searchArrow; this.enemySearch = enemySearch; this.targetIndicator = targetIndicator; targetIndicator.SetUpTarget(gameObject.transform, canvasTran); }
private void TickWeapon() { List <EnemyData> enemyDatas = EnemySearch.GetEnemiesInNodes(m_Nodes); foreach (EnemyData enemyData in enemyDatas) { Vector3 rad = m_View.transform.position - enemyData.View.transform.position; if (rad.sqrMagnitude < m_Radius) { enemyData.ReceiveDamage(m_Damage * Time.deltaTime); } } }
public void TickShoot() { m_ClosestEnemy = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_rangeNodes); if (m_ClosestEnemy == null) { m_LineRenderer.gameObject.SetActive(false); } else { TickTower(); Vector3 originPosition = m_View.ProjectileOrigin.position; m_LineRenderer.transform.position = originPosition; m_LineRenderer.SetPosition(1, m_ClosestEnemy.View.transform.position - originPosition); m_LineRenderer.gameObject.SetActive(true); m_ClosestEnemy.GetDamage(m_Damage); } }
private void TickWeapon() { m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_Nodes); if (m_ClosestEnemyData == null) { m_LineRenderer.gameObject.SetActive(false); return; } m_LineRenderer.SetPositions(new [] { m_View.ProjectileOrigin.position, m_ClosestEnemyData.View.transform.position }); m_LineRenderer.gameObject.SetActive(true); TickTower(); Shoot(m_ClosestEnemyData); }
private void TickWeapon() { m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_NodesInCircle, m_MaxDistance * m_MaxDistance); float passedTime = Time.time - m_LastShotTime; if (passedTime < m_TimeBetweenShots) { return; } if (m_ClosestEnemyData == null) { return; } TickTower(); Shoot(m_ClosestEnemyData); m_LastShotTime = Time.time; }
private void TickWeapon() { float elapsedTime = Time.time - m_LastShotTime; if (elapsedTime < m_TimeBetweenShots) { return; } m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_AvailableNodes); if (m_ClosestEnemyData == null) { return; } TickTower(); Shoot(m_ClosestEnemyData); m_LastShotTime = Time.time; }
private void TickWeapon() { float passedTime = Time.time - m_LastShotTime; if (passedTime < m_TimeBetweenShots) { return; } m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_NodeCircle); if (m_ClosestEnemyData == null) { Debug.Log("Closest enemy null!"); return; } TickTower(); Shoot(m_ClosestEnemyData); m_LastShotTime = Time.time; }
public void TickShoot() { m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_Nodes); if (m_ClosestEnemyData == null) { m_LineRenderer.gameObject.SetActive(false); } else { Vector3 closestEnemyPosition = m_ClosestEnemyData.View.transform.position; m_View.TowerLookAt(closestEnemyPosition); m_LineRenderer.SetPosition(0, m_View.ProjectileOrigin.position); m_LineRenderer.SetPosition(1, closestEnemyPosition); m_LineRenderer.gameObject.SetActive(true); m_ClosestEnemyData.GetDamage(m_Damage * Time.deltaTime); //Debug.Log("Dealt damage"); } }
private void TickWeapon() { float passedTime = Time.time - m_LastShotTime; if (passedTime < m_TimeBetweenShots) { return; } m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_Nodes); if (m_ClosestEnemyData == null) { return; } TickTower(); //Можем вызвать 2 раза, но это не проблема, а исправлять долго Shoot(m_ClosestEnemyData); m_LastShotTime = Time.time; }
private bool SetClosest() { m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_NodesInCircle, m_MaxDistance * m_MaxDistance); return(CheckClosest()); }
private void TickWeapon() { m_ClosestEnemyData = EnemySearch.GetClosestEnemy(m_View.transform.position, m_MaxDistance, m_AvailableNodes); }