-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtilities.cs
61 lines (57 loc) · 1.89 KB
/
Utilities.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using GameNetcodeStuff;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace LvLSystemLC;
public class Utilities
{
private static Dictionary<int, int> _masksByLayer;
public static void Init()
{
GenerateLayerMap();
}
public static void GenerateLayerMap()
{
_masksByLayer = new Dictionary<int, int>();
for (int i = 0; i < 32; i++)
{
int mask = 0;
for (int j = 0; j < 32; j++)
{
if (!Physics.GetIgnoreLayerCollision(i, j))
{
mask |= 1 << j;
}
}
_masksByLayer.Add(i, mask);
}
}
public static int MaskForLayer(int layer)
{
return _masksByLayer[layer];
}
public static void TeleportPlayer(int playerObj, Vector3 teleportPos)
{
PlayerControllerB playerControllerB = StartOfRound.Instance.allPlayerScripts[playerObj];
if ((bool)UnityEngine.Object.FindObjectOfType<AudioReverbPresets>())
{
UnityEngine.Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(playerControllerB);
}
playerControllerB.isInElevator = false;
playerControllerB.isInHangarShipRoom = false;
playerControllerB.isInsideFactory = true;
playerControllerB.averageVelocity = 0f;
playerControllerB.velocityLastFrame = Vector3.zero;
StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos);
StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
if (playerControllerB == GameNetworkManager.Instance.localPlayerController)
{
HUDManager.Instance.ShakeCamera(ScreenShakeType.Big);
}
}
}