void Awake() { root = Root; terrain = Terrain; sea = Sea; joystick = Joystick; }
public override void Init() { WorldObjectType = Define.WorldObject.Chracter; gameObject.layer = (int)Define.Layer.Player; gameObject.tag = "Player"; //Creature character = gameObject.GetComponent(Managers.Game.Player.name) as Creature; // 캐릭터 스텟 정보 가져오기 Stat = gameObject.GetOrAddComponent <CharacterStat>(); // NMA 가져오기 nma = Util.GetOrAddComponent <NavMeshAgent>(gameObject); nma.avoidancePriority = 40; // 공격 사거리 설정 _fov = gameObject.GetOrAddComponent <FieldOfView>(); _fov.targetMask = (1 << (int)Define.Layer.WaveMonster | 1 << (int)Define.Layer.Monster); _fov.ViewRadius = Stat.AttackRange; // 애니메이터 등록 PlayerAnimator = GetComponent <Animator>(); // HP바 가져오기 if (gameObject.GetComponentInChildren <UI_HPBar>() == null) { Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform); } #region 이벤트 등록 //Managers.Input.KeyboardAction -= OnKeyboardEvent; //Managers.Input.KeyboardAction += OnKeyboardEvent; //Managers.Input.MouseAction -= OnMouseEvent; //Managers.Input.MouseAction += OnMouseEvent; Managers.Input.JoystickAcition -= OnJoystickEvent; Managers.Input.JoystickAcition += OnJoystickEvent; #endregion // 먼저 조이스틱이 없다면 만들어주기 // joystick = GameObject.FindObjectOfType<UI_Joystick>(); if (ui_Joystick == null) { GameObject ui_GameScene = GameObject.Find("UI_GameScene"); ui_Joystick = Util.FindChildren <UI_Joystick>(ui_GameScene); } }