示例#1
0
 static void Prefix(Player player)
 {
     if (player == MPObserver.ObservedPlayer)
     {
         MPObserver.SetObservedPlayer(null);
     }
 }
示例#2
0
        static void Postfix(PlayerShip __instance)
        {
            if (MPObserver.Enabled && MPObserver.ObservedPlayer != null && __instance.isLocalPlayer)
            {
                var player = MPObserver.ObservedPlayer;
                __instance.c_transform.position = (__instance.c_transform.position + player.transform.position) / 2;

                if (player.c_player_ship.m_dead || player.c_player_ship.m_dying)
                {
                    __instance.c_transform.position -= MPObserver.LastRotation * (Vector3.forward * 2);
                    __instance.c_transform.rotation  = MPObserver.LastRotation;

                    MPObserver.SetPlayerVisibility(player, true);
                }
                else
                {
                    MPObserver.LastRotation = __instance.c_transform.rotation = Quaternion.Lerp(__instance.c_transform.rotation, MPObserver.ObservedPlayer.transform.rotation, 0.5f);

                    if (MPObserver.ThirdPerson)
                    {
                        __instance.c_transform.position -= __instance.c_transform.rotation * new Vector3(0, -0.5f, 2f);
                    }

                    MPObserver.SetPlayerVisibility(player, MPObserver.ThirdPerson);
                }
            }
        }
示例#3
0
        static void Postfix(CCInput cc_type)
        {
            if (MPObserver.Enabled && GameplayManager.IsMultiplayerActive)
            {
                if (cc_type == CCInput.SWITCH_WEAPON && Controls.JustPressed(CCInput.SWITCH_WEAPON))
                {
                    MPObserver.SwitchObservedPlayer(false);
                }
                if (cc_type == CCInput.PREV_WEAPON && Controls.JustPressed(CCInput.PREV_WEAPON))
                {
                    MPObserver.SwitchObservedPlayer(true);
                }
                if (cc_type == CCInput.FIRE_WEAPON && Controls.JustPressed(CCInput.FIRE_WEAPON) && MPObserver.ObservedPlayer != null)
                {
                    MPObserver.SetObservedPlayer(null);
                }
                if (cc_type == CCInput.FIRE_MISSILE && Controls.JustPressed(CCInput.FIRE_MISSILE) && MPObserver.ObservedPlayer != null)
                {
                    MPObserver.ThirdPerson = !MPObserver.ThirdPerson;

                    MPObserver.SetPlayerVisibility(MPObserver.ObservedPlayer, MPObserver.ThirdPerson);
                    GameManager.m_viewer.SetDamageEffects(-999);
                }
                if (cc_type == CCInput.SWITCH_MISSILE && Controls.JustPressed(CCInput.SWITCH_MISSILE) && CTF.IsActive)
                {
                    var player = (from f in CTF.PlayerHasFlag
                                  join p in Overload.NetworkManager.m_Players on f.Key equals p.netId
                                  where p.m_mp_team == MpTeam.TEAM0
                                  select p).FirstOrDefault();

                    if (player == null)
                    {
                        GameplayManager.AddHUDMessage($"No {MPTeams.TeamName(MpTeam.TEAM0)} player is carrying a flag.");
                    }
                    else
                    {
                        MPObserver.SetObservedPlayer(player);
                    }
                }
                if (cc_type == CCInput.PREV_MISSILE && Controls.JustPressed(CCInput.PREV_MISSILE) && CTF.IsActive)
                {
                    var player = (from f in CTF.PlayerHasFlag
                                  join p in Overload.NetworkManager.m_Players on f.Key equals p.netId
                                  where p.m_mp_team == MpTeam.TEAM1
                                  select p).FirstOrDefault();

                    if (player == null)
                    {
                        GameplayManager.AddHUDMessage($"No {MPTeams.TeamName(MpTeam.TEAM1)} player is carrying a flag.");
                    }
                    else
                    {
                        MPObserver.SetObservedPlayer(player);
                    }
                }
            }
        }
示例#4
0
 static void Postfix()
 {
     //Debug.Log("OnMatchStart player " + GameManager.m_local_player.m_mp_name + " observer " + GameManager.m_local_player.m_spectator);
     if (GameplayManager.IsDedicatedServer() || !GameManager.m_local_player.m_spectator)
     {
         return;
     }
     MPObserver.Enable();
 }
示例#5
0
 static void Prefix()
 {
     foreach (char c in Input.inputString)
     {
         if (code[codeIdx] == c)
         {
             if (++codeIdx < code.Length)
             {
                 continue;
             }
             else if (!GameplayManager.IsMultiplayer)
             {
                 MPObserver.Enable();
             }
         }
         codeIdx = 0;
     }
 }