Exemple #1
0
        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 void DestroyProjectile()
 {
     if (m_HitEnemy != null)
     {
         m_HitEnemy.GetDamage(m_Damage);
     }
     Destroy(gameObject);
 }
        public void DestroyProjectile()
        {
            if (m_HitEnemy != null)
            {
                m_HitEnemy.GetDamage(m_Damage);
            }

            GameObjectPool.ReturnObjectToPool(this);
        }
Exemple #4
0
        public void TickShoot()
        {
            TickTower();
            if (CheckClosest())
            {
                m_LineRenderer.gameObject.SetActive(true);
                m_ClosestEnemyData.GetDamage(m_Damage * Time.deltaTime);
            }
            else
            {
                m_LineRenderer.gameObject.SetActive(false);
            }

            SetClosest();
            TickTower();
        }
 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);
     }
 }
Exemple #6
0
        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");
            }
        }