コード例 #1
0
 public static void PlayerControl_Update(PlayerControl __instance)
 {
     GC.cameraScript.zoomLevel     = BMInterface.GetZoomLevel();
     __instance.myCamera.zoomLevel = BMInterface.GetZoomLevel();
 }
コード例 #2
0
        public static bool ObjectReal_ObjectRealOnCamera(ObjectReal __instance, ref bool __result)
        {
            // Eagle Eye activation range

            if (!__instance.activeObject || __instance.notRealObject)
            {
                __instance.onCamera = false;

                __result = false;
                return(false);
            }

            if ((!GC.coopMode && !GC.fourPlayerMode) || GC.splitScreen)
            {
                float   cameraWidth  = 13f / BMInterface.GetZoomLevel();
                float   cameraHeight = 8f / BMInterface.GetZoomLevel();
                Vector2 curPosition  = GC.playerAgent.agentCamera.curPosition;

                if (curPosition.x > __instance.curPosition.x - cameraWidth &&
                    curPosition.x < __instance.curPosition.x + cameraWidth &&
                    curPosition.y > __instance.curPosition.y - cameraHeight &&
                    curPosition.y < __instance.curPosition.y + cameraHeight)
                {
                    __instance.onCamera = true;

                    __result = true;
                    return(false);
                }

                if (GC.coopMode || GC.fourPlayerMode)
                {
                    curPosition = GC.playerAgent2.agentCamera.curPosition;

                    if (curPosition.x > __instance.curPosition.x - cameraWidth &&
                        curPosition.x < __instance.curPosition.x + cameraWidth &&
                        curPosition.y > __instance.curPosition.y - cameraHeight &&
                        curPosition.y < __instance.curPosition.y + cameraHeight)
                    {
                        __instance.onCamera = true;

                        __result = true;
                        return(false);
                    }

                    if (GC.fourPlayerMode)
                    {
                        curPosition = GC.playerAgent3.agentCamera.curPosition;

                        if (curPosition.x > __instance.curPosition.x - cameraWidth &&
                            curPosition.x < __instance.curPosition.x + cameraWidth &&
                            curPosition.y > __instance.curPosition.y - cameraHeight &&
                            curPosition.y < __instance.curPosition.y + cameraHeight)
                        {
                            __instance.onCamera = true;

                            __result = true;
                            return(false);
                        }

                        if (!GC.sessionDataBig.threePlayer)
                        {
                            curPosition = GC.playerAgent4.agentCamera.curPosition;

                            if (curPosition.x > __instance.curPosition.x - cameraWidth &&
                                curPosition.x < __instance.curPosition.x + cameraWidth &&
                                curPosition.y > __instance.curPosition.y - cameraHeight &&
                                curPosition.y < __instance.curPosition.y + cameraHeight)
                            {
                                __instance.onCamera = true;

                                __result = true;
                                return(false);
                            }
                        }
                    }
                }
            }
            else
            {
                Vector2 vector = GC.playerAgent.agentCamera.originalCamera.WorldToViewportPoint(__instance.curPosition);

                if (vector.x > -0.1f &&
                    vector.x < 1.1f &&
                    vector.y > -0.1f &&
                    vector.y < 1.1f)
                {
                    __instance.onCamera = true;

                    __result = true;
                    return(false);
                }

                if (GC.coopMode || GC.fourPlayerMode)
                {
                    vector = GC.playerAgent2.agentCamera.originalCamera.WorldToViewportPoint(__instance.curPosition);
                    if (vector.x > -0.1f &&
                        vector.x < 1.1f &&
                        vector.y > -0.1f &&
                        vector.y < 1.1f)
                    {
                        __instance.onCamera = true;

                        __result = true;
                        return(false);
                    }

                    if (GC.fourPlayerMode)
                    {
                        vector = GC.playerAgent3.agentCamera.originalCamera.WorldToViewportPoint(__instance.curPosition);
                        if (vector.x > -0.1f &&
                            vector.x < 1.1f &&
                            vector.y > -0.1f &&
                            vector.y < 1.1f)
                        {
                            __instance.onCamera = true;

                            __result = true;
                            return(false);
                        }

                        if (!GC.sessionDataBig.threePlayer)
                        {
                            vector = GC.playerAgent4.agentCamera.originalCamera.WorldToViewportPoint(__instance.curPosition);
                            if (vector.x > -0.1f &&
                                vector.x < 1.1f &&
                                vector.y > -0.1f &&
                                vector.y < 1.1f)
                            {
                                __instance.onCamera = true;

                                __result = true;
                                return(false);
                            }
                        }
                    }
                }
            }

            __instance.onCamera = false;

            __result = false;
            return(false);
        }
コード例 #3
0
        public static bool AgentOnCamera_Prefix(Agent __instance, ref bool __result)
        {
            if (__instance.isPlayer != 0)
            {
                __instance.onCamera = true;

                __result = true;
                return(false);
            }

            if (GC.serverPlayer)
            {
                if ((!__instance.brain.active && !__instance.oma._dead && !__instance.frozen && !__instance.wasPossessed2 && GC.serverPlayer &&
                     GC.loadCompleteReally && !GC.loadLevel.recentlyStartedLevel && !__instance.oma.mindControlled) || __instance.objectAgent)
                {
                    __instance.onCamera = false;

                    __result = false;
                    return(false);
                }
            }
            else if ((!__instance.brain.active && !__instance.dead && !__instance.frozen && !__instance.wasPossessed2 && GC.serverPlayer &&
                      GC.loadCompleteReally && !GC.loadLevel.recentlyStartedLevel) || __instance.objectAgent)
            {
                __instance.onCamera = false;

                __result = false;
                return(false);
            }

            Vector2 v      = __instance.tr.position;
            Vector2 vector = GC.playerAgent.agentCamera.originalCamera.WorldToViewportPoint(v);
            float   x      = vector.x / BMInterface.GetZoomLevel();
            float   y      = vector.y / BMInterface.GetZoomLevel();

            if (x > -0.1f && x < 1.1f &&
                y > -0.1f && y < 1.1f)
            {
                __instance.onCamera = true;

                __result = true;
                return(false);
            }

            if (GC.coopMode || GC.fourPlayerMode)
            {
                vector = GC.playerAgent2.agentCamera.originalCamera.WorldToViewportPoint(v);
                x      = vector.x / BMInterface.GetZoomLevel();
                y      = vector.y / BMInterface.GetZoomLevel();

                if (x > -0.1f && x < 1.1f &&
                    y > -0.1f && y < 1.1f)
                {
                    __instance.onCamera = true;

                    __result = true;
                    return(false);
                }

                if (GC.fourPlayerMode)
                {
                    vector = GC.playerAgent3.agentCamera.originalCamera.WorldToViewportPoint(v);
                    x      = vector.x / BMInterface.GetZoomLevel();
                    y      = vector.y / BMInterface.GetZoomLevel();

                    if (x > -0.1f && x < 1.1f &&
                        y > -0.1f && y < 1.1f)
                    {
                        __instance.onCamera = true;

                        __result = true;
                        return(false);
                    }
                    if (!GC.sessionDataBig.threePlayer)
                    {
                        vector = GC.playerAgent4.agentCamera.originalCamera.WorldToViewportPoint(v);
                        x      = vector.x / BMInterface.GetZoomLevel();
                        y      = vector.y / BMInterface.GetZoomLevel();

                        if (x > -0.1f && x < 1.1f &&
                            y > -0.1f && y < 1.1f)
                        {
                            __instance.onCamera = true;

                            __result = true;
                            return(false);
                        }
                    }
                }
            }

            __instance.onCamera = false;

            __result = false;
            return(false);
        }