예제 #1
0
        private void Update()
        {
            Damageable.DamageMessage data;
            data.damageSource = transform.position;
            data.amount       = 1;
            data.damager      = this;
            data.stopCamera   = false;
            data.throwing     = true;

            int count = Physics.OverlapSphereNonAlloc(transform.position, m_Collider.radius * transform.localScale.x,
                                                      sOverlapCache, m_PlayerMask);

            for (int i = 0; i < count; ++i)
            {
                Damageable d = sOverlapCache[i].GetComponent <Damageable>();

                if (d != null)
                {
                    data.direction = d.transform.position - transform.position;
                    d.ApplyDamage(data);
                }
            }
        }
예제 #2
0
        private void OnTriggerStay(Collider other)
        {
            if ((damagedLayers.value & 1 << other.gameObject.layer) == 0)
            {
                return;
            }

            Damageable d = other.GetComponentInChildren <Damageable>();

            if (d != null && !d.IsInvulnerable)
            {
                Damageable.DamageMessage message = new Damageable.DamageMessage
                {
                    damageSource = transform.position,
                    damager      = this,
                    amount       = amount,
                    direction    = (other.transform.position - transform.position).normalized,
                    throwing     = false
                };

                d.ApplyDamage(message);
            }
        }
예제 #3
0
 public void DeactivateShield()
 {
     shield.SetActive(false);
     Damageable.SetColliderState(true);
 }
예제 #4
0
 public void ActivateShield()
 {
     shield.SetActive(true);
     m_ShieldActivationTime = 3.0f;
     Damageable.SetColliderState(false);
 }
예제 #5
0
 protected virtual void OnEnable()
 {
     m_Damageable      = GetComponentInChildren <Damageable>();
     m_EnemyController = GetComponentInChildren <EnemyController>();
 }