File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,8 @@ public int GameMasterLevel
120
120
121
121
public ReplicaComponent [ ] ReplicaComponents => Components . OfType < ReplicaComponent > ( ) . ToArray ( ) ;
122
122
123
+ public int TotalReplicaComponents => Components . OfType < ReplicaComponent > ( ) . Count ( ) ;
124
+
123
125
public Player [ ] Viewers => Zone . Players . Where ( p => p . Perspective . TryGetNetworkId ( this , out _ ) ) . ToArray ( ) ;
124
126
125
127
#endregion
@@ -353,7 +355,17 @@ public bool TryGetComponents<T>(out T[] result) where T : Component
353
355
result = GetComponents < T > ( ) ;
354
356
return result . Length != default ;
355
357
}
358
+
359
+ public bool HasComponent ( Type type )
360
+ {
361
+ return GetComponent ( type ) != default ;
362
+ }
356
363
364
+ public bool HasComponent < T > ( ) where T : Component
365
+ {
366
+ return GetComponent < T > ( ) != default ;
367
+ }
368
+
357
369
public void RemoveComponent ( Type type )
358
370
{
359
371
var comp = GetComponent ( type ) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,13 @@ public Task Tick()
42
42
/// <returns>Whether the object passes the render distance check.</returns>
43
43
public bool View ( GameObject gameObject )
44
44
{
45
- if ( gameObject ? . Transform == default )
45
+ if ( gameObject == default )
46
+ return false ;
47
+
48
+ if ( gameObject . TotalReplicaComponents == 3 && gameObject . HasComponent < SimplePhysicsComponent > ( ) && gameObject . HasComponent < RendererComponent > ( ) && gameObject . HasComponent < TriggerComponent > ( ) )
49
+ return true ;
50
+
51
+ if ( gameObject . Transform == default )
46
52
return false ;
47
53
48
54
if ( gameObject is Player )
You can’t perform that action at this time.
0 commit comments