コード例 #1
0
ファイル: SetPhantom.cs プロジェクト: Anusien/Town-Of-Us
        public static void ExileControllerPostfix(ExileController __instance)
        {
            var exiled = __instance.exiled?.Object;

            if (!PlayerControl.LocalPlayer.Data.IsDead && exiled != PlayerControl.LocalPlayer)
            {
                return;
            }
            if (exiled == PlayerControl.LocalPlayer && PlayerControl.LocalPlayer.Is(RoleEnum.Jester))
            {
                return;
            }
            if (PlayerControl.LocalPlayer != WillBePhantom)
            {
                return;
            }

            if (!PlayerControl.LocalPlayer.Is(RoleEnum.Phantom))
            {
                Role.RoleDictionary.Remove(PlayerControl.LocalPlayer.PlayerId);
                var role = new Phantom(PlayerControl.LocalPlayer);
                role.RegenTask();

                RemoveTasks(PlayerControl.LocalPlayer);
                PlayerControl.LocalPlayer.MyPhysics.ResetMoveState();

                System.Console.WriteLine("Become Phantom - Phantom");

                PlayerControl.LocalPlayer.gameObject.layer = LayerMask.NameToLayer("Players");

                var writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                        (byte)CustomRPC.PhantomDied, SendOption.Reliable, -1);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
            }

            if (Role.GetRole <Phantom>(PlayerControl.LocalPlayer).Caught)
            {
                return;
            }
            Vent startingVent =
                ShipStatus.Instance.AllVents[Random.RandomRangeInt(0, ShipStatus.Instance.AllVents.Count)];
            Vector3 destination = Utils.GetCoordinatesToSendPlayerToVent(startingVent);

            PlayerControl.LocalPlayer.NetTransform.RpcSnapTo(destination);
            PlayerControl.LocalPlayer.MyPhysics.RpcEnterVent(startingVent.Id);
        }
コード例 #2
0
ファイル: PerformKill.cs プロジェクト: Anusien/Town-Of-Us
        private static bool CheckSeerChance(PlayerControl target)
        {
            float chance;

            switch (Role.GetRole(target).Faction)
            {
            case Faction.Crewmates:
                chance = CustomGameOptions.SeerCrewmateChance;
                break;

            case Faction.Neutral:
                chance = CustomGameOptions.SeerNeutralChance;
                break;

            case Faction.Impostors:
            default:
                chance = CustomGameOptions.SeerImpostorChance;
                break;
            }

            var seen = Random.RandomRangeInt(1, 101) <= chance;

            return(seen);
        }
コード例 #3
0
ファイル: Random.cs プロジェクト: yaoya/UnityDecompiled
 public static int Range(int min, int max)
 {
     return(Random.RandomRangeInt(min, max));
 }
コード例 #4
0
 public static int Range(int minInclusive, int maxExclusive)
 {
     return(Random.RandomRangeInt(minInclusive, maxExclusive));
 }