コード例 #1
0
        public static void OnDummyDeath(PlayerControl killer)
        {
            // クルーがダミーを殺した場合は本体が死ぬのでカウント対象外とする
            if (!killer.isCrew())
            {
                counter += 1;
            }
            soundFlag = true;

            // 人形遣い死亡時は空キルになるのでクールダウンにしない
            bool isAlive = Puppeteer.allPlayers.FindAll(x => x.isAlive()).Count >= 1;

            if (!isAlive)
            {
                killer.SetKillTimer(0f);
            }

            // 人形遣い専用の処理なので人形遣い以外はreturn
            if (!PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer))
            {
                return;
            }

            // 勝利条件を満たしていたら勝利
            if (counter >= numKills)
            {
                MessageWriter winWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerWin, Hazel.SendOption.Reliable, -1);
                AmongUsClient.Instance.FinishRpcImmediately(winWriter);
                RPCProcedure.puppeteerWin();
            }

            // ダミー死亡時に連動して発動するキル処理
            if (target.isAlive() && isAlive && !killer.isCrew())
            {
                MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerKill, Hazel.SendOption.Reliable, -1);
                killWriter.Write(killer.PlayerId);
                killWriter.Write(target.PlayerId);
                AmongUsClient.Instance.FinishRpcImmediately(killWriter);
                RPCProcedure.puppeteerKill(killer.PlayerId, target.PlayerId);
            }
            else if (isAlive && killer.isCrew()) // ダミーをクルーがキルした場合は人形遣いが死亡する
            {
                MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerKill, Hazel.SendOption.Reliable, -1);
                killWriter.Write(killer.PlayerId);
                killWriter.Write(PlayerControl.LocalPlayer.PlayerId);
                AmongUsClient.Instance.FinishRpcImmediately(killWriter);
                RPCProcedure.puppeteerKill(killer.PlayerId, PlayerControl.LocalPlayer.PlayerId);
            }


            isActive = false;
            canSpawn = false;
            switchStealth(false);
        }
コード例 #2
0
        public static void OnTargetExiled()
        {
            bool isAlive = Puppeteer.allPlayers.FindAll(x => x.isAlive()).Count >= 1;

            if (!target.isImpostor() && !target.isRole(RoleType.Jackal) && isAlive)
            {
                counter += 1;
            }
            if (counter >= numKills && PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer))
            {
                MessageWriter winWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerWin, Hazel.SendOption.Reliable, -1);
                AmongUsClient.Instance.FinishRpcImmediately(winWriter);
                RPCProcedure.puppeteerWin();
            }
        }