//spell 1 ChillingSlash #region <ChillingSlash> private Action <UnitEventArgs>[] ChillingSlash() { #region <ChillingSlash/Init> var eventGroup = new Action <UnitEventArgs> [(int)UnitEventType.Count]; #endregion #region <ChillingSlash/Begin> eventGroup[(int)UnitEventType.Begin] = eventArgs => { var caster = (Computer)eventArgs.Caster; var focus = caster.Focus; caster.ChaseOrRush(focus, .2f, 2.0f); caster.UnitBoneAnimator.SetCast("Spell", caster.hyperParameterSet[(int)HyperParameterOfSpell.Spell01].Motion); }; #endregion #region <ChillingSlash/Exit> eventGroup[(int)UnitEventType.Exit] = eventArgs => { var caster = (Computer)eventArgs.Caster; var list = new PreProcessedMonoBehaviour[64].ToList(); UnitFilter.GetUnitAtLocation(caster.GetPosition, 5f, caster, UnitFilter.Condition.IsNegative, list); var numberOfUnit = UnitFilter.GetUnitInCircularSector(caster, 90f, FilteredObjectGroup, list); for (var i = 0; i < numberOfUnit; i++) { var target = (Unit)FilteredObjectGroup[i]; if (UnitFilter.Check(caster, target, UnitFilter.Condition.IsOrCondition | UnitFilter.Condition.IsDead | UnitFilter.Condition.IsInvincible)) { continue; } if (target != null) { target.Hurt(caster, hyperParameterSet[(int)HyperParameterOfSpell.Spell01].Damage, TextureType.Magic); } } }; #endregion #region <ChillingSlash/Terminate> eventGroup[(int)UnitEventType.End] = other => { var caster = (Computer)other.Caster; caster.ResetFromCast(); }; #endregion return(eventGroup); }
//spell 6 BoneExplosion #region <BoneExplosion> private Action <UnitEventArgs>[] BoneExplosion() { #region <BoneExplosion/Init> var eventGroup = new Action <UnitEventArgs> [(int)UnitEventType.Count]; #endregion #region <BoneExplosion/Begin> eventGroup[(int)UnitEventType.Begin] = eventArgs => { var caster = (Computer)eventArgs.Caster; if (!boneWall.IsActive) { caster.ResetFromCast(); return; } var focus = caster.Focus; caster.UnitBoneAnimator.SetCast("Spell", caster.hyperParameterSet[(int)HyperParameterOfSpell.Spell06].Motion); }; #endregion #region <BoneExplosion/Cue> eventGroup[(int)UnitEventType.Cue] = eventArgs => { var caster = (Computer)eventArgs.Caster; boneWall.Remove(); VfxManager.GetInstance.CreateVfx(VfxManager.Type.BoneExplosion, caster.GetPosition) .SetLifeSpan(1f) .SetScale(1f) .SetTrigger(); UnitFilter.GetUnitAtLocation(caster.GetPosition, caster.hyperParameterSet[(int)HyperParameterOfSpell.Spell06].Range, caster, UnitFilter.Condition.IsAlive, FilteredObjectGroup); foreach (var obj in FilteredObjectGroup) { var target = (Unit)obj; if (UnitFilter.Check(caster, target, UnitFilter.Condition.IsOrCondition | UnitFilter.Condition.IsDead | UnitFilter.Condition.IsInvincible)) { continue; } if (target != null) { target.Hurt(caster, hyperParameterSet[(int)HyperParameterOfSpell.Spell06].Damage, TextureType.Magic); } } }; #endregion #region <BoneExplosion/Terminate> eventGroup[(int)UnitEventType.End] = other => { var caster = (Computer)other.Caster; caster.ResetFromCast(); }; #endregion return(eventGroup); }
//spell 3 ShadowDive #region <ShadowDive> private Action <UnitEventArgs>[] ShadowDive() { #region <ShadowDive/Init> var eventGroup = new Action <UnitEventArgs> [(int)UnitEventType.Count]; #endregion #region <ShadowDive/Begin> eventGroup[(int)UnitEventType.Begin] = eventArgs => { var caster = (Computer)eventArgs.Caster; var focus = caster.Focus; caster.UnitBoneAnimator.SetCast("Spell", caster.hyperParameterSet[(int)HyperParameterOfSpell.Spell03].Motion); }; #endregion #region <ShadowDive/Standby> eventGroup[(int)UnitEventType.Standby] = eventArgs => { var caster = (Computer)eventArgs.Caster; var focus = caster.Focus; caster.ChaseOrRush(focus, 0.5f, .0f); }; #endregion #region <ShadowDive/Cue> eventGroup[(int)UnitEventType.Cue] = eventArgs => { var caster = (Computer)eventArgs.Caster; UnitFilter.GetUnitAtLocation(caster.GetPosition, 8.0f, caster, UnitFilter.Condition.IsNegative, FilteredObjectGroup); VfxManager.GetInstance.CreateVfx(VfxManager.Type.BloodCutter, caster.GetPosition) .SetLifeSpan(1f) .SetScale(2f) .SetTrigger(); foreach (var unit in FilteredObjectGroup) { var target = (Unit)unit; if (UnitFilter.Check(caster, target, UnitFilter.Condition.IsOrCondition | UnitFilter.Condition.IsDead | UnitFilter.Condition.IsInvincible)) { continue; } if (target != null) { target.Hurt(caster, hyperParameterSet[(int)HyperParameterOfSpell.Spell03].Damage, TextureType.Magic); } } }; #endregion #region <ShadowDive/Terminate> eventGroup[(int)UnitEventType.End] = other => { var caster = (Computer)other.Caster; caster.ResetFromCast(); }; #endregion return(eventGroup); }
public virtual void Hurt(Unit caster, int damage, TextureType type, Vector3 forceDirection, Action <Unit, Unit, Vector3> action = null) { if (UnitFilter.Check(this, UnitFilter.Condition.IsDead) | UnitFilter.Check(this, UnitFilter.Condition.IsInvincible)) { return; } // TODO<Carey>: if (Verifying Of The Condition Of Hurt) if (true) { CurrentHealthPoint -= damage; MaterialApplier.SetTrigger(K514MaterialStorage.MAT_STATE.kHitted); if (action == null) { /* case */ /* * switch (type) * { * case TextureType.None: * switch (type) * { * case TextureType.None: * break; * case TextureType.Light: * break; * case TextureType.Medium: * break; * case TextureType.Heavy: * break; * case TextureType.Universal: * break; * default: * throw new ArgumentOutOfRangeException("type", type, null); * } * break; * case TextureType.Light: * break; * case TextureType.Medium: * break; * case TextureType.Heavy: * break; * case TextureType.Universal: * break; * default: * throw new ArgumentOutOfRangeException("type", type, null); * } */ } else { action(caster, this, forceDirection); } if (CurrentHealthPoint <= 0) { OnDeath(); } } // forceDirection.Normalize(); // AddForce(forceDirection * damage); // // var lFxTypeIndex = caster.FxAttackType.Length > (int) TriggerId ? // caster.FxAttackType[TriggerId] : K514VfxManager.ParticleType.PSpark; // var lVfx = K514VfxManager.GetInstance.CastVfx(lFxTypeIndex,CalculateHittedOffset(pStrikeTo)); // if (pVfxChainProperty != null) pVfxChainProperty(lVfx); // lVfx.SetTrigger(); }
private bool CheckCollisionAboutUnit(Action <CommomActionArgs> p_ActionWhenOccurCollision = null, bool decreaseHitNum = true) { if (!_isIgnoreUnit) { if (p_ActionWhenOccurCollision == null) { return(false); } CollidedUnitGroup.Clear(); _overLapCollideNumber = CheckCollisionWithCast(CastHitGroup, _halfExtents, PeekedNestPosition, UnitColliderLayerMask, Transform.position); _castHitNumber = CheckCollisionWithOverlap(ColliderGroup, _halfExtents, UnitColliderLayerMask, Transform.position); var l_loopCount = Mathf.Min(Mathf.Max(_overLapCollideNumber, _castHitNumber), _maxColliderNumber); var ignoreFilterMask = UnitFilter.Condition.IsPositive; if (!_IsCheckInvincible) { ignoreFilterMask |= UnitFilter.Condition.IsOrCondition | UnitFilter.Condition.IsInvincible; } for (var index = 0; index < l_loopCount; index++) { #region <CollisionCheckByHitCast> if (index >= _overLapCollideNumber) { goto SECTION_HIT_CHECK_OVER; } var hittedUnit = CastHitGroup[index].collider.GetComponent <Unit>(); if (UnitFilter.Check(Caster, hittedUnit, ignoreFilterMask)) { goto SECTION_HIT_CHECK_OVER; } foreach (var collided in ExCollidedUnitGroup) { if (UnitFilter.Check(collided, hittedUnit, ignoreFilterMask)) { goto SECTION_HIT_CHECK_OVER; } } ExCollidedUnitGroup.Add(hittedUnit); CollidedUnitGroup.Add(hittedUnit); SECTION_HIT_CHECK_OVER: #endregion #region <CollisionCheckbyOverlap> if (index >= _castHitNumber) { goto SECTION_COLLIDE_CHECK_OVER; } var collidedUnit = ColliderGroup[index].GetComponent <Unit>(); if (UnitFilter.Check(Caster, collidedUnit, ignoreFilterMask)) { goto SECTION_COLLIDE_CHECK_OVER; } foreach (var exCollided in ExCollidedUnitGroup) { if (UnitFilter.Check(exCollided, collidedUnit, ignoreFilterMask)) { goto SECTION_COLLIDE_CHECK_OVER; } } ExCollidedUnitGroup.Add(collidedUnit); CollidedUnitGroup.Add(collidedUnit); SECTION_COLLIDE_CHECK_OVER :; #endregion } // CASE#2: has been collided on any negative unit. if (CollidedUnitGroup.Count > 0) { // Defined Action: Collided Unit. p_ActionWhenOccurCollision(new CommomActionArgs() .SetMorphable(this) ); if (!decreaseHitNum) { ExCollidedUnitGroup.Clear(); } else if (_maxNumberOfHitTime > 1) { _maxNumberOfHitTime--; ExCollidedUnitGroup.Clear(); } return(true); } } return(false); }