/*
         * Damage handling methods:
         * -The virtual methods are called in order in TakeDamage()
         * -BattleEntities can override any steps of receiving damage on their end
         * -The base behavior should work just fine for the large majority of BattleEntities
         */

        /// <summary>
        /// Tells this BattleEntity to damage another one.
        /// This method is a wrapper that calls the <see cref="DealtDamageEvent"/> for this BattleEntity.
        /// This should only be called if damage actually hits.
        /// <para>This also is called when dealing Payback damage.</para>
        /// </summary>
        /// <param name="damageInfo">The InteractionHolder containing the entity to damage and all other interaction data.</param>
        public void DamageEntity(InteractionHolder damageInfo)
        {
            damageInfo.Entity.TakeDamage(damageInfo);

            //Invoke the event
            DealtDamageEvent?.Invoke(damageInfo);
        }
예제 #2
0
파일: Unit.cs 프로젝트: dbirtola/Clicker
    protected virtual void Awake()
    {
        unitDied         = new UnitDiedEvent();
        dealtDamageEvent = new DealtDamageEvent();
        health           = GetComponent <Health>();
        debuffs          = GetComponent <Debuffs>();

        currentSpeed = baseSpeed;
    }