Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactable Objects (e.g. Pickups) #105

Closed
wants to merge 14 commits into from
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: 37c75a6cf72db324eb01200602299fc8
m_currentHash:
serializedVersion: 2
Hash: e734509b347634e74cac702ca58ede00
Hash: 1a0cee12876037204b9566421407ccdb
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 0
m_CatalogRequestsTimeout: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: b6f3b6b3289267c46b6d4d469fd25e44
m_Address: Interactable/InteractHighlightMat.mat
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: bb4eb766250cf0b4d9e2dc0a7d939808
m_Address: GizmoMaterial
m_ReadOnly: 0
Expand Down Expand Up @@ -250,6 +255,11 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: ebe88bc64d28a8e4586b89098577937f
m_Address: Interactable/InteractLineMat.mat
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f95798865974f0740a6932a53740011f
m_Address: oculus_quest_controller_right
m_ReadOnly: 0
Expand Down
14 changes: 14 additions & 0 deletions Basis/Packages/com.basis.sdk/Prefabs/Loadins/Main Camera.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ GameObject:
- component: {fileID: 5985133177976618905}
- component: {fileID: 5904128505799627640}
- component: {fileID: 3942627279868917592}
- component: {fileID: 6918375167695813928}
m_Layer: 3
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -534,3 +535,16 @@ StreamingController:
m_GameObject: {fileID: 5812972426740207491}
m_Enabled: 1
m_StreamingMipmapBias: 0
--- !u!114 &6918375167695813928
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5812972426740207491}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2ca35de189490844b1d7864bc416ffb, type: 3}
m_Name:
m_EditorClassIdentifier:
raycastDistance: 1
3 changes: 2 additions & 1 deletion Basis/Packages/com.basis.tests/BasisExamples.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"GUID:1a5076741edc2f145aafefca837072cf",
"GUID:da668404f8bf3b14ebd4691cc0a6d67c",
"GUID:42c34c05b8d434943ad2cf21483d9cd0",
"GUID:784bec3882b21ab4d8407cc870539fa9"
"GUID:784bec3882b21ab4d8407cc870539fa9",
"GUID:45c7722710e2a37438daaacbf1cd4ad1"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
8 changes: 8 additions & 0 deletions Basis/Packages/com.basis.tests/Interactable.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions Basis/Packages/com.basis.tests/Interactable/CachedList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Collections;
using System.Collections.Generic;

public class CachedList<T> : IEnumerable<T>
{
private readonly List<T> _list;
private int _cachedCount;
private bool _isCountValid;

public CachedList()
{
_list = new List<T>();
_isCountValid = false;
}

public CachedList(IEnumerable<T> collection)
{
_list = new List<T>(collection);
_cachedCount = _list.Count;
_isCountValid = true;
}

public int Count
{
get
{
if (!_isCountValid)
{
_cachedCount = _list.Count;
_isCountValid = true;
}
return _cachedCount;
}
}

public void Add(T item)
{
_list.Add(item);
InvalidateCount();
}

public void AddRange(IEnumerable<T> collection)
{
_list.AddRange(collection);
InvalidateCount();
}

public bool Remove(T item)
{
bool removed = _list.Remove(item);
if (removed)
{
InvalidateCount();
}
return removed;
}

public void RemoveAt(int index)
{
_list.RemoveAt(index);
InvalidateCount();
}

public void Clear()
{
_list.Clear();
InvalidateCount();
}

public T this[int index]
{
get => _list[index];
set => _list[index] = value;
}

private void InvalidateCount()
{
_isCountValid = false;
}

public IEnumerator<T> GetEnumerator()
{
return _list.GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading