protected virtual void Fire(bool alternative) { DoPreFireEvent(alternative); MeleeWeaponType.MeleeWeaponMode typeMode = alternative ? Type.AlternativeMode : Type.NormalMode; if (typeMode.FireTimes.Count == 0) { return; } readyTimeRemaining = typeMode.BetweenFireTime; currentFireTypeMode = typeMode; currentFireTime = 0; fireTimesExecuted = 0; OnFire(typeMode); if (EntitySystemWorld.Instance.IsServer() && Type.NetworkType == EntityNetworkTypes.Synchronized) { Server_SendFireEventToAllClients(alternative); } }
void Client_ReceiveSoundPlayKick(RemoteEntityWorld sender, ReceiveDataReader reader) { bool alternative = reader.ReadBoolean(); if (!reader.Complete()) { return; } MeleeWeaponType.MeleeWeaponMode typeMode = alternative ? Type.AlternativeMode : Type.NormalMode; SoundPlay3D(typeMode.SoundKick, .5f, false); }
void Client_ReceiveFireEvent(RemoteEntityWorld sender, ReceiveDataReader reader) { bool alternative = reader.ReadBoolean(); if (!reader.Complete()) { return; } MeleeWeaponType.MeleeWeaponMode typeMode = alternative ? Type.AlternativeMode : Type.NormalMode; OnFire(typeMode); }
/// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnTick()"/>.</summary> protected override void OnTick() { base.OnTick(); //fireTimes if (currentFireTypeMode != null) { currentFireTime += TickDelta; int fireTimesCount = currentFireTypeMode.FireTimes.Count; if (fireTimesExecuted < fireTimesCount) { again: if (fireTimesExecuted < fireTimesCount) { float nextTime = currentFireTypeMode.FireTimes[fireTimesExecuted]; if (currentFireTime >= nextTime) { fireTimesExecuted++; Blow(); goto again; } } } else { currentFireTypeMode = null; } } if (readyTimeRemaining != 0) { float coef = 1.0f; Unit unit = GetParentUnitHavingIntellect(); if (unit != null && unit.FastAttackInfluence != null) { coef *= unit.FastAttackInfluence.Type.Coefficient; } readyTimeRemaining -= TickDelta * coef; if (readyTimeRemaining < 0) { readyTimeRemaining = 0; } } }
public override bool TryFire(bool alternative) { if (!Ready) { return(false); } MeleeWeaponType.MeleeWeaponMode typeMode = alternative ? Type.AlternativeMode : Type.NormalMode; if (typeMode.Damage == 0 && typeMode.Impulse == 0) { return(false); } Fire(alternative); return(true); }
protected override bool OnLoad(TextBlock block) { if (!base.OnLoad(block)) { return(false); } if (block.IsAttributeExist("currentFireTypeMode")) { if (block.GetAttribute("currentFireTypeMode") == "normal") { currentFireTypeMode = Type.NormalMode; } else { currentFireTypeMode = Type.AlternativeMode; } } return(true); }
void OnFire(MeleeWeaponType.MeleeWeaponMode typeMode) { //sound SoundPlay3D(typeMode.SoundFire, .5f, true); //update animation tree if (!string.IsNullOrEmpty(typeMode.FireAnimationTrigger)) { foreach (AnimationTree tree in GetAllAnimationTrees()) { tree.ActivateTrigger(typeMode.FireAnimationTrigger); } Unit parentUnit = GetParentUnit(); if (parentUnit != null) { foreach (AnimationTree parentTree in parentUnit.GetAllAnimationTrees()) { parentTree.ActivateTrigger(typeMode.FireAnimationTrigger); } } } }
protected virtual void Fire(bool alternative) { DoPreFireEvent(alternative); MeleeWeaponType.MeleeWeaponMode typeMode = alternative ? Type.AlternativeMode : Type.NormalMode; if (typeMode.FireTimes.Count == 0) return; readyTimeRemaining = typeMode.BetweenFireTime; currentFireTypeMode = typeMode; currentFireTime = 0; fireTimesExecuted = 0; OnFire(typeMode); if (EntitySystemWorld.Instance.IsServer() && Type.NetworkType == EntityNetworkTypes.Synchronized) { Server_SendFireEventToAllClients(alternative); } }
/// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnTick()"/>.</summary> protected override void OnTick() { base.OnTick(); //fireTimes if (currentFireTypeMode != null) { currentFireTime += TickDelta; int fireTimesCount = currentFireTypeMode.FireTimes.Count; if (fireTimesExecuted < fireTimesCount) { again: if (fireTimesExecuted < fireTimesCount) { float nextTime = currentFireTypeMode.FireTimes[fireTimesExecuted]; if (currentFireTime >= nextTime) { fireTimesExecuted++; Blow(); goto again; } } } else currentFireTypeMode = null; } if (readyTimeRemaining != 0) { float coef = 1.0f; Unit unit = GetParentUnitHavingIntellect(); if (unit != null && unit.FastAttackInfluence != null) coef *= unit.FastAttackInfluence.Type.Coefficient; readyTimeRemaining -= TickDelta * coef; if (readyTimeRemaining < 0) readyTimeRemaining = 0; } }
protected override bool OnLoad(TextBlock block) { if (!base.OnLoad(block)) return false; if (block.IsAttributeExist("currentFireTypeMode")) { if (block.GetAttribute("currentFireTypeMode") == "normal") currentFireTypeMode = Type.NormalMode; else currentFireTypeMode = Type.AlternativeMode; } return true; }