//------On-enemy effects-------// public void Enemy(GameObject enemyobj) { var _component = enemyobj.GetComponent <enemycontroller>(); if (fire_low) { if (!_component.immune_fire)//"set on fire" effect { _component.fire_low = true; _component.fire_low_counter_max = fire_low_counter_max; _component.fire_low_counter = 0; _component.enemycontroller_Universaldisplays.fire_low_effectobj.SetActive(true); damagetype type = new damagetype(); type.type = "fire"; _component.DoDamage(type, fire_low_damage_1time); _component.fire_low_damage_lasting = fire_low_damage_lasting; _component.fire_low_applylastingdamagecounter = fire_low_applylastingdamage_counter_max; _component.fire_low_applylastingdamagecounter_max = fire_low_applylastingdamage_counter_max; //remind player of the appliance of this lasting effect _component.Utility_ShowVFX_hittext("burn!", vfxmanager.VM.firedamage, false); } else//immune so just apply a fire damage which will be resisted { damagetype type = new damagetype(); type.type = "fire"; _component.DoDamage(type, fire_low_damage_1time); } } if (poison_low) { if (!_component.immune_poison) { _component.poison_low = true; _component.poison_low_counter_max = poison_low_counter_max; _component.poison_low_counter = 0; _component.enemycontroller_Universaldisplays.poison_low_effectobj.SetActive(true); damagetype type = new damagetype(); type.type = "poison"; _component.DoDamage(type, poison_low_damage_1time); _component.poison_low_damage_lasting = poison_low_damage_lasting; _component.poison_low_applylastingdamagecounter = poison_low_applylastingdamage_counter_max; _component.poison_low_applylastingdamagecounter_max = poison_low_applylastingdamage_counter_max; //remind player of the appliance of this lasting effect _component.Utility_ShowVFX_hittext("poisoned!", vfxmanager.VM.poisondamage, false); } else { damagetype type = new damagetype(); type.type = "poison"; _component.DoDamage(type, poison_low_damage_1time); } } if (ice_low) { if (!_component.immune_ice)//"set on fire" effect { //modify speed NavMeshAgent _component_navagent = _component.transform.parent.GetComponent <NavMeshAgent>(); if (_component.ice_low) { } else { _component.ice_low_navagent_orgspeed = _component_navagent.speed; _component_navagent.speed = _component.ice_low_navagent_orgspeed * 0.3f; _component.animator.speed = 0.3f; } _component.ice_low = true; _component.ice_low_counter_max = ice_low_counter_max; _component.ice_low_counter = 0; _component.enemycontroller_Universaldisplays.ice_low_effectobj.SetActive(true); damagetype type = new damagetype(); type.type = "ice"; _component.DoDamage(type, ice_low_damage_1time); _component.ice_low_damage_lasting = ice_low_damage_lasting; _component.ice_low_applylastingdamagecounter = ice_low_applylastingdamage_counter_max; _component.ice_low_applylastingdamagecounter_max = ice_low_applylastingdamage_counter_max; //remind player of the appliance of this lasting effect _component.Utility_ShowVFX_hittext("slowed!", vfxmanager.VM.icedamage, false); } else//immune so just apply a fire damage which will be resisted { damagetype type = new damagetype(); type.type = "ice"; _component.DoDamage(type, ice_low_damage_1time); } } }
/// <summary> /// Shorthand for damaging a unit, as the default has many arguments that arent't generally used. /// </summary> public static void Damage(this unit target, unit damageDealer, float damage, attacktype attackType, damagetype damagetype = null) { UnitDamageTarget(damageDealer, target, damage, false, false, attackType, damagetype ?? DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS); }