// private void CmdRun(GameObject obj) { // int id = ObjectManager.Instance.GetId(obj); // _data.mousePos = ActionInput.GetMousePos(_data); // if (isServer) { // RpcRun(id, _data); // } else { // CmdRun(id, _data); // } // } // // [Command] // virtual public void CmdRun(int id, ActionData data) { // Run(id, data); // } // // [ClientRpc] // virtual public void RpcRun(int id, ActionData data) { // Run(id, data); // } public static Vector3 GetMousePos(ActionData?data) { Ray mouseRay = data == null? PickUtil.GetMouseRay() : PickUtil.GetScreenRay(new Vector2(Input.mousePosition.x, Input.mousePosition.y)); float hitT; Vector3 pos = PickUtil.GetXZPlaneHitPointForRay(out hitT, mouseRay); return(pos); }
/// <summary> /// Returns the shooting direction. /// </summary> /// <param name='obj'> /// Object. /// </param> override protected Vector3 GetDirection(GameObject obj, ActionData data) { return(PickUtil.GetMouseRay().direction); }