protected void DisplaySkillEffect(GameObject skillEffect, ICombatant target, bool randomRotation = true) { skillEffect.transform.position = new Vector3(target.GetPosition().x * 0.9f + transform.position.x * 0.1f, target.GetPosition().y * 0.9f + transform.position.y * 0.1f, target.GetPosition().z * 0.5f + transform.position.z * 0.5f); if (randomRotation) { skillEffect.transform.rotation = Quaternion.Euler(0, 0, Random.Range(0, 360f)); } skillEffect.GetComponent <AttackEffect>().StartEffect(); }
// Update is called once per frame void LateUpdate() { //transform.position = RectTransformUtility.WorldToScreenPoint(Camera.main, subject.GetPosition()); if (canvas == null) { Debug.Log("NULL"); } transform.position = WorldToUISpace(canvas, subject.GetPosition() + new Vector3(0, 0.25f, 0)); slider.maxValue = subject.GetBattleStat().HealthMax; slider.value = subject.GetBattleStat().Health; }
protected IEnumerator Attack() // 공격 { //방향 설정 if (curTileForMove != enemy.GetCurTileForMove()) { SetAnimDirection(curTileForMove.GetDirectionFromOtherTileForMove(enemy.GetCurTileForMove())); } else { SetAnimDirection(GetDirectionToPosition(enemy.GetPosition())); } animator.SetTrigger("AttackFlg"); animator.SetFloat("AttackSpeed", battleStat.AttackSpeed); // 공격 속도에 맞춰 애니메이션. yield return(new WaitForSeconds(0.43f / battleStat.AttackSpeed)); // 어차피 이벤트로 나가는데 필요한지? if (!ValidatingEnemy(enemy)) { yield break; } bool isCrit; float calculatedDamage; battleStat.CalDamage(out calculatedDamage, out isCrit); float actualDamage; if (enemy.TakeDamage(this, calculatedDamage, battleStat.PenetrationFixed, battleStat.PenetrationMult, isCrit, out actualDamage)) { attackEffect.transform.position = new Vector3(enemy.GetPosition().x * 0.9f + transform.position.x * 0.1f, enemy.GetPosition().y * 0.9f + transform.position.y * 0.1f, enemy.GetPosition().z * 0.5f + transform.position.z * 0.5f); attackEffect.transform.rotation = Quaternion.Euler(0, 0, Random.Range(0, 180f)); attackEffect.GetComponent <AttackEffect>().StartEffect(); } yield return(new WaitForSeconds(0.57f / battleStat.AttackSpeed)); attackEffect.GetComponent <AttackEffect>().StopEffect(); }
protected IEnumerator Attack() // 공격 { //방향 설정 if (curTileForMove != enemy.GetCurTileForMove()) { SetAnimDirection(curTileForMove.GetDirectionFromOtherTileForMove(enemy.GetCurTileForMove())); } else { SetAnimDirection(GetDirectionToPosition(enemy.GetPosition())); } animator.SetTrigger("AttackFlg"); animator.SetFloat("AttackSpeed", battleStat.AttackSpeed); yield return(new WaitForSeconds(0.43f / battleStat.AttackSpeed)); // 애니메이션 관련 넣을 것. // 어차피 이벤트로 나가는데 필요한지? if (!ValidatingEnemy(enemy)) { yield break; } SkillBeforeAttack(); bool isCrit; float calculatedDamage; battleStat.CalDamage(out calculatedDamage, out isCrit); float actualDamage; if (enemy.TakeDamage(this, calculatedDamage, battleStat.PenetrationFixed, battleStat.PenetrationMult, isCrit, out actualDamage)) { DisplayAttackEffect(enemy); SkillOnAttack(actualDamage, isCrit, false); } SkillAfterAttack(); yield return(new WaitForSeconds(0.57f / battleStat.AttackSpeed)); // 애니메이션 관련 넣을 것. //attackEffect.GetComponent<AttackEffect>().StopEffect(); }
public void DisplayAttackEffect(ICombatant enemy) { attackEffect.transform.position = new Vector3(enemy.GetPosition().x * 0.9f + transform.position.x * 0.1f, enemy.GetPosition().y * 0.9f + transform.position.y * 0.1f, enemy.GetPosition().z * 0.5f + transform.position.z * 0.5f); attackEffect.transform.rotation = Quaternion.Euler(0, 0, Random.Range(0, 180f)); attackEffect.GetComponent <AttackEffect>().StartEffect(); }