public virtual bool SendStatusNotify(CharacterNotifyEvent notify) { if (IsInvincibility) { return(false); } if (notify.Type == CharacterNotifyType.E_Damage && CurrentHp > 0f) { CurrentHp = Mathf.Max(CurrentHp - (float)notify.Data, 0f); if (CurrentHp <= 0f) { Owner.ConsumeNotifyEvent(notify); Owner.AddNotifyEvent(new CharacterNotifyEvent(CharacterNotifyType.E_Dead, null)); return(false); } } else if (notify.Type == CharacterNotifyType.E_Stun) { IsStun = true; CurrentStunTime = (float)notify.Data; } else if (notify.Type == CharacterNotifyType.E_Invincibility) { IsInvincibility = (bool)notify.Data; } return(true); }
public override void StartAction(Character owner) { base.StartAction(owner); AnimUtil.PlayAnim(owner, "effect0"); targetCharacters = new List <Character>(); Character[] enemys = Object.FindObjectsOfType <Character>(); Character target = null; float shortDistance = 99999f; foreach (var e in enemys) { if (e == Owner) { continue; } float angle = Mathf.Acos(Vector3.Dot((e.transform.position - Owner.transform.position).normalized, Owner.transform.forward)) * Mathf.Rad2Deg; float distance = (Owner.transform.position - e.transform.position).magnitude; if (distance <= Isometric.IsometricTileSize.x * 1.8f && angle < 80f) { if (distance < shortDistance) { target = e; shortDistance = distance; } } } if (target == null) { return; } targetCharacters = enemys.ToList().FindAll((c) => c.GetType() == target.GetType()); targetCharacters.Sort((c1, c2) => (c1.transform.position - owner.transform.position).magnitude < (c2.transform.position - owner.transform.position).magnitude ? -1 : 1); damage = PlayerUtil.CalculatingCardPowerValue(50f); Owner.AddNotifyEvent(new CharacterNotifyEvent(CharacterNotifyType.E_Invincibility, true)); }
public override void FinishAction() { base.FinishAction(); PlayerUtil.ConsumeCardPowerUpStatus(); Owner.AddNotifyEvent(new CharacterNotifyEvent(CharacterNotifyType.E_Invincibility, false)); }