Exemplo n.º 1
0
    void AttackStart()
    {
        if (timeAfter > delay)
        {
            Debug.Log("아군이 쏨");

            timeAfter = 0f;

            ray.origin    = shootPoint.position;
            ray.direction = shootPoint.forward;

            if (Physics.Raycast(ray, out hit, 1f, 1 << layerMaskEnemy))
            {
                enemyCannonHp  = hit.collider.GetComponent <EnemyHpUICannons>();
                enemySoldierHp = hit.collider.GetComponent <EnemyHpUISoldier>();
                Debug.DrawRay(ray.origin, ray.direction, Color.red);
                Debug.Log("아군 레이저");

                if (enemyCannonHp != null)
                {
                    enemyCannonHp.TakeDamage3(amount: damage);
                }
                else if (enemySoldierHp != null)
                {
                    enemySoldierHp.TakeDamage4(amount: damage);
                }
            }
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == ("ENEMY") || other.tag == "TERRAIN")
        {
            Instantiate(explosion, transform.position, Quaternion.identity);
            Debug.Log("60mm hit SomeThing");

            if (Physics.CheckSphere(transform.position, expRadius, 1 << LayerMask.NameToLayer("ENEMY")))
            {
                // Do Damage
                enemyHpCannon  = other.gameObject.GetComponent <EnemyHpUICannons>();
                enemyHpSoldier = other.gameObject.GetComponent <EnemyHpUISoldier>();
                if (enemyHpCannon != null)
                {
                    enemyHpCannon.TakeDamage3(amount: potanDamage);
                    Debug.Log("60mm : Do Damage to Enemy");
                }
                else if (enemyHpSoldier != null)
                {
                    enemyHpSoldier.TakeDamage4(amount: potanDamage);
                }
            }
            Destroy(gameObject, 0.3f);
        }
        Destroy(this.gameObject, 0.5f);
        void OnDrawGizmos()
        {
            Gizmos.color = Color.red;
            Gizmos.DrawWireSphere(transform.position, expRadius);
        }
    }