update models

This commit is contained in:
srgooglo 2022-02-02 18:13:48 +01:00
parent db4f856166
commit 1cfea48574
798 changed files with 142079 additions and 16543 deletions

BIN
Models/t1-Alpha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
Models/t1-RGB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

BIN
Models/t1-RGBA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

721
Models/t1.mtl Normal file
View File

@ -0,0 +1,721 @@
Wavefront OBJ material file
# Contains 53 materials
newmtl grass_block_top
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/grass_block_top_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/grass_block_top_y.png
illum 2
# d 1
# Tr 0
newmtl stone
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/stone.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/stone.png
illum 2
# d 1
# Tr 0
newmtl dirt
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/dirt.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/dirt.png
illum 2
# d 1
# Tr 0
newmtl oak_planks
Ns 127.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.1 0.1 0.1
map_Ka tex/oak_planks.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/oak_planks.png
illum 2
# d 1
# Tr 0
newmtl cobblestone
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/cobblestone.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/cobblestone.png
illum 2
# d 1
# Tr 0
newmtl sand
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/sand.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/sand.png
illum 2
# d 1
# Tr 0
newmtl iron_block
Ns 127.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.1 0.1 0.1
map_Ka tex/iron_block.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/iron_block.png
illum 2
# d 1
# Tr 0
newmtl grass
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/grass_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/grass_y.png
map_d tex/grass_y.png
illum 2
# d 1
# Tr 0
newmtl glass
Ns 242.25
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.03 0.03 0.03
map_Ka tex/glass.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/glass.png
map_d tex/glass.png
illum 2
# d 1
# Tr 0
newmtl stone_bricks
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/stone_bricks.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/stone_bricks.png
illum 2
# d 1
# Tr 0
newmtl white_wool
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/white_wool.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/white_wool.png
illum 2
# d 1
# Tr 0
newmtl cactus_top
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/cactus_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/cactus_top.png
map_d tex/cactus_top.png
illum 2
# d 1
# Tr 0
newmtl cactus_side
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/cactus_side.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/cactus_side.png
map_d tex/cactus_side.png
illum 2
# d 1
# Tr 0
newmtl iron_bars
Ns 127.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.1 0.1 0.1
map_Ka tex/iron_bars.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/iron_bars.png
map_d tex/iron_bars.png
illum 2
# d 1
# Tr 0
newmtl piston_side
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/piston_side.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/piston_side.png
illum 2
# d 1
# Tr 0
newmtl spruce_leaves
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/spruce_leaves_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/spruce_leaves_y.png
map_d tex/spruce_leaves_y.png
illum 2
# d 1
# Tr 0
newmtl glass_pane_top
Ns 242.25
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.03 0.03 0.03
map_Ka tex/glass_pane_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/glass_pane_top.png
map_d tex/glass_pane_top.png
illum 2
# d 1
# Tr 0
newmtl jungle_log
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/jungle_log.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/jungle_log.png
illum 2
# d 1
# Tr 0
newmtl brown_wool
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/brown_wool.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/brown_wool.png
illum 2
# d 1
# Tr 0
newmtl yellow_wool
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/yellow_wool.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/yellow_wool.png
illum 2
# d 1
# Tr 0
newmtl tripwire_hook
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/tripwire_hook.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/tripwire_hook.png
illum 2
# d 1
# Tr 0
newmtl light_blue_wool
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/light_blue_wool.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/light_blue_wool.png
illum 2
# d 1
# Tr 0
newmtl jungle_log_top
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/jungle_log_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/jungle_log_top.png
illum 2
# d 1
# Tr 0
newmtl jungle_leaves
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/jungle_leaves_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/jungle_leaves_y.png
map_d tex/jungle_leaves_y.png
illum 2
# d 1
# Tr 0
newmtl water_still
Ns 216.75
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.03 0.03 0.03
map_Ka tex/water_still_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/water_still_y.png
map_d tex/water_still_y.png
illum 4
# d 0.535
# Tr 0.465
Tf 0.465 0.465 0.465
newmtl orange_terracotta
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/orange_terracotta.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/orange_terracotta.png
illum 2
# d 1
# Tr 0
newmtl quartz_block_bottom
Ns 204
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.16 0.16 0.16
map_Ka tex/quartz_block_bottom.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/quartz_block_bottom.png
illum 2
# d 1
# Tr 0
newmtl quartz_block_side
Ns 204
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.16 0.16 0.16
map_Ka tex/quartz_block_side.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/quartz_block_side.png
illum 2
# d 1
# Tr 0
newmtl quartz_block_top
Ns 204
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.16 0.16 0.16
map_Ka tex/quartz_block_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/quartz_block_top.png
illum 2
# d 1
# Tr 0
newmtl tall_grass_bottom
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/tall_grass_bottom_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/tall_grass_bottom_y.png
map_d tex/tall_grass_bottom_y.png
illum 2
# d 1
# Tr 0
newmtl tall_grass_top
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/tall_grass_top_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/tall_grass_top_y.png
map_d tex/tall_grass_top_y.png
illum 2
# d 1
# Tr 0
newmtl white_stained_glass
Ns 242.25
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.03 0.03 0.03
map_Ka tex/white_stained_glass.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/white_stained_glass.png
map_d tex/white_stained_glass.png
illum 4
# d 0.5
# Tr 0.5
Tf 0.5 0.5 0.5
newmtl white_stained_glass_pane_top
Ns 242.25
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.03 0.03 0.03
map_Ka tex/white_stained_glass_pane_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/white_stained_glass_pane_top.png
map_d tex/white_stained_glass_pane_top.png
illum 4
# d 0.5
# Tr 0.5
Tf 0.5 0.5 0.5
newmtl andesite
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/andesite.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/andesite.png
illum 2
# d 1
# Tr 0
newmtl polished_andesite
Ns 216.75
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.17 0.17 0.17
map_Ka tex/polished_andesite.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/polished_andesite.png
illum 2
# d 1
# Tr 0
newmtl dark_prismarine
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/dark_prismarine.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/dark_prismarine.png
illum 2
# d 1
# Tr 0
newmtl prismarine
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/prismarine.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/prismarine.png
illum 2
# d 1
# Tr 0
newmtl sea_lantern
Ns 178.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.14 0.14 0.14
Ke 1 1 1
map_Ka tex/sea_lantern.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/sea_lantern.png
map_Ke tex/sea_lantern.png
illum 2
# d 1
# Tr 0
newmtl red_nether_bricks
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/red_nether_bricks.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/red_nether_bricks.png
illum 2
# d 1
# Tr 0
newmtl water_flow
Ns 216.75
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.03 0.03 0.03
map_Ka tex/water_flow_y.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/water_flow_y.png
map_d tex/water_flow_y.png
illum 4
# d 0.535
# Tr 0.465
Tf 0.465 0.465 0.465
newmtl white_concrete
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/white_concrete.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/white_concrete.png
illum 2
# d 1
# Tr 0
newmtl stripped_spruce_log
Ns 127.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.1 0.1 0.1
map_Ka tex/stripped_spruce_log.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/stripped_spruce_log.png
illum 2
# d 1
# Tr 0
newmtl stripped_spruce_log_top
Ns 127.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.1 0.1 0.1
map_Ka tex/stripped_spruce_log_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/stripped_spruce_log_top.png
illum 2
# d 1
# Tr 0
newmtl birch_trapdoor
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/birch_trapdoor.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/birch_trapdoor.png
map_d tex/birch_trapdoor.png
illum 2
# d 1
# Tr 0
newmtl dark_oak_trapdoor
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/dark_oak_trapdoor.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/dark_oak_trapdoor.png
map_d tex/dark_oak_trapdoor.png
illum 2
# d 1
# Tr 0
newmtl lantern
Ns 178.5
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0.14 0.14 0.14
Ke 1 1 1
map_Ka tex/lantern.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/lantern.png
map_d tex/lantern.png
map_Ke tex/lantern.png
illum 2
# d 1
# Tr 0
newmtl composter_top
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/composter_top.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/composter_top.png
illum 2
# d 1
# Tr 0
newmtl composter_side
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/composter_side.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/composter_side.png
illum 2
# d 1
# Tr 0
newmtl composter_bottom
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/composter_bottom.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/composter_bottom.png
illum 2
# d 1
# Tr 0
newmtl campfire_log
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
Ke 1 1 1
map_Ka tex/campfire_log.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/campfire_log.png
map_d tex/campfire_log.png
map_Ke tex/campfire_log.png
illum 2
# d 1
# Tr 0
newmtl azalea_leaves
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/azalea_leaves.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/azalea_leaves.png
map_d tex/azalea_leaves.png
illum 2
# d 1
# Tr 0
newmtl rooted_dirt
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/rooted_dirt.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/rooted_dirt.png
illum 2
# d 1
# Tr 0
newmtl deepslate_tiles
Ns 0
Ka 0.2 0.2 0.2
Kd 1 1 1
Ks 0 0 0
map_Ka tex/deepslate_tiles.png
# for G3D, to make textures look blocky:
interpolateMode NEAREST_MAGNIFICATION_TRILINEAR_MIPMAP_MINIFICATION
map_Kd tex/deepslate_tiles.png
map_d tex/deepslate_tiles.png
illum 2
# d 1
# Tr 0

57081
Models/t1.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
Models/tex/andesite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

BIN
Models/tex/brown_wool.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

BIN
Models/tex/cactus_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

BIN
Models/tex/cactus_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

BIN
Models/tex/campfire_log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
Models/tex/cobblestone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

BIN
Models/tex/dirt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

BIN
Models/tex/glass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

BIN
Models/tex/grass_y.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

BIN
Models/tex/iron_bars.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

BIN
Models/tex/iron_block.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

BIN
Models/tex/jungle_log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

BIN
Models/tex/lantern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

BIN
Models/tex/oak_planks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

BIN
Models/tex/piston_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
Models/tex/prismarine.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

BIN
Models/tex/rooted_dirt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

BIN
Models/tex/sand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

BIN
Models/tex/sea_lantern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

BIN
Models/tex/stone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
Models/tex/stone_bricks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

BIN
Models/tex/water_flow_y.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

BIN
Models/tex/white_wool.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

BIN
Models/tex/yellow_wool.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 70c86c9d4d2859a4eb427c0338408cc8
guid: 91b9a83a129504741a363d9a324de958
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 051151a093600dc4fa49f2f636a1a047
guid: f22daada0216a8c4eb4c1e603407310a
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,795 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7b749a2c3c49f074cbaac7ef4353ac9f, type: 3}
m_Name: CyanEmuOculusInputMap
m_EditorClassIdentifier:
inputAxes:
- name: Oculus_CrossPlatform_Button2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 0
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- name: Oculus_CrossPlatform_Button4
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 2
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- name: Oculus_CrossPlatform_PrimaryThumbstick
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 8
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- name: Oculus_CrossPlatform_SecondaryThumbstick
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 9
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- name: Oculus_CrossPlatform_PrimaryIndexTrigger
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 8
joyNum: 0
- name: Oculus_CrossPlatform_SecondaryIndexTrigger
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 9
joyNum: 0
- name: Oculus_CrossPlatform_PrimaryHandTrigger
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 10
joyNum: 0
- name: Oculus_CrossPlatform_SecondaryHandTrigger
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 11
joyNum: 0
- name: Oculus_CrossPlatform_PrimaryThumbstickHorizontal
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 0
- name: Oculus_CrossPlatform_PrimaryThumbstickVertical
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 1
joyNum: 0
- name: Oculus_CrossPlatform_SecondaryThumbstickHorizontal
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 3
joyNum: 0
- name: Oculus_CrossPlatform_SecondaryThumbstickVertical
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 4
joyNum: 0
- name: Joy1 Axis 1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 1
- name: Joy1 Axis 2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 1
joyNum: 1
- name: Joy1 Axis 3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 2
joyNum: 1
- name: Joy1 Axis 4
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 3
joyNum: 1
- name: Joy1 Axis 5
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 4
joyNum: 1
- name: Joy1 Axis 6
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 5
joyNum: 1
- name: Joy1 Axis 7
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 6
joyNum: 1
- name: Joy1 Axis 8
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 7
joyNum: 1
- name: Joy1 Axis 9
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 8
joyNum: 1
- name: Joy1 Axis 10
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 9
joyNum: 1
- name: Joy2 Axis 1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 2
- name: Joy2 Axis 2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 1
joyNum: 2
- name: Joy2 Axis 3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 2
joyNum: 2
- name: Joy2 Axis 4
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 3
joyNum: 2
- name: Joy2 Axis 5
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 4
joyNum: 2
- name: Joy2 Axis 6
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 5
joyNum: 2
- name: Joy2 Axis 7
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 6
joyNum: 2
- name: Joy2 Axis 8
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 7
joyNum: 2
- name: Joy2 Axis 9
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 8
joyNum: 2
- name: Joy2 Axis 10
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 9
joyNum: 2
- name: Joy3 Axis 1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 3
- name: Joy3 Axis 2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 1
joyNum: 3
- name: Joy3 Axis 3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 2
joyNum: 3
- name: Joy3 Axis 4
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 3
joyNum: 3
- name: Joy3 Axis 5
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 4
joyNum: 3
- name: Joy3 Axis 6
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 5
joyNum: 3
- name: Joy3 Axis 7
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 6
joyNum: 3
- name: Joy3 Axis 8
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 7
joyNum: 3
- name: Joy3 Axis 9
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 8
joyNum: 3
- name: Joy3 Axis 10
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 9
joyNum: 3
- name: Joy4 Axis 1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 4
- name: Joy4 Axis 2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 1
joyNum: 4
- name: Joy4 Axis 3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 2
joyNum: 4
- name: Joy4 Axis 4
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 3
joyNum: 4
- name: Joy4 Axis 5
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 4
joyNum: 4
- name: Joy4 Axis 6
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 5
joyNum: 4
- name: Joy4 Axis 7
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 6
joyNum: 4
- name: Joy4 Axis 8
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 7
joyNum: 4
- name: Joy4 Axis 9
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 8
joyNum: 4
- name: Joy4 Axis 10
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.001
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 9
joyNum: 4

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7ba2b06fb32e5274aad88925a5b8d3f5
guid: 23d95483f2a792d4d9fa73797701d213
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3410a6d347558c146867d8cae95b5361
guid: 515be15826853c44f89955e3b87c631a
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,51 @@
4
VRC_TriggerEditor.cs
1
AddAfter 3 4
EditorGUILayout.Separator();
}
}
if (Application.isPlaying && GUILayout.Button("Execute"))
{
VRCPrefabs.CyanEmu.CyanEmuTriggerExecutor.ExecuteTrigger((target as VRC_Trigger).Triggers[idx]);
}
VRCSdkControlPanel.cs
5
AddAfter 1 1
public static VRCSdkControlPanel window;
private Vector2 scrollPosition_;
Delete 2
window.minSize = new Vector2(SdkWindowWidth + 4, 600);
window.maxSize = new Vector2(SdkWindowWidth + 4, 2000);
AddAfter 2 1
InitializeStyles();
}
scrollPosition_ = GUILayout.BeginScrollView(scrollPosition_);
AddAfter 3 1
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
AddAfter 3 1
ShowAccount();
break;
}
GUILayout.EndScrollView();
VRC_SpatialAudioSourceEditor3.cs
3
AddAfter 1 1
[CustomEditor(typeof(VRC.SDK3.Components.VRCSpatialAudioSource))]
[CanEditMultipleObjects]
Delete 1
showAdvancedOptions = EditorGUILayout.Foldout(showAdvancedOptions, "Advanced Options");
Delete 1
if (showAdvancedOptions)
VRC_SpatialAudioSourceEditor.cs
3
AddAfter 1 1
[CustomEditor(typeof(VRCSDK2.VRC_SpatialAudioSource))]
[CanEditMultipleObjects]
Delete 1
showAdvancedOptions = EditorGUILayout.Foldout(showAdvancedOptions, "Advanced Options");
Delete 1
if (showAdvancedOptions)

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 67e5a35aae3207c4cbc09bc41cb62cb3
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 75fdce3ebdeddb74693ee8d06fb2c806
guid: d2c863a3ec2596a41a9b77c42a96d689
folderAsset: yes
DefaultImporter:
externalObjects: {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

@ -1,9 +1,9 @@
fileFormatVersion: 2
guid: 0d383f0cd0395064eb4b64619b2840f3
guid: f496a127ab46cbe42a3719e5d79530b6
TextureImporter:
internalIDToNameTable: []
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 11
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -57,11 +57,10 @@ TextureImporter:
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@ -70,10 +69,20 @@ TextureImporter:
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@ -82,7 +91,6 @@ TextureImporter:
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
@ -90,12 +98,10 @@ TextureImporter:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b01e14f3633ee2643ac8e869c00acb0a
guid: a5461de9adfd72249a006bdc82cfc2ac
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace VRCPrefabs.CyanEmu
{
public class CyanEmuInputAxesSettings : ScriptableObject
{
public static string INPUT_MAP_FILE_NAME = "Assets/CyanEmu/Resources/CyanEmuOculusInputMap.asset";
public List<InputAxis> inputAxes = new List<InputAxis>();
[Serializable]
public class InputAxis
{
public string name;
public string descriptiveName;
public string descriptiveNegativeName;
public string negativeButton;
public string positiveButton;
public string altNegativeButton;
public string altPositiveButton;
public float gravity;
public float dead;
public float sensitivity;
public bool snap;
public bool invert;
public int type;
public int axis;
public int joyNum;
}
#if UNITY_EDITOR
public static CyanEmuInputAxesSettings TryLoadInputAxesSettings()
{
CyanEmuInputAxesSettings settings = LoadInputAxesSettings();
if (settings == null)
{
AssetDatabase.ImportAsset(INPUT_MAP_FILE_NAME);
settings = LoadInputAxesSettings();
}
return settings;
}
public static CyanEmuInputAxesSettings LoadInputAxesSettings()
{
return (CyanEmuInputAxesSettings)AssetDatabase.LoadAssetAtPath(INPUT_MAP_FILE_NAME, typeof(CyanEmuInputAxesSettings));
}
public static void SaveInputAxesSettings(CyanEmuInputAxesSettings settings)
{
AssetDatabase.CreateAsset(settings, INPUT_MAP_FILE_NAME);
}
#endif
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6547d18b2bc62c94aa5ec1e87434da4e
guid: 7b749a2c3c49f074cbaac7ef4353ac9f
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,108 @@
using UnityEngine;
using UnityEngine.EventSystems;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuInputModule : StandaloneInputModule
{
private const int UILayer = 5;
private const int UIMenuLayer = 12;
private CursorLockMode currentLockState_ = CursorLockMode.None;
private CyanEmuBaseInput baseInput_;
public static void DisableOtherInputModules()
{
EventSystem[] systems = FindObjectsOfType<EventSystem>();
foreach (EventSystem system in systems)
{
system.enabled = false;
}
}
protected override void Start()
{
m_InputOverride = baseInput_ = GetComponent<CyanEmuBaseInput>();
eventSystem.sendNavigationEvents = false;
base.Start();
}
public override void Process()
{
currentLockState_ = Cursor.lockState;
Cursor.lockState = CursorLockMode.None;
base.Process();
Cursor.lockState = currentLockState_;
}
// Prevent clicking on menus on the ui layer if your menu is not open
protected override MouseState GetMousePointerEventData(int id)
{
var pointerEventData = base.GetMousePointerEventData(id);
var leftEventData = pointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData;
var pointerRaycast = leftEventData.buttonData.pointerCurrentRaycast;
var obj = pointerRaycast.gameObject;
if (obj == null)
{
return pointerEventData;
}
bool isMenuLayer = obj.layer == UILayer || obj.layer == UIMenuLayer;
if (isMenuLayer ^ baseInput_.isMenuOpen)
{
//Debug.Log("Found menu that you shouldn't interact with!");
leftEventData.buttonData.pointerCurrentRaycast = new RaycastResult()
{
depth = pointerRaycast.depth,
distance = pointerRaycast.distance,
index = pointerRaycast.index,
module = pointerRaycast.module,
gameObject = null,
screenPosition = pointerRaycast.screenPosition,
sortingLayer = pointerRaycast.sortingLayer,
sortingOrder = pointerRaycast.sortingOrder,
worldNormal = pointerRaycast.worldNormal,
worldPosition = pointerRaycast.worldPosition
};
}
return pointerEventData;
}
}
class CyanEmuBaseInput : BaseInput
{
public bool isMenuOpen;
private Vector2 lastMousePos_;
private Vector2 mouseDelta_;
public static Vector2 GetScreenCenter()
{
return new Vector2(Screen.width, Screen.height) * 0.5f;
}
public override Vector2 mousePosition
{
get
{
if (isMenuOpen)
{
return base.mousePosition;
}
return GetScreenCenter() - mouseDelta_;
}
}
private void Update()
{
Vector2 curPos = base.mousePosition;
mouseDelta_ = curPos - lastMousePos_;
lastMousePos_ = curPos;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 848153f45093e01469743624ef9f9391
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuInteractHelper : MonoBehaviour
{
private const int MAX_INTERACT_RAYCASTS_ = 100;
private static readonly LayerMask INTERACT_LAYERS_ = ~(1 << 18); // All layers but MirrorReflection
private static readonly RaycastHit[] raycastHitBuffer = new RaycastHit[MAX_INTERACT_RAYCASTS_];
private static readonly RaycastHitComparer raycastHitComparer = new RaycastHitComparer();
//public CyanEmuHighlightManager highlightManager;
private CyanEmuObjectHighlight highlight_;
private GameObject toolTip_;
private TextMesh toolTipText_;
private Transform cameraTransform_;
private Transform raycastTransform_;
private Func<bool> shouldCheckForInteracts_;
private void Start()
{
highlight_ = CyanEmuObjectHighlight.CreateInteractHelper();
highlight_.transform.parent = transform;
// Tool tip text
toolTip_ = new GameObject("ToolTip");
toolTip_.transform.parent = transform;
GameObject child = new GameObject("ToolTipText");
child.transform.parent = toolTip_.transform;
child.transform.localRotation = Quaternion.Euler(0, 180, 0);
child.transform.localPosition = new Vector3(0, .05f, 0);
toolTipText_ = child.AddComponent<TextMesh>();
toolTipText_.anchor = TextAnchor.LowerCenter;
toolTipText_.characterSize = 0.01f;
toolTipText_.fontSize = 100;
toolTipText_.text = "";
SetEnabled(false);
}
public void Initialize(Transform cameraTransform, Transform raycastTransform, Func<bool> shouldCheckForInteracts)
{
cameraTransform_ = cameraTransform;
raycastTransform_ = raycastTransform;
shouldCheckForInteracts_ = shouldCheckForInteracts;
}
private void LateUpdate()
{
CheckForInteracts();
}
private void CheckForInteracts()
{
// Disable interact check if holding pickup
if (!shouldCheckForInteracts_())
{
SetEnabled(false);
return;
}
//highlightManager.ClearInteracts();
bool display = false;
Ray ray = new Ray(raycastTransform_.position, raycastTransform_.forward);
int hitCount = Physics.RaycastNonAlloc(ray, raycastHitBuffer, float.MaxValue, INTERACT_LAYERS_);
Array.Sort(raycastHitBuffer, 0, hitCount, raycastHitComparer);
// Go through all colliders in order of distance and stop after find something
// interactable, or a physical collider blocking everything else.
for (int curHit = 0; curHit < hitCount && !display; ++curHit)
{
RaycastHit hit = raycastHitBuffer[curHit];
GameObject hitObject = hit.collider.gameObject;
ICyanEmuInteractable interactable = hitObject.GetClosestInteractable(hit.distance);
if (interactable != null)
{
//highlightManager.AddInteractable(foundInteractable);
HighlightCollider(hit.collider, interactable.GetInteractText());
display = true;
// TODO get input from input manager
if (Input.GetMouseButtonDown(0))
{
hitObject.Interact(hit.distance);
}
}
if (!hit.collider.isTrigger)
{
break;
}
}
SetEnabled(display);
}
public void SetEnabled(bool enabled)
{
if (highlight_.gameObject.activeInHierarchy != enabled)
{
highlight_.gameObject.SetActive(enabled);
toolTip_.SetActive(enabled);
}
}
public void HighlightCollider(Collider collider, string toolTip)
{
highlight_.HighlightCollider(collider);
toolTipText_.text = toolTip;
toolTip_.transform.position = collider.transform.position;
toolTip_.transform.LookAt(cameraTransform_);
}
class RaycastHitComparer : IComparer<RaycastHit>
{
public int Compare(RaycastHit x, RaycastHit y)
{
return x.distance.CompareTo(y.distance);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3423b319b48d3f145ac42423c04d09f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,148 @@
using UnityEngine;
using VRC.SDKBase;
namespace VRCPrefabs.CyanEmu
{
public static class CyanEmuInterfaceExtensions
{
#region ICyanEmuInteractable
// Dumb numbers
private const float INTERACT_OFFSET = 0.9865f;
private const float INTERACT_SCALE = 1.2685f;
public static float CalculateInteractDistanceFormula()
{
float camSize = CyanEmuPlayerController.instance.GetCameraScale();
return camSize * INTERACT_SCALE + INTERACT_OFFSET;
}
public static ICyanEmuInteractable GetClosestInteractable(this GameObject obj, float distance)
{
ICyanEmuInteractable closest = null;
float bestDistance = float.MaxValue;
foreach (var interactable in obj.GetComponents<ICyanEmuInteractable>())
{
if (interactable.CanInteract(distance))
{
closest = interactable;
bestDistance = interactable.GetProximity();
}
}
return closest;
}
public static bool CanInteract(this ICyanEmuInteractable interactable, float distance)
{
float proximityCalculation = CalculateInteractDistanceFormula() * interactable.GetProximity();
return interactable.CanInteract() && distance <= proximityCalculation;
}
public static bool CanInteract(this GameObject obj, float distance)
{
foreach (var interactable in obj.GetComponents<ICyanEmuInteractable>())
{
if (interactable.CanInteract(distance))
{
return true;
}
}
return false;
}
public static void Interact(this GameObject obj, float distance)
{
foreach (var interactable in obj.GetComponents<ICyanEmuInteractable>())
{
if (interactable.CanInteract(distance))
{
interactable.Interact();
}
}
}
#endregion
#region ICyanEmuPickupable
public static void OnPickup(this GameObject obj)
{
foreach (var pickupable in obj.GetComponents<ICyanEmuPickupable>())
{
pickupable.OnPickup();
}
}
public static void OnDrop(this GameObject obj)
{
foreach (var pickupable in obj.GetComponents<ICyanEmuPickupable>())
{
pickupable.OnDrop();
}
}
public static void OnPickupUseDown(this GameObject obj)
{
foreach (var pickupable in obj.GetComponents<ICyanEmuPickupable>())
{
pickupable.OnPickupUseDown();
}
}
public static void OnPickupUseUp(this GameObject obj)
{
foreach (var pickupable in obj.GetComponents<ICyanEmuPickupable>())
{
pickupable.OnPickupUseUp();
}
}
#endregion
#region ICyanEmuStationHandler
public static void OnStationEnter(this GameObject obj, VRCStation station)
{
foreach (var stationHandler in obj.GetComponents<ICyanEmuStationHandler>())
{
stationHandler.OnStationEnter(station);
}
}
public static void OnStationExit(this GameObject obj, VRCStation station)
{
foreach (var stationHandler in obj.GetComponents<ICyanEmuStationHandler>())
{
stationHandler.OnStationExit(station);
}
}
#endregion
#region ICyanEmuSyncable & ICyanEmuSyncableHandler
public static void SetOwner(this GameObject obj, VRCPlayerApi player)
{
if (Networking.GetOwner(obj) == player)
{
return;
}
ICyanEmuSyncable[] syncs = obj.GetComponents<ICyanEmuSyncable>();
foreach (ICyanEmuSyncable sync in syncs)
{
sync.SetOwner(player.playerId);
}
ICyanEmuSyncableHandler[] syncHandlers = obj.GetComponents<ICyanEmuSyncableHandler>();
foreach (ICyanEmuSyncableHandler syncHandler in syncHandlers)
{
syncHandler.OnOwnershipTransferred(player.playerId);
}
}
#endregion
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2aa1cbed33daf8245ab8d7cef3540953
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,636 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using VRC.SDKBase;
using Random = UnityEngine.Random;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuMain : MonoBehaviour
{
private const string CYAN_EMU_GAMEOBJECT_NAME_ = "__CyanEmu";
private const string EDITOR_ONLY_TAG_ = "EditorOnly";
private static CyanEmuMain instance_;
private ICyanEmuSDKManager sdkManager_;
private CyanEmuSettings settings_;
private CyanEmuPlayerController playerController_;
private VRC_SceneDescriptor descriptor_;
private Transform proxyObjectParents_;
private bool shouldVerifySyncedObjectList_;
private readonly Queue<CyanEmuSyncedObjectHelper> toBeAddedSync_ = new Queue<CyanEmuSyncedObjectHelper>();
private readonly Queue<CyanEmuSyncedObjectHelper> toBeRemovedSync_ = new Queue<CyanEmuSyncedObjectHelper>();
private HashSet<CyanEmuSyncedObjectHelper> allSyncedObjects_ = new HashSet<CyanEmuSyncedObjectHelper>();
private int spawnedObjectCount_;
private bool networkReady_;
private int spawnOrder_ = 0;
// TODO save syncables
//private CyanEmuBufferManager bufferManager_;
// Dummy method to get the static initializer to be called early on.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void OnBeforeSceneLoad() { }
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void OnAfterSceneLoad()
{
if (!CyanEmuEnabled())
{
return;
}
DestroyEditorOnly();
}
static CyanEmuMain()
{
if (!CyanEmuEnabled())
{
return;
}
LinkAPI();
CreateInstance();
}
private static bool CyanEmuEnabled()
{
return
CyanEmuSettings.Instance.enableCyanEmu &&
FindObjectOfType<PipelineSaver>() == null &&
Application.isPlaying;
}
private static void LinkAPI()
{
VRCStation.Initialize += CyanEmuStationHelper.InitializeStations;
VRCStation.useStationDelegate = CyanEmuStationHelper.UseStation;
VRCStation.exitStationDelegate = CyanEmuStationHelper.ExitStation;
VRC_UiShape.GetEventCamera = CyanEmuPlayerController.GetPlayerCamera;
VRC_Pickup.OnAwake = CyanEmuPickupHelper.InitializePickup;
VRC_Pickup.ForceDrop = CyanEmuPickupHelper.ForceDrop;
VRC_Pickup._GetCurrentPlayer = CyanEmuPickupHelper.GetCurrentPlayer;
VRC_Pickup._GetPickupHand = CyanEmuPickupHelper.GetPickupHand;
VRC_ObjectSpawn.Initialize = CyanEmuObjectSpawnHelper.InitializeSpawner;
#if UDON && VRC_SDK_VRCSDK3
VRC.Udon.UdonBehaviour.OnInit = CyanEmuUdonHelper.OnInit;
// This is no longer used as of SDK 2021.03.22.18.27
VRC.Udon.UdonBehaviour.SendCustomNetworkEventHook = CyanEmuUdonHelper.SendCustomNetworkEventHook;
// TODO
//VRC.Udon.UdonBehaviour.CheckValid
VRC.SDK3.Components.VRCObjectPool.OnInit = CyanEmuObjectPoolHelper.OnInit;
VRC.SDK3.Components.VRCObjectPool.OnReturn = CyanEmuObjectPoolHelper.OnReturn;
VRC.SDK3.Components.VRCObjectPool.OnSpawn = CyanEmuObjectPoolHelper.OnSpawn;
VRC.SDK3.Components.VRCObjectSync.FlagDiscontinuityHook = CyanEmuObjectSyncHelper.FlagDiscontinuityHook;
VRC.SDK3.Components.VRCObjectSync.OnAwake = CyanEmuObjectSyncHelper.InitializeObjectSync;
VRC.SDK3.Components.VRCObjectSync.RespawnHandler = CyanEmuObjectSyncHelper.RespawnObject;
VRC.SDK3.Components.VRCObjectSync.TeleportHandler = CyanEmuObjectSyncHelper.TeleportTo;
VRC.SDK3.Components.VRCObjectSync.SetGravityHook = CyanEmuObjectSyncHelper.SetUseGravity;
VRC.SDK3.Components.VRCObjectSync.SetKinematicHook = CyanEmuObjectSyncHelper.SetIsKinematic;
#endif
#if VRC_SDK_VRCSDK2
VRC_Trigger.InitializeTrigger = CyanEmuTriggerHelper.InitializeTrigger;
VRCSDK2.VRC_ObjectSync.Initialize += CyanEmuObjectSyncHelper.InitializeObjectSync;
VRCSDK2.VRC_ObjectSync.TeleportHandler += CyanEmuObjectSyncHelper.TeleportTo;
VRCSDK2.VRC_ObjectSync.RespawnHandler += CyanEmuObjectSyncHelper.RespawnObject;
VRCSDK2.VRC_ObjectSync.SetIsKinematic += CyanEmuObjectSyncHelper.SetIsKinematic;
VRCSDK2.VRC_ObjectSync.SetUseGravity += CyanEmuObjectSyncHelper.SetUseGravity;
VRCSDK2.VRC_ObjectSync.GetIsKinematic += CyanEmuObjectSyncHelper.GetIsKinematic;
VRCSDK2.VRC_ObjectSync.GetUseGravity += CyanEmuObjectSyncHelper.GetUseGravity;
VRCSDK2.VRC_PlayerMods.Initialize = CyanEmuPlayerModsHelper.InitializePlayerMods;
VRCSDK2.VRC_SyncAnimation.Initialize = CyanEmuSyncAnimationHelper.InitializationDelegate;
#endif
Networking._IsMaster = CyanEmuPlayerManager.IsLocalPlayerMaster;
Networking._LocalPlayer = CyanEmuPlayerManager.LocalPlayer;
Networking._GetOwner = CyanEmuPlayerManager.GetOwner;
Networking._IsOwner = CyanEmuPlayerManager.IsOwner;
Networking._SetOwner = CyanEmuPlayerManager.TakeOwnership;
Networking._GetUniqueName = VRC.Tools.GetGameObjectPath;
VRCPlayerApi._GetPlayerId = CyanEmuPlayerManager.GetPlayerID;
VRCPlayerApi._GetPlayerById = CyanEmuPlayerManager.GetPlayerByID;
VRCPlayerApi._isMasterDelegate = CyanEmuPlayerManager.IsMaster;
VRCPlayerApi.ClaimNetworkControl = CyanEmuPlayerManager.ClaimNetworkControl;
VRCPlayerApi._EnablePickups = CyanEmuPlayerManager.EnablePickups;
VRCPlayerApi._Immobilize = CyanEmuPlayerManager.Immobilize;
VRCPlayerApi._TeleportTo = CyanEmuPlayerManager.TeleportTo;
VRCPlayerApi._TeleportToOrientation = CyanEmuPlayerManager.TeleportToOrientation;
VRCPlayerApi._TeleportToOrientationLerp = CyanEmuPlayerManager.TeleportToOrientationLerp;
VRCPlayerApi._PlayHapticEventInHand = CyanEmuPlayerManager.PlayHapticEventInHand;
VRCPlayerApi._GetPlayerByGameObject = CyanEmuPlayerManager.GetPlayerByGameObject;
VRCPlayerApi._GetPickupInHand = CyanEmuPlayerManager.GetPickupInHand;
VRCPlayerApi._GetTrackingData = CyanEmuPlayerManager.GetTrackingData;
VRCPlayerApi._GetBoneTransform = CyanEmuPlayerManager.GetBoneTransform;
VRCPlayerApi._GetBonePosition = CyanEmuPlayerManager.GetBonePosition;
VRCPlayerApi._GetBoneRotation = CyanEmuPlayerManager.GetBoneRotation;
VRCPlayerApi._TakeOwnership = CyanEmuPlayerManager.TakeOwnership;
VRCPlayerApi._IsOwner = CyanEmuPlayerManager.IsOwner;
VRCPlayerApi._ClearPlayerTags = CyanEmuPlayerManager.ClearPlayerTag;
VRCPlayerApi._SetPlayerTag = CyanEmuPlayerManager.SetPlayerTag;
VRCPlayerApi._GetPlayerTag = CyanEmuPlayerManager.GetPlayerTag;
VRCPlayerApi._GetPlayersWithTag = CyanEmuPlayerManager.GetPlayersWithTag;
VRCPlayerApi._SetSilencedToTagged = CyanEmuPlayerManager.SetSilencedToTagged;
VRCPlayerApi._SetSilencedToUntagged = CyanEmuPlayerManager.SetSilencedToUntagged;
VRCPlayerApi._ClearSilence = CyanEmuPlayerManager.ClearSilence;
VRCPlayerApi._SetInvisibleToTagged = CyanEmuPlayerManager.SetInvisibleToTagged;
VRCPlayerApi._SetInvisibleToUntagged = CyanEmuPlayerManager.SetInvisibleToUntagged;
VRCPlayerApi._ClearInvisible = CyanEmuPlayerManager.ClearInvisible;
VRCPlayerApi._IsUserInVR = (VRCPlayerApi _) => false; // TODO one day...
VRCPlayerApi._GetRunSpeed = CyanEmuPlayerManager.GetRunSpeed;
VRCPlayerApi._SetRunSpeed = CyanEmuPlayerManager.SetRunSpeed;
VRCPlayerApi._GetWalkSpeed = CyanEmuPlayerManager.GetWalkSpeed;
VRCPlayerApi._SetWalkSpeed = CyanEmuPlayerManager.SetWalkSpeed;
VRCPlayerApi._GetJumpImpulse = CyanEmuPlayerManager.GetJumpImpulse;
VRCPlayerApi._SetJumpImpulse = CyanEmuPlayerManager.SetJumpImpulse;
VRCPlayerApi._GetStrafeSpeed = CyanEmuPlayerManager.GetStrafeSpeed;
VRCPlayerApi._SetStrafeSpeed = CyanEmuPlayerManager.SetStrafeSpeed;
VRCPlayerApi._GetVelocity = CyanEmuPlayerManager.GetVelocity;
VRCPlayerApi._SetVelocity = CyanEmuPlayerManager.SetVelocity;
VRCPlayerApi._GetPosition = CyanEmuPlayerManager.GetPosition;
VRCPlayerApi._GetRotation = CyanEmuPlayerManager.GetRotation;
VRCPlayerApi._GetGravityStrength = CyanEmuPlayerManager.GetGravityStrength;
VRCPlayerApi._SetGravityStrength = CyanEmuPlayerManager.SetGravityStrength;
VRCPlayerApi.IsGrounded = CyanEmuPlayerManager.IsGrounded;
VRCPlayerApi._UseAttachedStation = CyanEmuPlayerManager.UseAttachedStation;
VRCPlayerApi._UseLegacyLocomotion = CyanEmuPlayerManager.UseLegacyLocomotion;
VRCPlayerApi._CombatSetup = CyanEmuCombatSystemHelper.CombatSetup;
VRCPlayerApi._CombatSetMaxHitpoints = CyanEmuCombatSystemHelper.CombatSetMaxHitpoints;
VRCPlayerApi._CombatGetCurrentHitpoints = CyanEmuCombatSystemHelper.CombatGetCurrentHitpoints;
VRCPlayerApi._CombatSetRespawn = CyanEmuCombatSystemHelper.CombatSetRespawn;
VRCPlayerApi._CombatSetDamageGraphic = CyanEmuCombatSystemHelper.CombatSetDamageGraphic;
VRCPlayerApi._CombatGetDestructible = CyanEmuCombatSystemHelper.CombatGetDestructible;
VRCPlayerApi._CombatSetCurrentHitpoints = CyanEmuCombatSystemHelper.CombatSetCurrentHitpoints;
VRCPlayerApi._SetAvatarAudioVolumetricRadius = CyanEmuPlayerManager.SetAvatarAudioVolumetricRadius;
VRCPlayerApi._SetAvatarAudioNearRadius = CyanEmuPlayerManager.SetAvatarAudioNearRadius;
VRCPlayerApi._SetAvatarAudioFarRadius = CyanEmuPlayerManager.SetAvatarAudioFarRadius;
VRCPlayerApi._SetAvatarAudioGain = CyanEmuPlayerManager.SetAvatarAudioGain;
VRCPlayerApi._SetVoiceLowpass = CyanEmuPlayerManager.SetVoiceLowpass;
VRCPlayerApi._SetVoiceVolumetricRadius = CyanEmuPlayerManager.SetVoiceVolumetricRadius;
VRCPlayerApi._SetVoiceDistanceFar = CyanEmuPlayerManager.SetVoiceDistanceFar;
VRCPlayerApi._SetVoiceDistanceNear = CyanEmuPlayerManager.SetVoiceDistanceNear;
VRCPlayerApi._SetVoiceGain = CyanEmuPlayerManager.SetVoiceGain;
VRC_SpatialAudioSource.Initialize = CyanEmuSpatialAudioHelper.InitializeAudio;
// New methods added. Try not to break older sdks
// TODO figure out a better way...
// 2021-05-03
var isInstanceOwner = typeof(VRCPlayerApi).GetField("_isInstanceOwnerDelegate", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
if (isInstanceOwner != null) isInstanceOwner.SetValue(null, (Func<VRCPlayerApi, bool>)CyanEmuPlayerManager.IsInstanceOwner);
var isInstanceOwnerNetworking = typeof(Networking).GetField("_IsInstanceOwner", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
if (isInstanceOwnerNetworking != null) isInstanceOwnerNetworking.SetValue(null, (Func<bool>)CyanEmuPlayerManager.IsInstanceOwner);
}
private static void CreateInstance()
{
GameObject executor = new GameObject(CYAN_EMU_GAMEOBJECT_NAME_);
executor.tag = EDITOR_ONLY_TAG_;
instance_ = executor.AddComponent<CyanEmuMain>();
}
private static void DestroyEditorOnly()
{
if (!CyanEmuSettings.Instance.deleteEditorOnly)
{
return;
}
List<GameObject> rootObjects = new List<GameObject>();
Scene scene = SceneManager.GetActiveScene();
scene.GetRootGameObjects(rootObjects);
Queue<GameObject> queue = new Queue<GameObject>(rootObjects);
while (queue.Count > 0)
{
GameObject obj = queue.Dequeue();
if (obj.tag == EDITOR_ONLY_TAG_)
{
obj.Log("Deleting editor only object: " + VRC.Tools.GetGameObjectPath(obj));
DestroyImmediate(obj);
}
else
{
for (int child = 0; child < obj.transform.childCount; ++child)
{
queue.Enqueue(obj.transform.GetChild(child).gameObject);
}
}
}
}
public static bool HasInstance()
{
return instance_ != null;
}
public static bool IsNetworkReady()
{
return instance_.networkReady_;
}
private void Awake()
{
if (instance_ != null)
{
this.LogError("Already have an instance of CyanEmu!");
DestroyImmediate(gameObject);
return;
}
settings_ = CyanEmuSettings.Instance;
instance_ = this;
DontDestroyOnLoad(this);
proxyObjectParents_ = new GameObject(CYAN_EMU_GAMEOBJECT_NAME_ + "ProxyObjects").transform;
DontDestroyOnLoad(proxyObjectParents_);
CyanEmuInputModule.DisableOtherInputModules();
gameObject.AddComponent<CyanEmuBaseInput>();
gameObject.AddComponent<CyanEmuInputModule>();
descriptor_ = FindObjectOfType<VRC_SceneDescriptor>();
if (descriptor_ == null)
{
Debug.LogWarning("There is no VRC_SceneDescriptor in the scene.");
}
// SDK manager class
#if VRC_SDK_VRCSDK2
sdkManager_ = gameObject.AddComponent<CyanEmuTriggerExecutor>();
#endif
#if UDON
sdkManager_ = gameObject.AddComponent<CyanEmuUdonManager>();
#endif
StartCoroutine(OnNetworkReady());
}
private IEnumerator OnNetworkReady()
{
yield return new WaitForSeconds(0.5f);
this.Log("Sending OnNetworkReady");
sdkManager_.OnNetworkReady();
if (settings_.spawnPlayer)
{
// TODO add option to allow for spawning remote players first to have data on not being master
/*
for (int i = 0; i < x; ++i)
{
SpawnRemotePlayer();
}
*/
SpawnLocalPlayer();
}
networkReady_ = true;
yield return new WaitForSeconds(0.1f);
CyanEmuPlayerManager.OnNetworkReady();
}
public static Transform GetProxyObjectTransform()
{
return instance_.proxyObjectParents_;
}
public static void SpawnPlayer(bool local, string name = null)
{
if (local)
{
instance_?.SpawnLocalPlayer();
}
else
{
instance_?.SpawnRemotePlayer(name);
}
}
private void SpawnLocalPlayer()
{
if (descriptor_ == null)
{
Debug.LogError("Cannot spawn player if there is no world descriptor!");
return;
}
GameObject player = new GameObject("Local Player");
player.transform.parent = transform;
// Force move the player initially to the spawn point to prevent enter triggers at the origin
Transform spawn = GetSpawnPoint();
player.transform.position = spawn.position;
player.transform.rotation = Quaternion.Euler(0, spawn.rotation.eulerAngles.y, 0);
playerController_ = player.AddComponent<CyanEmuPlayerController>();
playerController_.Teleport(spawn, false);
CyanEmuPlayer playerObj = player.AddComponent<CyanEmuPlayer>();
VRCPlayerApi playerAPI = CyanEmuPlayerManager.CreateNewPlayer(true, player, settings_.customLocalPlayerName);
playerObj.SetPlayer(playerAPI);
player.name = $"[{playerAPI.playerId}] {player.name}";
}
private void SpawnRemotePlayer(string name = null)
{
if (descriptor_ == null)
{
Debug.LogError("Cannot spawn player if there is no world descriptor!");
return;
}
GameObject player = new GameObject("Remote Player");
player.transform.parent = transform;
player.layer = LayerMask.NameToLayer("Player");
// TODO do this better
Transform spawn = GetSpawnPoint(true);
player.transform.position = spawn.position;
player.transform.rotation = Quaternion.Euler(0, spawn.rotation.eulerAngles.y, 0);
GameObject playerVis = GameObject.CreatePrimitive(PrimitiveType.Sphere);
playerVis.layer = player.layer;
playerVis.transform.SetParent(player.transform, false);
CyanEmuPlayer playerObj = player.AddComponent<CyanEmuPlayer>();
VRCPlayerApi playerAPI = CyanEmuPlayerManager.CreateNewPlayer(false, player, name);
playerObj.SetPlayer(playerAPI);
player.name = $"[{playerAPI.playerId}] {player.name}";
Rigidbody rigidbody = player.AddComponent<Rigidbody>();
rigidbody.isKinematic = true;
}
public static Transform GetNextSpawnPoint()
{
if (instance_ != null)
{
return instance_.GetSpawnPoint();
}
return null;
}
private Transform GetSpawnPoint(bool remote = false)
{
if (descriptor_.spawns.Length == 0 || descriptor_.spawns[0] == null)
{
throw new Exception("[CyanEmuMain] Cannot spawn player when descriptor does not have a spawn set!");
}
// Remote players always restart the list, so for now, only first spawn
if (descriptor_.spawnOrder == VRC_SceneDescriptor.SpawnOrder.First ||
descriptor_.spawnOrder == VRC_SceneDescriptor.SpawnOrder.Demo ||
remote)
{
return descriptor_.spawns[0];
}
if (descriptor_.spawnOrder == VRC_SceneDescriptor.SpawnOrder.Random)
{
int spawn = Random.Range(0, descriptor_.spawns.Length);
return descriptor_.spawns[spawn];
}
if (descriptor_.spawnOrder == VRC_SceneDescriptor.SpawnOrder.Sequential)
{
Transform spawn = descriptor_.spawns[spawnOrder_];
spawnOrder_ = (spawnOrder_ + 1) % descriptor_.spawns.Length;
return spawn;
}
// Fallback to first spawn point
return descriptor_.spawns[0];
}
public static void RemovePlayer(VRCPlayerApi player)
{
CyanEmuPlayerManager.RemovePlayer(player);
Destroy(player.gameObject);
}
public static void PlayerJoined(VRCPlayerApi player)
{
instance_?.OnPlayerJoined(player);
}
private void OnPlayerJoined(VRCPlayerApi player)
{
sdkManager_.OnPlayerJoined(player);
}
public static void PlayerLeft(VRCPlayerApi player)
{
instance_?.OnPlayerLeft(player);
}
private void OnPlayerLeft(VRCPlayerApi player)
{
int masterID = CyanEmuPlayerManager.GetMasterID();
VRCPlayerApi masterPlayer = VRCPlayerApi.GetPlayerById(masterID);
foreach (CyanEmuSyncedObjectHelper sync in allSyncedObjects_)
{
if (sync == null)
{
continue;
}
GameObject syncObj = sync.gameObject;
if (Networking.GetOwner(syncObj)?.playerId == player.playerId)
{
Networking.SetOwner(masterPlayer, syncObj);
}
}
sdkManager_.OnPlayerLeft(player);
}
public static void PlayerRespawned(VRCPlayerApi player)
{
instance_?.OnPlayerRespawn(player);
}
private void OnPlayerRespawn(VRCPlayerApi player)
{
sdkManager_.OnPlayerRespawn(player);
}
public static GameObject SpawnObject(GameObject prefab)
{
return SpawnObject(prefab, Vector3.zero, Quaternion.identity);
}
public static GameObject SpawnObject(GameObject prefab, Vector3 position, Quaternion rotation)
{
GameObject spawnedObject = Instantiate(prefab, position, rotation) as GameObject;
spawnedObject.name = prefab.name + " (Dynamic Clone " + instance_.spawnedObjectCount_ + ")";
spawnedObject.SetActive(true);
spawnedObject.AddComponent<CyanEmuSpawnHelper>();
++instance_.spawnedObjectCount_;
instance_.OnSpawnedObject(spawnedObject);
return spawnedObject;
}
private void OnSpawnedObject(GameObject spawnedObject)
{
sdkManager_.OnSpawnedObject(spawnedObject);
}
private void LateUpdate()
{
if (descriptor_ == null)
{
return;
}
ProcessAddedAndRemovedSyncedObjects();
ProcessSyncedObjectsBelowRespawn();
}
private void ProcessSyncedObjectsBelowRespawn()
{
if (playerController_ != null && playerController_.transform.position.y < descriptor_.RespawnHeightY)
{
playerController_.Teleport(descriptor_.spawns[0], false);
}
// TODO space this out so that there are only x number per frame instead of all every time?
List<GameObject> objsToDestroy = new List<GameObject>();
foreach (CyanEmuSyncedObjectHelper sync in allSyncedObjects_)
{
if (sync == null)
{
shouldVerifySyncedObjectList_ = true;
Debug.LogWarning("Null Synced Object!");
continue;
}
if (!sync.SyncPosition)
{
continue;
}
if (sync.transform.position.y < descriptor_.RespawnHeightY)
{
if (descriptor_.ObjectBehaviourAtRespawnHeight == VRC_SceneDescriptor.RespawnHeightBehaviour.Respawn)
{
sync.Respawn();
}
else
{
objsToDestroy.Add(sync.gameObject);
}
}
}
foreach (var obj in objsToDestroy)
{
Destroy(obj);
}
}
public static void AddSyncedObject(CyanEmuSyncedObjectHelper sync)
{
if (instance_ == null || sync == null)
{
return;
}
instance_.QueueAddSyncedObject(sync);
}
public static void RemoveSyncedObject(CyanEmuSyncedObjectHelper sync)
{
if (instance_ == null)
{
return;
}
instance_.QueueRemoveSyncedObject(sync);
}
private void QueueAddSyncedObject(CyanEmuSyncedObjectHelper syncedObject)
{
if (syncedObject == null)
{
return;
}
toBeAddedSync_.Enqueue(syncedObject);
}
private void QueueRemoveSyncedObject(CyanEmuSyncedObjectHelper syncedObject)
{
shouldVerifySyncedObjectList_ = true;
toBeRemovedSync_.Enqueue(syncedObject);
}
private void ProcessAddedAndRemovedSyncedObjects()
{
if (toBeAddedSync_.Count > 0)
{
foreach (var sync in toBeAddedSync_)
{
if (sync == null)
{
shouldVerifySyncedObjectList_ = true;
continue;
}
allSyncedObjects_.Add(sync);
}
toBeAddedSync_.Clear();
}
if (toBeRemovedSync_.Count > 0)
{
foreach (var udon in toBeRemovedSync_)
{
if (udon == null)
{
shouldVerifySyncedObjectList_ = true;
continue;
}
allSyncedObjects_.Remove(udon);
}
toBeRemovedSync_.Clear();
}
if (shouldVerifySyncedObjectList_)
{
HashSet<CyanEmuSyncedObjectHelper> allSyncs = new HashSet<CyanEmuSyncedObjectHelper>();
foreach (var sync in allSyncedObjects_)
{
if (sync == null)
{
continue;
}
allSyncs.Add(sync);
}
allSyncedObjects_ = allSyncs;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f8dfd7f39e425354dbab5d2c2064fe0a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
using UnityEngine;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuObjectHighlight : MonoBehaviour
{
private static Material highlightMaterial_;
private Renderer interactHighlight_;
private Collider target_;
private static Material GetHighlightMaterial()
{
if (highlightMaterial_ == null)
{
highlightMaterial_ = new Material(Shader.Find("UI/Default"));
highlightMaterial_.SetColor("_Color", new Color32(0, 255, 255, 50));
}
return highlightMaterial_;
}
public static CyanEmuObjectHighlight CreateInteractHelper()
{
GameObject interact = GameObject.CreatePrimitive(PrimitiveType.Cube);
interact.name = "Highlight";
DestroyImmediate(interact.GetComponent<BoxCollider>());
CyanEmuObjectHighlight highlight = interact.AddComponent<CyanEmuObjectHighlight>();
highlight.interactHighlight_ = interact.GetComponent<Renderer>();
highlight.interactHighlight_.sharedMaterial = GetHighlightMaterial();
return highlight;
}
public void HighlightCollider(Collider collider)
{
target_ = collider;
UpdateInteractLocation(target_);
}
public void UpdateInteractLocation(Collider collider)
{
transform.transform.position = collider.bounds.center;
transform.rotation = collider.transform.rotation;
transform.localScale = GetColliderSize(collider) * 1.01f;
}
private Vector3 GetColliderSize(Collider collider)
{
Vector3 scale = collider.transform.lossyScale;
if (collider.GetType() == typeof(BoxCollider))
{
Vector3 size = (collider as BoxCollider).size;
return new Vector3(size.x * scale.x, size.y * scale.y, size.z * scale.z);
}
else if (collider.GetType() == typeof(SphereCollider))
{
float max = Mathf.Max(scale.x, Mathf.Max(scale.y, scale.z));
return Vector3.one * max * (collider as SphereCollider).radius * 2;
}
else if (collider.GetType() == typeof(CapsuleCollider))
{
CapsuleCollider capsule = (collider as CapsuleCollider);
float max = Mathf.Max(scale[(capsule.direction + 1) % 3], scale[(capsule.direction + 2) % 3]);
Vector3 size = Vector3.one * capsule.radius * 2 * max;
size[capsule.direction] = Mathf.Max(capsule.height * scale[capsule.direction], size[capsule.direction]);
return size;
}
else if (collider.GetType() == typeof(MeshCollider))
{
MeshCollider meshCollider = (collider as MeshCollider);
Vector3 size = meshCollider.sharedMesh.bounds.size;
return new Vector3(size.x * scale.x, size.y * scale.y, size.z * scale.z);
}
return collider.bounds.size;
}
private void OnWillRenderObject()
{
if (interactHighlight_.enabled && target_ != null)
{
UpdateInteractLocation(target_);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1938047de93c66141923068bf4063db5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
using System.Collections.Generic;
using UnityEngine;
using VRC.SDKBase;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuObjectSpawnHelper : MonoBehaviour
{
private List<GameObject> spawnedObjects_ = new List<GameObject>();
private VRC_ObjectSpawn objectSpawn_;
public static void InitializeSpawner(VRC_ObjectSpawn objectSpawn)
{
CyanEmuObjectSpawnHelper spawnHelper = objectSpawn.GetComponent<CyanEmuObjectSpawnHelper>();
if (spawnHelper == null)
{
spawnHelper = objectSpawn.gameObject.AddComponent<CyanEmuObjectSpawnHelper>();
spawnHelper.objectSpawn_ = objectSpawn;
}
if (objectSpawn.Instantiate == null)
{
objectSpawn.Instantiate = spawnHelper.SpawnObject;
}
if (objectSpawn.ReapObjects == null)
{
objectSpawn.ReapObjects = spawnHelper.ReapObjects;
}
}
private void SpawnObject(Vector3 position, Quaternion rotation)
{
this.Log("Spawning Object " + objectSpawn_.ObjectPrefab.name + " at " + position + " and rotataion " + rotation);
GameObject spawnedObject = CyanEmuMain.SpawnObject(objectSpawn_.ObjectPrefab, position, rotation);
spawnedObjects_.Add(spawnedObject);
}
private void ReapObjects()
{
this.Log("Reaping all spawned objects");
foreach (GameObject obj in spawnedObjects_)
{
Destroy(obj);
}
spawnedObjects_.Clear();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 881901efd0bf3f94cb0e1aee3a53e3d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,157 @@
using UnityEngine;
// Reusing code for ObjectSync, but VRC does not have them related at all.
#if VRC_SDK_VRCSDK2
using VRCSDK2;
#elif UDON && VRC_SDK_VRCSDK3
using VRC_ObjectSync = VRC.SDK3.Components.VRCObjectSync;
#else
// In some cases, it is possible for the sdk items to cause this to fail to compile.
// Add a proxy here to not have code break.
// This is a potential fix for the issue that causes CyanEmu to break on switching to android
using VRC_ObjectSync = VRCPrefabs.CyanEmu.CyanEmuObjectSync;
namespace VRCPrefabs.CyanEmu
{
public class CyanEmuObjectSync : MonoBehaviour {}
}
#endif
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuObjectSyncHelper : CyanEmuSyncedObjectHelper, ICyanEmuSyncableHandler
{
private VRC_ObjectSync sync_;
private Rigidbody rigidbody_;
public static void InitializeObjectSync(VRC_ObjectSync sync)
{
var helper = sync.GetComponent<CyanEmuObjectSyncHelper>();
if (helper)
{
DestroyImmediate(helper);
}
sync.gameObject.AddComponent<CyanEmuObjectSyncHelper>();
}
public static void TeleportTo(VRC_ObjectSync obj, Vector3 position, Quaternion rotation)
{
obj.GetComponent<CyanEmuObjectSyncHelper>().TeleportTo(position, rotation);
}
public static void RespawnObject(VRC_ObjectSync sync)
{
sync.GetComponent<CyanEmuObjectSyncHelper>().Respawn();
}
public static void SetIsKinematic(VRC_ObjectSync sync, bool value)
{
sync.GetComponent<CyanEmuObjectSyncHelper>().SetIsKinematic(value);
}
public static void SetUseGravity(VRC_ObjectSync sync, bool value)
{
sync.GetComponent<CyanEmuObjectSyncHelper>().SetUseGravity(value);
}
public static bool GetIsKinematic(VRC_ObjectSync sync)
{
return sync.GetComponent<CyanEmuObjectSyncHelper>().GetIsKinematic();
}
public static bool GetUseGravity(VRC_ObjectSync sync)
{
return sync.GetComponent<CyanEmuObjectSyncHelper>().GetUseGravity();
}
public static void FlagDiscontinuityHook(VRC_ObjectSync sync)
{
sync.GetComponent<CyanEmuObjectSyncHelper>().FlagDiscontinuity();
}
protected override void Awake()
{
base.Awake();
SyncPosition = true;
rigidbody_ = GetComponent<Rigidbody>();
sync_ = GetComponent<VRC_ObjectSync>();
#if VRC_SDK_VRCSDK2
if ((GetComponent<Animator>() != null || GetComponent<Animation>() != null) && GetComponent<VRC_SyncAnimation>() == null)
{
gameObject.AddComponent<VRC_SyncAnimation>();
this.LogWarning("Object sync has animtor or animation component but no Sync Animation component. This will be forced synced!");
}
#endif
}
#region ICyanEmuSyncableHandler
public void OnOwnershipTransferred(int ownerID)
{
#if VRC_SDK_VRCSDK2
VRC_Trigger.Trigger(gameObject, VRC.SDKBase.VRC_Trigger.TriggerType.OnOwnershipTransfer);
#endif
}
#endregion
#region legacy RPC methods
public void EnableKinematic()
{
this.Log("Enabling kinematic on Object " + VRC.Tools.GetGameObjectPath(gameObject));
SetIsKinematic(true);
}
public void DisableKinematic()
{
this.Log("Disabling kinematic on Object " + VRC.Tools.GetGameObjectPath(gameObject));
SetIsKinematic(false);
}
public void EnableGravity()
{
this.Log("Enabling gravity on Object " + VRC.Tools.GetGameObjectPath(gameObject));
SetUseGravity(true);
}
public void DisableGravity()
{
this.Log("Disabling gravity on Object " + VRC.Tools.GetGameObjectPath(gameObject));
SetUseGravity(false);
}
#endregion
private void SetIsKinematic(bool value)
{
if (rigidbody_)
{
rigidbody_.isKinematic = value;
}
}
private void SetUseGravity(bool value)
{
if (rigidbody_)
{
rigidbody_.useGravity = value;
}
}
private bool GetIsKinematic()
{
return rigidbody_ && rigidbody_.isKinematic;
}
private bool GetUseGravity()
{
return rigidbody_ && rigidbody_.useGravity;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 589d092631b45f945ace85beb794e76c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,249 @@
using UnityEngine;
using VRC.SDKBase;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuPickupHelper : MonoBehaviour, ICyanEmuInteractable
{
// If the user releases the mouse button before this time, it will not fire on use up.
private const float INITIAL_PICKUP_DURATION_ = 0.5f;
private const float MAX_PICKUP_DISTANCE_ = 0.25f;
private static Quaternion GRIP_OFFSET_ROTATION_ = Quaternion.Euler(0, 45, 0);
private static Quaternion GUN_OFFSET_ROTATION_ = Quaternion.Euler(0, -45, 0);
private Rigidbody rigidbody_;
private VRC_Pickup pickup_;
private bool isHeld_;
private Vector3 positionOffset_;
private Quaternion rotationOffset_ = Quaternion.identity;
private bool initialGrab_;
private float grabActionStartTime_;
private float dropActionStartTime_;
public static void InitializePickup(VRC_Pickup pickup)
{
CyanEmuPickupHelper previousHelper = pickup.gameObject.GetComponent<CyanEmuPickupHelper>();
if (previousHelper != null)
{
DestroyImmediate(previousHelper);
pickup.LogWarning("Destroying old pickup helper on object: " + VRC.Tools.GetGameObjectPath(pickup.gameObject));
}
CyanEmuPickupHelper helper = pickup.gameObject.AddComponent<CyanEmuPickupHelper>();
helper.SetPickup(pickup);
}
public static void ForceDrop(VRC_Pickup pickup)
{
CyanEmuPickupHelper helper = pickup.GetComponent<CyanEmuPickupHelper>();
helper.Drop();
}
public static VRCPlayerApi GetCurrentPlayer(VRC_Pickup pickup)
{
CyanEmuPickupHelper helper = pickup.GetComponent<CyanEmuPickupHelper>();
if (helper.isHeld_)
{
return Networking.LocalPlayer;
}
return null;
}
public static VRC_Pickup.PickupHand GetPickupHand(VRC_Pickup pickup)
{
CyanEmuPickupHelper helper = pickup.GetComponent<CyanEmuPickupHelper>();
if (helper.isHeld_)
{
return VRC_Pickup.PickupHand.Right;
}
return VRC_Pickup.PickupHand.None;
}
private void SetPickup(VRC_Pickup pickup)
{
pickup_ = pickup;
rigidbody_ = GetComponent<Rigidbody>();
}
public Rigidbody GetRigidbody()
{
return rigidbody_;
}
public float GetProximity()
{
return pickup_.proximity;
}
public bool CanInteract()
{
return pickup_.pickupable;
}
public string GetInteractText()
{
if (!string.IsNullOrEmpty(pickup_.InteractionText))
{
return pickup_.InteractionText;
}
return "Hold to Grab";
}
public void Interact()
{
Pickup();
}
public void UpdatePosition(Transform root, bool force = false)
{
if (rigidbody_.isKinematic || force)
{
transform.position = root.transform.position + root.TransformDirection(positionOffset_);
transform.rotation = root.transform.rotation * rotationOffset_;
}
}
public void UpdateUse()
{
int dropIndex = 0;
if (pickup_.AutoHold == VRC_Pickup.AutoHoldMode.Yes)
{
dropIndex = 1;
if (Input.GetMouseButtonDown(dropIndex))
{
dropActionStartTime_ = Time.time;
}
float grabDuration = Time.time - grabActionStartTime_;
if (grabDuration > INITIAL_PICKUP_DURATION_)
{
if (Input.GetMouseButtonDown(0) || (initialGrab_ && Input.GetMouseButton(0)))
{
this.Log("Pickup Use Down");
gameObject.OnPickupUseDown();
initialGrab_ = false;
}
if (Input.GetMouseButtonUp(0))
{
this.Log("Pickup Use Up");
gameObject.OnPickupUseUp();
}
}
}
if (Input.GetMouseButtonUp(dropIndex))
{
Drop();
}
}
public void Pickup()
{
if (isHeld_)
{
return;
}
isHeld_ = true;
grabActionStartTime_ = Time.time;
initialGrab_ = true;
gameObject.OnPickup();
CyanEmuPlayerController player = CyanEmuPlayerController.instance;
if (player == null)
{
this.LogWarning("Unable to pickup object when there is no player!");
return;
}
this.Log("Picking up object " + name);
Networking.SetOwner(Networking.LocalPlayer, gameObject);
// Calculate offest
Transform pickupHoldPoint = null;
Quaternion offsetRotation = Quaternion.identity;
if (pickup_.orientation == VRC_Pickup.PickupOrientation.Grip && pickup_.ExactGrip != null)
{
pickupHoldPoint = pickup_.ExactGrip;
offsetRotation = GRIP_OFFSET_ROTATION_;
}
else if (pickup_.orientation == VRC_Pickup.PickupOrientation.Gun && pickup_.ExactGun != null)
{
pickupHoldPoint = pickup_.ExactGun;
offsetRotation = GUN_OFFSET_ROTATION_;
}
Transform arm = player.GetArmTransform();
// Grab as if no pickup point
if (pickupHoldPoint == null)
{
rotationOffset_ = Quaternion.Inverse(arm.rotation) * transform.rotation;
positionOffset_ = arm.InverseTransformDirection(transform.position - arm.position);
float mag = positionOffset_.magnitude;
if (mag > MAX_PICKUP_DISTANCE_ && pickup_.orientation == VRC_Pickup.PickupOrientation.Any)
{
positionOffset_ = positionOffset_.normalized * MAX_PICKUP_DISTANCE_;
}
}
else
{
rotationOffset_ = offsetRotation * Quaternion.Inverse(Quaternion.Inverse(transform.rotation) * pickupHoldPoint.rotation);
positionOffset_ = rotationOffset_ * transform.InverseTransformDirection(transform.position - pickupHoldPoint.position);
}
player.PickupObject(this);
}
public void Drop()
{
if (!isHeld_)
{
return;
}
this.Log("Dropping object " + name);
isHeld_ = false;
initialGrab_ = false;
gameObject.OnDrop();
CyanEmuPlayerController player = CyanEmuPlayerController.instance;
if (player == null)
{
return;
}
player.DropObject(this);
// Calculate throw velocity
if (!rigidbody_.isKinematic && pickup_.AutoHold == VRC_Pickup.AutoHoldMode.Yes)
{
float holdDuration = Mathf.Clamp(Time.time - dropActionStartTime_, 0, 3);
if (holdDuration > 0.2f)
{
Transform rightArm = player.GetArmTransform();
Vector3 throwForce = rightArm.forward * (holdDuration * 500 * pickup_.ThrowVelocityBoostScale);
rigidbody_.AddForce(throwForce);
this.Log("Adding throw force: "+ throwForce);
}
}
}
public string PickupText()
{
// TODO
return "";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3202215373c7804408519f37ae740d55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,63 @@
using System.Collections.Generic;
using UnityEngine;
using VRC.SDKBase;
namespace VRCPrefabs.CyanEmu
{
public static class CyanEmuPlayerExtensions
{
public static CyanEmuPlayerController GetPlayerController(this VRCPlayerApi player)
{
return player.gameObject.GetComponent<CyanEmuPlayerController>();
}
public static CyanEmuPlayer GetCyanEmuPlayer(this VRCPlayerApi player)
{
return player.gameObject.GetComponent<CyanEmuPlayer>();
}
}
[AddComponentMenu("")]
[SelectionBase]
public class CyanEmuPlayer : MonoBehaviour
{
public VRCPlayerApi player;
private Dictionary<string, string> tags = new Dictionary<string, string>();
public void SetPlayer(VRCPlayerApi player)
{
this.player = player;
// TODO handle this better
CyanEmuPlayerController playerController = GetComponent<CyanEmuPlayerController>();
if (playerController != null)
{
playerController.SetPlayer(this);
}
}
public void ClearTags()
{
tags.Clear();
}
public void SetTag(string tagName, string tagValue)
{
tags[tagName] = tagValue;
}
public string GetTag(string tagName)
{
if (tags.TryGetValue(tagName, out string tagValue))
{
return tagValue;
}
return "";
}
public bool HasTag(string tagName, string tagValue)
{
return GetTag(tagName) == tagValue;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a0d02ab56371a09488276de93c16f8de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 978f5eb2f40732b4a90c6107b7610ecf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,554 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using VRC.SDKBase;
namespace VRCPrefabs.CyanEmu
{
public class CyanEmuPlayerManager
{
// Player Manager system
private static int masterID = -1;
private static int localPlayerID = -1;
private static int nextPlayerID = 1;
private static readonly Dictionary<VRCPlayerApi, int> playerIDs = new Dictionary<VRCPlayerApi, int>();
private static readonly Dictionary<int, VRCPlayerApi> players = new Dictionary<int, VRCPlayerApi>();
private static readonly List<VRCPlayerApi> waitingPlayers = new List<VRCPlayerApi>();
private static bool networkReady = false;
public static void InitializePlayer(VRCPlayerApi player)
{
int id = nextPlayerID;
player.Log("Assigning player id " + id);
++nextPlayerID;
playerIDs[player] = id;
players[id] = player;
player.AddToList();
if (masterID == -1)
{
player.Log("Player is now master");
masterID = id;
Debug.Assert(player.isMaster, "CyanEmuPlayerManager:InitializePlayer Player should be considered master!");
}
else
{
Debug.Assert(!player.isMaster, "CyanEmuPlayerManager:InitializePlayer Player should not be considered master!");
}
Debug.Assert(player.playerId == id, "CyanEmuPlayerManager:InitializePlayer Player's id does not match assigned id!");
if (networkReady)
{
CyanEmuMain.PlayerJoined(player);
}
else
{
waitingPlayers.Add(player);
}
}
public static void OnNetworkReady()
{
networkReady = true;
foreach (var player in waitingPlayers)
{
CyanEmuMain.PlayerJoined(player);
}
waitingPlayers.Clear();
}
public static VRCPlayerApi CreateNewPlayer(bool local, GameObject playerObj, string name = null)
{
VRCPlayerApi player = new VRCPlayerApi();
player.gameObject = playerObj;
player.displayName = (string.IsNullOrEmpty(name) ? (local ? "Local" : "Remote") +" Player " + nextPlayerID : name);
player.isLocal = local;
InitializePlayer(player);
if (local)
{
localPlayerID = player.playerId;
}
Debug.Assert(player.isLocal == local, "CyanEmuPlayerManager:CreateNewPlayer New player does not match local settings!");
return player;
}
public static void RemovePlayer(VRCPlayerApi player)
{
if (masterID == player.playerId)
{
masterID = -1;
if (VRCPlayerApi.AllPlayers.Count != 0)
{
masterID = VRCPlayerApi.AllPlayers[0].playerId;
}
}
CyanEmuMain.PlayerLeft(player);
playerIDs.Remove(player);
players.Remove(player.playerId);
player.RemoveFromList();
}
public static int GetMasterID()
{
return masterID;
}
public static VRCPlayerApi LocalPlayer()
{
return GetPlayerByID(localPlayerID);
}
public static VRCPlayerApi GetPlayerByID(int playerID)
{
players.TryGetValue(playerID, out VRCPlayerApi player);
return player;
}
public static int GetPlayerID(VRCPlayerApi player)
{
if (player == null)
{
return -1;
}
playerIDs.TryGetValue(player, out int playerId);
return playerId;
}
public static bool IsMaster(VRCPlayerApi player)
{
return GetPlayerID(player) == masterID;
}
public static bool IsInstanceOwner(VRCPlayerApi player)
{
return CyanEmuSettings.Instance.isInstanceOwner;
}
public static bool IsInstanceOwner()
{
return CyanEmuSettings.Instance.isInstanceOwner;
}
public static bool IsLocalPlayerMaster()
{
return localPlayerID == masterID;
}
public static void EnablePickups(VRCPlayerApi player, bool enabled)
{
if (!player.isLocal)
{
player.LogWarning("[VRCPlayerAPI.EnablePickups] EnablePickups for remote players will do nothing.");
return;
}
// TODO
}
public static void Immobilize(VRCPlayerApi player, bool immobilized)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.Immobilize] You cannot set remote players Immobilized");
}
player.GetPlayerController().Immobilize(immobilized);
}
public static void TeleportToOrientationLerp(VRCPlayerApi player, Vector3 position, Quaternion rotation, VRC_SceneDescriptor.SpawnOrientation orientation, bool lerp)
{
if (!player.isLocal)
{
player.LogWarning("[VRCPlayerAPI.TeleportTo] Teleporting remote players will do nothing.");
return;
}
// Ignore lerp since there is no networking here
player.GetPlayerController().Teleport(position, rotation, orientation == VRC_SceneDescriptor.SpawnOrientation.AlignRoomWithSpawnPoint);
}
public static void TeleportToOrientation(VRCPlayerApi player, Vector3 position, Quaternion rotation, VRC_SceneDescriptor.SpawnOrientation orientation)
{
TeleportToOrientationLerp(player, position, rotation, VRC_SceneDescriptor.SpawnOrientation.Default, false);
}
public static void TeleportTo(VRCPlayerApi player, Vector3 position, Quaternion rotation)
{
TeleportToOrientationLerp(player, position, rotation, VRC_SceneDescriptor.SpawnOrientation.Default, false);
}
public static void PlayHapticEventInHand(VRCPlayerApi player, VRC_Pickup.PickupHand hand, float f1, float f2, float f3)
{
if (!player.isLocal)
{
player.LogWarning("[VRCPlayerAPI.PlayHapticEventInHand] PlayHapticEventInHand for remote players will do nothing.");
return;
}
// TODO
}
public static void ClaimNetworkControl(VRCPlayerApi player, VRC_ObjectApi obj)
{
// TODO Is this necessary?
}
public static VRCPlayerApi GetPlayerByGameObject(GameObject obj)
{
CyanEmuPlayer player = obj.GetComponentInParent<CyanEmuPlayer>();
if (player != null)
{
return player.player;
}
return null;
}
public static VRC_Pickup GetPickupInHand(VRCPlayerApi player, VRC_Pickup.PickupHand hand)
{
return player.GetPlayerController().GetHeldPickup(hand);
}
public static VRCPlayerApi.TrackingData GetTrackingData(VRCPlayerApi player, VRCPlayerApi.TrackingDataType trackingDataType)
{
return player.GetPlayerController().GetTrackingData(trackingDataType);
}
public static void TakeOwnership(VRCPlayerApi player, GameObject obj)
{
obj.SetOwner(player);
}
public static VRCPlayerApi GetOwner(GameObject obj)
{
ICyanEmuSyncable sync = obj.GetComponent<ICyanEmuSyncable>();
int playerID = sync != null ? sync.GetOwner() : masterID;
if (!players.TryGetValue(playerID, out VRCPlayerApi player))
{
return null;
}
return player;
}
public static bool IsOwner(VRCPlayerApi player, GameObject obj)
{
ICyanEmuSyncable sync = obj.GetComponent<ICyanEmuSyncable>();
int owner = sync == null ? masterID : sync.GetOwner();
return owner == player.playerId;
}
public static float GetRunSpeed(VRCPlayerApi player)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.GetRunSpeed] You cannot get run speed for remote clients!");
}
return player.GetPlayerController().GetRunSpeed();
}
public static void SetRunSpeed(VRCPlayerApi player, float speed)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.SetRunSpeed] You cannot set run speed for remote clients!");
}
player.GetPlayerController().SetRunSpeed(speed);
}
public static float GetStrafeSpeed(VRCPlayerApi player)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.GetStrafeSpeed] You cannot get strafe speed for remote clients!");
}
return player.GetPlayerController().GetStrafeSpeed();
}
public static void SetStrafeSpeed(VRCPlayerApi player, float speed)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.SetStrafeSpeed] You cannot set strafe speed for remote clients!");
}
player.GetPlayerController().SetStrafeSpeed(speed);
}
public static float GetWalkSpeed(VRCPlayerApi player)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.GetWalkSpeed] You cannot get walk speed for remote clients!");
}
return player.GetPlayerController().GetWalkSpeed();
}
public static void SetWalkSpeed(VRCPlayerApi player, float speed)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.SetWalkSpeed] You cannot set walk speed for remote clients!");
}
player.GetPlayerController().SetWalkSpeed(speed);
}
public static float GetJumpImpulse(VRCPlayerApi player)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.GetJumpImpulse] You cannot get jump impulse for remote clients!");
}
return player.GetPlayerController().GetJump();
}
public static void SetJumpImpulse(VRCPlayerApi player, float jump)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.SetJumpImpulse] You cannot set jump impulse for remote clients!");
}
player.GetPlayerController().SetJump(jump);
}
public static float GetGravityStrength(VRCPlayerApi player)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.GetGravityStrength] You cannot get gravity strength for remote clients!");
}
return player.GetPlayerController().GetGravityStrength();
}
public static void SetGravityStrength(VRCPlayerApi player, float gravity)
{
if (!player.isLocal)
{
throw new Exception("[VRCPlayerAPI.SetGravityStrength] You cannot set gravity strength for remote clients!");
}
player.GetPlayerController().SetGravityStrength(gravity);
}
public static Vector3 GetVelocity(VRCPlayerApi player)
{
if (!player.isLocal)
{
return Vector3.zero;
}
return player.GetPlayerController().GetVelocity();
}
public static void SetVelocity(VRCPlayerApi player, Vector3 velocity)
{
if (!player.isLocal)
{
return;
}
player.GetPlayerController().SetVelocity(velocity);
}
public static Vector3 GetPosition(VRCPlayerApi player)
{
return player.gameObject.transform.position;
}
public static Quaternion GetRotation(VRCPlayerApi player)
{
return player.gameObject.transform.rotation;
}
public static bool IsGrounded(VRCPlayerApi player)
{
if (!player.isLocal)
{
// TODO verify remote player values when not grounded.
return true;
}
return player.GetPlayerController().IsGrounded();
}
public static void UseAttachedStation(VRCPlayerApi player)
{
if (!player.isLocal)
{
return;
}
GameObject obj = null;
#if UDON
// This is dumb
obj = VRC.Udon.UdonManager.Instance.currentlyExecuting.gameObject;
#endif
obj?.GetComponent<CyanEmuStationHelper>()?.UseStation();
}
public static void UseLegacyLocomotion(VRCPlayerApi player)
{
if (!player.isLocal)
{
return;
}
player.GetPlayerController().UseLegacyLocomotion();
}
public static Quaternion GetBoneRotation(VRCPlayerApi player, HumanBodyBones bone)
{
return Quaternion.identity;
}
public static Vector3 GetBonePosition(VRCPlayerApi player, HumanBodyBones bone)
{
return Vector3.zero;
}
public static Transform GetBoneTransform(VRCPlayerApi player, HumanBodyBones bone)
{
// TODO
return null;
}
#region Player Tags
public static List<int> GetPlayersWithTag(string tagName, string tagValue)
{
List<int> players = new List<int>();
foreach (var player in VRCPlayerApi.AllPlayers)
{
if (player.GetCyanEmuPlayer().HasTag(tagName, tagValue))
{
players.Add(player.playerId);
}
}
return players;
}
public static void ClearPlayerTag(VRCPlayerApi player)
{
player.LogError("Clearing all player tags. VRCPlayerApi.ClearPlayerTags is a dangerous call, as it will clear all the tags and this might break prefabs that rely on them.");
player.GetCyanEmuPlayer().ClearTags();
}
public static void SetPlayerTag(VRCPlayerApi player, string tagName, string tagValue)
{
player.GetCyanEmuPlayer().SetTag(tagName, tagValue);
}
public static string GetPlayerTag(VRCPlayerApi player, string tagName)
{
return player.GetCyanEmuPlayer().GetTag(tagName);
}
public static void ClearSilence(VRCPlayerApi player)
{
// TODO?
}
public static void SetSilencedToUntagged(VRCPlayerApi player, int number, string tagName, string tagValue)
{
// TODO?
}
public static void SetSilencedToTagged(VRCPlayerApi player, int number, string tagName, string tagValue)
{
// TODO?
}
public static void ClearInvisible(VRCPlayerApi player)
{
// TODO?
}
public static void SetInvisibleToUntagged(VRCPlayerApi player, bool invisible, string tagName, string tagValue)
{
// TODO?
}
public static void SetInvisibleToTagged(VRCPlayerApi player, bool invisible, string tagName, string tagValue)
{
// TODO?
}
#endregion
#region Player Audio
public static void SetAvatarAudioVolumetricRadius(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetAvatarAudioNearRadius(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetAvatarAudioFarRadius(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetAvatarAudioGain(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetVoiceLowpass(VRCPlayerApi player, bool value)
{
// TODO?
}
public static void SetVoiceVolumetricRadius(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetVoiceDistanceFar(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetVoiceDistanceNear(VRCPlayerApi player, float value)
{
// TODO?
}
public static void SetVoiceGain(VRCPlayerApi player, float value)
{
// TODO?
}
#endregion
/*
TODO all the interfaces:
public static ClaimNetworkControlDelegate ClaimNetworkControl;
public static GetLookRayDelegate GetLookRay;
public static Action<VRCPlayerApi, RuntimeAnimatorController> _PushAnimations;
public static Action<VRCPlayerApi> _PopAnimations;
public static SetAnimatorBoolDelegate SetAnimatorBool;
public static Func<VRCPlayerApi, bool> _isModeratorDelegate;
public static Func<VRCPlayerApi, bool> _isSuperDelegate;
public static Action<VRCPlayerApi, Color> _SetNamePlateColor;
public static Action<VRCPlayerApi> _RestoreNamePlateColor;
public static Action<VRCPlayerApi, bool> _SetNamePlateVisibility;
public static Action<VRCPlayerApi> _RestoreNamePlateVisibility;
*/
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8313fb7d292ed7c40a0f0e6e06a652df
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,69 @@
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using UnityEngine.Serialization;
namespace VRCPrefabs.CyanEmu
{
public class CyanEmuSettings
{
private static CyanEmuSettings instance_;
public static CyanEmuSettings Instance
{
get
{
if (instance_ == null)
{
#if UNITY_EDITOR
instance_ = LoadSettings();
#else
instance_ = new CyanEmuSettings();
#endif
}
return instance_;
}
}
const string CYAN_EMU_SETTINGS_PREFS_STRING = "CyanEmuSettings";
[SerializeField] public bool displaySettingsWindowAtLaunch = true;
[SerializeField] public KeyCode crouchKey = KeyCode.C;
[SerializeField] public KeyCode proneKey = KeyCode.Z;
[SerializeField] public KeyCode runKey = KeyCode.LeftShift;
[SerializeField] public string customLocalPlayerName = "";
// TODO move settings to be per project instead of global to all
[SerializeField] public bool enableCyanEmu = true;
[SerializeField] public bool displayLogs = true;
[SerializeField] public bool deleteEditorOnly = true;
[SerializeField] public bool spawnPlayer = true;
[SerializeField] public bool replayBufferedTriggers = false;
[SerializeField] public bool isInstanceOwner = true;
[SerializeField] public bool showDesktopReticle = true;
#if UNITY_EDITOR
private static CyanEmuSettings LoadSettings()
{
CyanEmuSettings settings = new CyanEmuSettings();
string data = EditorPrefs.GetString(CYAN_EMU_SETTINGS_PREFS_STRING, JsonUtility.ToJson(settings, false));
JsonUtility.FromJsonOverwrite(data, settings);
return settings;
}
public static void SaveSettings(CyanEmuSettings settings)
{
string data = JsonUtility.ToJson(settings, false);
EditorPrefs.SetString(CYAN_EMU_SETTINGS_PREFS_STRING, data);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2bc626fdc39b1b749bd7f4dbaeede6ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,157 @@
using UnityEngine;
using VRC.SDKBase;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class CyanEmuSpatialAudioHelper : ONSPAudioSource
{
private const float EPS_ = 1e-3f;
private VRC_SpatialAudioSource spatialAudioSource_;
private AudioSource audioSource_;
private bool useAudioSourceCurve;
private ONSPAudioSource onsp_;
private bool forceUpdate_ = true;
public static void InitializeAudio(VRC_SpatialAudioSource obj)
{
// Why?
if (!Application.isPlaying || string.IsNullOrEmpty(obj.gameObject.scene.path))
{
return;
}
CyanEmuSpatialAudioHelper spatialAudio = obj.GetComponent<CyanEmuSpatialAudioHelper>();
if (spatialAudio != null)
{
DestroyImmediate(spatialAudio);
}
spatialAudio = obj.gameObject.AddComponent<CyanEmuSpatialAudioHelper>();
spatialAudio.SetSpatializer(obj);
}
private void SetSpatializer(VRC_SpatialAudioSource obj)
{
spatialAudioSource_ = obj;
audioSource_ = GetComponent<AudioSource>();
onsp_ = this;
forceUpdate_ = true;
UpdateSettings();
}
private void OnEnable()
{
// ONSP needs to reapply audio settings everytime the object is enabled.
forceUpdate_ = true;
}
// Late update to help with testing
private void LateUpdate()
{
UpdateSettings();
}
private void UpdateSettings()
{
if (spatialAudioSource_ == null)
{
spatialAudioSource_ = GetComponent<VRC_SpatialAudioSource>();
if (spatialAudioSource_ == null)
{
Destroy(this);
}
SetSpatializer(spatialAudioSource_);
return;
}
// Check if we need to make changes.
if (
onsp_.EnableSpatialization != spatialAudioSource_.EnableSpatialization ||
onsp_.Gain != spatialAudioSource_.Gain ||
onsp_.Near != spatialAudioSource_.Near ||
onsp_.Far != spatialAudioSource_.Far ||
useAudioSourceCurve != spatialAudioSource_.UseAudioSourceVolumeCurve
) {
forceUpdate_ = true;
}
onsp_.EnableSpatialization = spatialAudioSource_.EnableSpatialization;
onsp_.Gain = spatialAudioSource_.Gain;
useAudioSourceCurve = spatialAudioSource_.UseAudioSourceVolumeCurve;
onsp_.Near = spatialAudioSource_.Near;
onsp_.Far = spatialAudioSource_.Far;
onsp_.VolumetricRadius = spatialAudioSource_.VolumetricRadius;
onsp_.SetParameters(ref audioSource_);
if (!onsp_.EnableSpatialization)
{
return;
}
if (!forceUpdate_)
{
return;
}
forceUpdate_ = false;
if (!spatialAudioSource_.UseAudioSourceVolumeCurve)
{
float near = onsp_.VolumetricRadius + onsp_.Near;
float far = onsp_.VolumetricRadius + Mathf.Max(near, onsp_.Far + EPS_);
audioSource_.maxDistance = far;
CreateRolloffCurve(near, far);
CreateSpatialCurve(near, far);
}
}
// Create volume rolloff curve where Volumetric + near is volume 1, then 2^-x fall off to far.
private void CreateRolloffCurve(float near, float far)
{
audioSource_.rolloffMode = AudioRolloffMode.Custom;
AnimationCurve curve = new AnimationCurve();
curve.AddKey(new Keyframe(near, 1));
int max = 8;
for (int loc = 1; loc < max; ++loc)
{
float time = near + Mathf.Pow(2, loc - max) * (far - near);
float value = Mathf.Pow(2.2f, -loc);
curve.AddKey(new Keyframe(time, value));
}
curve.AddKey(new Keyframe(far, 0));
for (int i = 0; i < curve.length; ++i)
{
curve.SmoothTangents(i, 0);
}
audioSource_.SetCustomCurve(AudioSourceCurveType.CustomRolloff, curve);
}
// Create spatial blend curve so that it goes from (Setting) to 3d from min to max
private void CreateSpatialCurve(float near, float far)
{
AnimationCurve spatialCurve = new AnimationCurve();
spatialCurve.AddKey(0, audioSource_.spatialBlend);
spatialCurve.AddKey(onsp_.VolumetricRadius, audioSource_.spatialBlend);
Keyframe nearFrame = new Keyframe(near + EPS_, 1);
nearFrame.outTangent = 0;
spatialCurve.AddKey(nearFrame);
Keyframe farFrame = new Keyframe(far, 1);
farFrame.inTangent = 0;
spatialCurve.AddKey(farFrame);
audioSource_.SetCustomCurve(AudioSourceCurveType.SpatialBlend, spatialCurve);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1c30c850f67fff48a0e69a3e8fa4373
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
using UnityEngine;
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuSpawnHelper : MonoBehaviour
{
public void ReapObject()
{
this.Log("Reaping Object " + name);
Destroy(gameObject);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4612c6a353e960a48a66a06fc3dc3650
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,245 @@
using System.Collections.Generic;
using UnityEngine;
using VRC.SDKBase;
#if UDON
using VRC.Udon;
using VRC.Udon.Common;
#endif
namespace VRCPrefabs.CyanEmu
{
[AddComponentMenu("")]
public class CyanEmuStationHelper : MonoBehaviour, ICyanEmuStationHandler
{
private VRCStation station_;
private bool entered_ = false;
public Transform EnterLocation
{
get
{
return station_.stationEnterPlayerLocation;
}
}
public Transform ExitLocation
{
get
{
return station_.stationExitPlayerLocation;
}
}
public bool IsMobile
{
get
{
return
station_.PlayerMobility == VRCStation.Mobility.Mobile &&
!station_.seated;
}
}
public static void InitializeStations(VRCStation station)
{
CyanEmuStationHelper prevHelper = station.gameObject.GetComponent<CyanEmuStationHelper>();
if (prevHelper != null)
{
DestroyImmediate(prevHelper);
station.LogWarning("Destroying old station helper on object: " + VRC.Tools.GetGameObjectPath(station.gameObject));
}
station.gameObject.AddComponent<CyanEmuStationHelper>();
if (!station.seated && station.PlayerMobility != VRCStation.Mobility.Mobile)
{
station.LogWarning("Station has seated unchecked but is not mobile! " + VRC.Tools.GetGameObjectPath(station.gameObject));
}
}
public static void UseStation(VRCStation station, VRCPlayerApi player)
{
station.GetComponent<CyanEmuStationHelper>().UseStation();
}
public static void ExitStation(VRCStation station, VRCPlayerApi player)
{
station.GetComponent<CyanEmuStationHelper>().ExitStation();
}
private void Awake()
{
station_ = GetComponent<VRCStation>();
CheckForMissingComponents();
if (station_.stationEnterPlayerLocation == null)
{
station_.stationEnterPlayerLocation = transform;
}
if (station_.stationExitPlayerLocation == null)
{
station_.stationExitPlayerLocation = transform;
}
}
private void CheckForMissingComponents()
{
Collider stationCollider = GetComponent<Collider>();
if (stationCollider == null)
{
gameObject.AddComponent<BoxCollider>().isTrigger = true;
}
#if UDON && UNITY_EDITOR
UdonBehaviour udon = GetComponent<UdonBehaviour>();
if (udon == null)
{
udon = gameObject.AddComponent<UdonBehaviour>();
udon.interactText = "Sit";
AbstractUdonProgramSource program = UnityEditor.AssetDatabase.LoadAssetAtPath<AbstractUdonProgramSource>("Assets/VRChat Examples/Prefabs/VRCChair/StationGraph.asset");
if (program != null)
{
udon.AssignProgramAndVariables(program.SerializedProgramAsset, new UdonVariableTable());
}
}
#endif
#if VRC_SDK_VRCSDK2
// Auto add a Interact Trigger to use the station
VRC_Trigger trigger = GetComponent<VRC_Trigger>();
if (trigger == null)
{
trigger = gameObject.AddComponent<VRCSDK2.VRC_Trigger>();
trigger.Triggers = new List<VRC_Trigger.TriggerEvent>();
trigger.interactText = "Sit";
VRC_Trigger.TriggerEvent onInteract = new VRC_Trigger.TriggerEvent
{
BroadcastType = VRC_EventHandler.VrcBroadcastType.Local,
TriggerType = VRC_Trigger.TriggerType.OnInteract,
Events = new List<VRC_EventHandler.VrcEvent>()
};
VRC_EventHandler.VrcEvent useStationEvent = new VRC_EventHandler.VrcEvent
{
EventType = VRC_EventHandler.VrcEventType.SendRPC,
ParameterString = "UseStation",
ParameterObjects = new[] {gameObject},
ParameterInt = 6,
};
onInteract.Events.Add(useStationEvent);
trigger.Triggers.Add(onInteract);
// Reinitialize the trigger now that it has the proper events added.
// Note that this only works as there were no vrc triggers on this object before.
CyanEmuTriggerHelper helper = GetComponent<CyanEmuTriggerHelper>();
if (helper != null)
{
DestroyImmediate(helper);
}
CyanEmuTriggerHelper.InitializeTrigger(trigger);
}
#endif
}
public void UseStation()
{
if (entered_)
{
return;
}
entered_ = true;
if (CyanEmuPlayerController.instance != null)
{
CyanEmuPlayerController.instance.EnterStation(this);
}
gameObject.OnStationEnter(station_);
this.Log("Entering Station " + name);
}
public void ExitStation()
{
if (!entered_)
{
return;
}
entered_ = false;
if (CyanEmuPlayerController.instance != null)
{
CyanEmuPlayerController.instance.ExitStation(this);
}
gameObject.OnStationExit(station_);
this.Log("Exiting Station " + name);
}
// Returns if should move
public bool CanPlayerMoveWhileSeated(float speed)
{
if (Mathf.Abs(speed) >= 0.1f && !station_.disableStationExit)
{
ExitStation();
return true;
}
if (IsMobile)
{
return true;
}
return false;
}
public void UpdatePlayerPosition(CyanEmuPlayerController player)
{
if (IsMobile)
{
return;
}
player.SitPosition(EnterLocation);
}
public void OnStationEnter(VRCStation station)
{
#if VRC_SDK_VRCSDK2
VRCSDK2.VRC_Station s = (VRCSDK2.VRC_Station)station;
if (s.OnLocalPlayerEnterStation.TriggerObject == null)
{
return;
}
VRC_Trigger trigger = s.OnLocalPlayerEnterStation.TriggerObject.GetComponent<VRC_Trigger>();
if (trigger != null)
{
trigger.ExecuteCustomTrigger(s.OnLocalPlayerEnterStation.CustomName);
}
#endif
}
public void OnStationExit(VRCStation station)
{
#if VRC_SDK_VRCSDK2
VRCSDK2.VRC_Station s = (VRCSDK2.VRC_Station)station;
if (s.OnLocalPlayerExitStation.TriggerObject == null)
{
return;
}
VRC_Trigger trigger = s.OnLocalPlayerExitStation.TriggerObject.GetComponent<VRC_Trigger>();
if (trigger != null)
{
trigger.ExecuteCustomTrigger(s.OnLocalPlayerExitStation.CustomName);
}
#endif
}
}
}

Some files were not shown because too many files have changed in this diff Show More