DrawWireArc(Attack arange)

2020. 5. 25. 16:20
728x90
Makes scripts in Editor folder

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(Hero))]
public class DrawWireArc : Editor
{
    private void OnSceneGUI()
    {
        Handles.color = Color.red;
        Hero hero = (Hero)target;
        Handles.DrawWireArc(hero.transform.position,
        hero.transform.up, -hero.transform.right, 360, hero.targetRange);
        
        /*
        hero.targetRange = (float)Handles.ScaleValueHandle(hero.targetRange, 
            hero.transform.position + hero.transform.forward * hero.targetRange, 
            hero.transform.rotation, 1, Handles.ConeCap, 1);
            */
            
    }
}

 

>>>> Range setting

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Hero : MonoBehaviour
{
    public GameObject hero;
    public float targetRange;
}
728x90

'Unity > Study' 카테고리의 다른 글

2D Character Move with mousemotion  (0) 2020.05.27
Coroutine  (0) 2020.05.26
DOTween(캐릭터 공격력 효과)  (0) 2020.05.25
Box Colider  (0) 2020.05.25
Atlas  (0) 2020.05.21

BELATED ARTICLES

more