コード例 #1
0
        private void DoDamage(Health otherHealth)
        {
            if (this.destroyOnContact)
            {
                Destroyable destroyable = GetComponent <Destroyable>();
                if (destroyable != null)
                {
                    destroyable.DestroyImmediately();
                }
            }

            if (otherHealth == null)
            {
                return;
            }

            if (!this.affectedObjects.Contains(otherHealth.gameObject))
            {
                this.affectedObjects.Add(otherHealth.gameObject);
            }

            otherHealth.Reduce(this.damage);
        }