示例#1
0
        public void LocalizedHit(LocalizedHitData data)
        {
            BuildingHealth buildingHealth = this.GetBuildingHealth();

            if (buildingHealth)
            {
                buildingHealth.LocalizedHit(data);
            }
        }
示例#2
0
        public void LocalizedHit(LocalizedHitData data)
        {
            PrefabIdentifier componentInParent = base.transform.GetComponentInParent <PrefabIdentifier>();

            if (componentInParent)
            {
                BuildingHealth component = componentInParent.GetComponent <BuildingHealth>();
                if (component)
                {
                    component.LocalizedHit(data);
                }
            }
        }
示例#3
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag(this._tag))
     {
         BuildingHealth componentInParent = base.transform.GetComponentInParent <BuildingHealth>();
         if (componentInParent)
         {
             componentInParent.LocalizedHit(new LocalizedHitData
             {
                 _position = other.transform.position,
                 _damage   = (float)this._damage
             });
         }
     }
 }
示例#4
0
        public IEnumerator OnExplode(Explode.Data explodeData)
        {
            if (!this._exploding && !PlayerPreferences.NoDestruction)
            {
                this._exploding = true;
                if (!BoltNetwork.isClient)
                {
                    BuildingHealth component = base.GetComponent <BuildingHealth>();
                    if (component)
                    {
                        component.LocalizedHit(new LocalizedHitData
                        {
                            _damage       = explodeData.explode.damage * this.GetDamageRatio(explodeData.distance, explodeData.explode.radius),
                            _position     = explodeData.explode.transform.position,
                            _distortRatio = 1.35f
                        });
                    }
                }
                else
                {
                    FoundationHealth component2 = base.GetComponent <FoundationHealth>();
                    if (component2)
                    {
                        component2.Distort(new LocalizedHitData
                        {
                            _damage       = explodeData.explode.damage * this.GetDamageRatio(explodeData.distance, explodeData.explode.radius),
                            _position     = explodeData.explode.transform.position,
                            _distortRatio = 2.5f
                        });
                    }
                }
                yield return(null);

                this._exploding = false;
            }
            yield break;
        }