2021년 4학년 1학기 기업연계프로젝트2
컴퓨터소프트웨어공학과 <원광투어팀>
팀장 : 송유진
팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//========= Copyright 2016-2020, HTC Corporation. All rights reserved. ===========
using HTC.UnityPlugin.Utility;using System;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;
namespace HTC.UnityPlugin.Pointer3D{ [DisallowMultipleComponent] public abstract class BaseMultiMethodRaycaster : BaseRaycaster { protected readonly IndexedSet<IRaycastMethod> methods = new IndexedSet<IRaycastMethod>();#if UNITY_EDITOR
protected override void Reset() { base.Reset(); if (GetComponent<PhysicsRaycastMethod>() == null) { gameObject.AddComponent<PhysicsRaycastMethod>(); } if (GetComponent<CanvasRaycastMethod>() == null) { gameObject.AddComponent<CanvasRaycastMethod>(); } }#endif
public void AddRaycastMethod(IRaycastMethod obj) { methods.AddUnique(obj); }
public void RemoveRaycastMethod(IRaycastMethod obj) { methods.Remove(obj); }
protected void ForeachRaycastMethods(Ray ray, float distance, List<RaycastResult> resultAppendList) { var results = ListPool<RaycastResult>.Get();
for (int i = methods.Count - 1; i >= 0; --i) { var method = methods[i]; if (!method.enabled) { continue; } method.Raycast(ray, distance, results); }
var comparer = GetRaycasterResultComparer(); if (comparer != null) { results.Sort(comparer); }
for (int i = 0, imax = results.Count; i < imax; ++i) { resultAppendList.Add(results[i]); }
ListPool<RaycastResult>.Release(results); }
protected virtual Comparison<RaycastResult> GetRaycasterResultComparer() { return Pointer3DInputModule.defaultRaycastComparer; } }}
|