private void Start()
 {
     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.MULTIPLAYER)
     {
         if (!baseG.GetPhotonView().isMine)
         {
             base.enabled = false;
             return;
         }
         EnemyfxIDcontainer xf = baseG.GetComponent <EnemyfxIDcontainer>();
         if (xf != null)
         {
             this.viewID    = xf.myOwnerViewID;
             this.ownerName = xf.titanName;
             this.myTeam    = PhotonView.Find(this.viewID).gameObject.GetComponent <HERO>().myTeam;
         }
     }
     else
     {
         this.myTeam = IN_GAME_MAIN_CAMERA.instance.main_objectH.myTeam;
     }
     this.active_me     = true;
     this.count         = 0;
     this.currentCamera = CyanMod.CachingsGM.Find("MainCamera");
     currentCameraT     = currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>();
 }
 private void Awake()
 {
     Instance  = this;
     isTyping  = false;
     isPausing = false;
     name      = "MainCamera";
     CreateMinimap();
 }
Example #3
0
        private static IEnumerator CoMarkHudDirty(IN_GAME_MAIN_CAMERA mainCamera)
        {
            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            mainCamera.needSetHUD = true;
        }
Example #4
0
        private static string GetImage()
        {
            largeImageKey = "logo_large";
            foreach (var location in Locations)
            {
                if (FengGameManagerMKII.level.ToLower().Contains(location))
                {
                    largeImageKey = location;
                    break;
                }
            }

            if ((FengGameManagerMKII.level.ToLower().Contains("forest") || FengGameManagerMKII.level.ToLower().Contains("city")) && largeImageKey != "logo_large")
            {
                return($"{largeImageKey}_{IN_GAME_MAIN_CAMERA.GetDayLight().ToLower()}");
            }

            return(largeImageKey);
        }
Example #5
0
        public static void UpdateStatus()
        {
            if (!PhotonNetwork.inRoom)
            {
                if (PhotonNetwork.insideLobby)
                {
                    presence.details   = "Lobby";
                    presence.state     = PhotonNetwork.GetLobbyName();
                    presence.partySize = 0;
                    presence.partyMax  = 0;
                }
                else if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                {
                    presence.details        = "Singleplayer";
                    presence.largeImageKey  = GetImage();
                    presence.largeImageText = $"{FengGameManagerMKII.level}/{IN_GAME_MAIN_CAMERA.GetDifficulty()}/{IN_GAME_MAIN_CAMERA.GetDayLight()}";
                    presence.state          = $"{FengGameManagerMKII.single_kills}/{FengGameManagerMKII.single_maxDamage}/{FengGameManagerMKII.single_totalDamage}";
                    presence.partySize      = 0;
                    presence.partyMax       = 0;
                }
                else
                {
                    presence.details        = "Main Menu";
                    presence.state          = $"Version {UIMainReferences.Version}";
                    presence.largeImageKey  = "logo_large";
                    presence.largeImageText = "Art by https://vk.com/bishoptyan";
                    presence.partySize      = 0;
                    presence.partyMax       = 0;
                }
            }
            else
            {
                presence.details        = "Multiplayer";
                presence.state          = PhotonNetwork.GetRoomName().Length > 14 ? PhotonNetwork.GetRoomName().Remove(12) + "..." : PhotonNetwork.GetRoomName();
                presence.largeImageKey  = GetImage();
                presence.largeImageText = $"{FengGameManagerMKII.level}/{IN_GAME_MAIN_CAMERA.GetDifficulty()}/{IN_GAME_MAIN_CAMERA.GetDayLight()}";
                presence.partySize      = PhotonNetwork.room.playerCount;
                presence.partyMax       = PhotonNetwork.room.maxPlayers;
            }

            DiscordAPI.UpdatePresence(presence);
        }
Example #6
0
    private void updateCostume(int id)
    {
        IN_GAME_MAIN_CAMERA component = GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>();
        HeroCostume         costume2  = CostumeConeveter.LocalDataToHeroCostume("SET " + id);

        component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().init();

        if (costume2 != null)
        {
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume      = costume2;
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume.stat = costume2.stat;
        }
        else
        {
            costume2 = HeroCostume.costumeOption[3];
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume      = costume2;
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume.stat = HeroStat.getInfo(costume2.name.ToUpper());
        }

        component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().setCharacterComponent();
        component.main_object.GetComponent <HERO>().setStat();
        component.main_object.GetComponent <HERO>().setSkillHUDPosition();
    }
 private void Start()
 {
     this.currentCamera = GameObject.Find("MainCamera");
     currentCameraT     = currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>();
     base.gameObject.renderer.material.mainTexture = Color.cyan.toTexture1();
 }
 private void Start()
 {
     this.hero       = (this.heroG = (this.baseT = base.transform).root.gameObject).GetComponent <HERO>();
     this.basePV     = this.baseT.root.GetComponent <PhotonView>();
     this.mainCamera = IN_GAME_MAIN_CAMERA.mainCamera;
 }
Example #9
0
 public void AddCamera(IN_GAME_MAIN_CAMERA c)
 {
     mainCamera = c;
 }
Example #10
0
        private void Update()
        {
            if (FengGameManagerMKII.inputManager != null)
            {
                if (FengGameManagerMKII.inputManager.menuOn)
                {
                    return;
                }
            }
            else
            {
                return;
            }

            //Restarts and clears all stats.
            if (Restart.IsDown())
            {
                if (IN_GAME_MAIN_CAMERA.gametype != GAMETYPE.SINGLE)
                {
                    if (PhotonNetwork.isMasterClient)
                    {
                        foreach (var player in PhotonNetwork.playerList)
                        {
                            var stats = new Hashtable {
                                { PhotonPlayerProperty.kills, 0 }, { PhotonPlayerProperty.deaths, 0 }, { PhotonPlayerProperty.max_dmg, 0 }, { PhotonPlayerProperty.total_dmg, 0 }
                            };
                            player.SetCustomProperties(stats);
                        }

                        FengGameManagerMKII.FGM.restartRC();
                        string[] msg = { "MasterClient ", "has restarted the game." };
                        InRoomChat.SystemMessageGlobal(msg, false);
                    }
                    else
                    {
                        InRoomChat.SystemMessageLocal(InRoomChat.Error(0));
                        return;
                    }
                }
                else
                {
                    FengGameManagerMKII.FGM.restartGameSingle();
                }
            }

            //Captures a screenshot
            if (Screenshot.IsDown())
            {
                var path = Application.dataPath + "/Screenshots";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                Application.CaptureScreenshot(Application.dataPath + "/Screenshots/Screenshot_" + DateTime.Now.ToString("yyyy:mm:dd:hh:mm:ss").Replace(":", "-") + ".png");
            }

            //Is your mod non-abusive? WELL YES BUT ACTUALLY NO.
            if (Infinites.IsDown())
            {
                Settings.InfiniteBulletsSetting.Value = !Settings.InfiniteBulletsSetting;
                Settings.InfiniteGasSetting.Value     = !Settings.InfiniteGasSetting;
                Settings.InfiniteBladesSetting.Value  = !Settings.InfiniteBladesSetting;
            }

            //Pause
            if (Pause.IsDown())
            {
                switch (IN_GAME_MAIN_CAMERA.gametype)
                {
                case GAMETYPE.MULTIPLAYER:
                    FengGameManagerMKII.FGM.SetPause(Time.timeScale == 1);
                    break;

                case GAMETYPE.SINGLE:
                    if (Time.timeScale == 1f)
                    {
                        IN_GAME_MAIN_CAMERA.LockCamera(true);
                        Time.timeScale = 0f;
                    }
                    else
                    {
                        Time.timeScale = 1f;
                        IN_GAME_MAIN_CAMERA.LockCamera(false);
                    }
                    break;
                }
            }

            //CannonSpawn
            if (CannonSpawn.IsDown())
            {
                if (PhotonNetwork.isMasterClient)
                {
                    RaycastHit hitInfo;
                    if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo, 9999999f, Layer.GroundEnemy.value))
                    {
                        var vector     = hitInfo.point;
                        var objToSpawn = Settings.CannonTypeSetting == 0 ? "RCAsset/CannonGroundProp" : "RCAsset/CannonWallProp";
                        var obj        = PhotonNetwork.Instantiate(objToSpawn, vector, new Quaternion(0, 0, 0, 0), 0);
                        if (objToSpawn == "RCAsset/CannonWallProp")
                        {
                            var      cpr   = obj.GetComponent <CannonPropRegion>();
                            string[] array = new string[7];
                            array[0] = " photon,CannonWall,default,1,1,1,0,1,1,1,1.0,1.0,";
                            string[] array2 = array;
                            int      num    = 1;
                            array2[num] = vector.x.ToString();
                            array[2]    = ",";
                            string[] array3 = array;
                            int      num2   = 3;
                            array3[num2] = vector.y.ToString();
                            array[4]     = ",";
                            string[] array4 = array;
                            int      num3   = 5;
                            array4[num3] = vector.z.ToString();
                            array[6]     = ",0,0,0,0";
                            cpr.settings = string.Concat(array);
                        }
                        else if (objToSpawn == "RCAsset/CannonGroundProp")
                        {
                            var      cpr   = obj.GetComponent <CannonPropRegion>();
                            string[] array = new string[7];
                            array[0] = " photon,CannonGround,default,1,1,1,0,1,1,1,1.0,1.0,";
                            string[] array2 = array;
                            int      num    = 1;
                            array2[num] = vector.x.ToString();
                            array[2]    = ",";
                            string[] array3 = array;
                            int      num2   = 3;
                            array3[num2] = vector.y.ToString();
                            array[4]     = ",";
                            string[] array4 = array;
                            int      num3   = 5;
                            array4[num3] = vector.z.ToString();
                            array[6]     = ",0,0,0,0";
                            cpr.settings = string.Concat(array);
                        }
                    }
                }
            }
        }
Example #11
0
    public void Update()
    {
        if (!photonView.isMine)
        {
            transform.position = Vector3.Lerp(transform.position, correctPlayerPos, Time.deltaTime * SmoothingDelay);
            transform.rotation = Quaternion.Lerp(transform.rotation, correctPlayerRot, Time.deltaTime * SmoothingDelay);
            barrel.rotation    = Quaternion.Lerp(barrel.rotation, correctBarrelRot, Time.deltaTime * SmoothingDelay);
        }
        else
        {
            var vector   = new Vector3(0f, -30f, 0f);
            var position = ballPoint.position;
            var vector3  = ballPoint.forward * 300f;
            var num      = 40f / vector3.magnitude;
            myCannonLine.SetWidth(0.5f, 40f);
            myCannonLine.SetVertexCount(100);
            for (var i = 0; i < 100; i++)
            {
                myCannonLine.SetPosition(i, position);
                position += vector3 * num + 0.5f * vector * num * num;
                vector3  += vector * num;
            }

            var num3 = 30f;
            if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonSlow))
            {
                num3 = 5f;
            }

            if (isCannonGround)
            {
                if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonForward))
                {
                    if (currentRot <= 32f)
                    {
                        currentRot += Time.deltaTime * num3;
                        barrel.Rotate(new Vector3(0f, 0f, Time.deltaTime * num3));
                    }
                }
                else if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonBack) && currentRot >= -18f)
                {
                    currentRot += Time.deltaTime * -num3;
                    barrel.Rotate(new Vector3(0f, 0f, Time.deltaTime * -num3));
                }

                if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonLeft))
                {
                    transform.Rotate(new Vector3(0f, Time.deltaTime * -num3, 0f));
                }
                else if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonRight))
                {
                    transform.Rotate(new Vector3(0f, Time.deltaTime * num3, 0f));
                }
            }
            else
            {
                if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonForward))
                {
                    if (currentRot >= -50f)
                    {
                        currentRot += Time.deltaTime * -num3;
                        barrel.Rotate(new Vector3(Time.deltaTime * -num3, 0f, 0f));
                    }
                }
                else if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonBack) && currentRot <= 40f)
                {
                    currentRot += Time.deltaTime * num3;
                    barrel.Rotate(new Vector3(Time.deltaTime * num3, 0f, 0f));
                }

                if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonLeft))
                {
                    transform.Rotate(new Vector3(0f, Time.deltaTime * -num3, 0f));
                }
                else if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonRight))
                {
                    transform.Rotate(new Vector3(0f, Time.deltaTime * num3, 0f));
                }
            }
            if (HotKeys.CannonForward.IsPressed())
            {
                base.transform.Translate(Vector3.forward * Settings.CannonMovementSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonBackward.IsPressed())
            {
                base.transform.Translate(-Vector3.forward * Settings.CannonMovementSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonTurnLeft.IsPressed())
            {
                base.transform.Rotate(-Vector3.up * Settings.CannonMovementSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonTurnRight.IsPressed())
            {
                base.transform.Rotate(Vector3.up * Settings.CannonMovementSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonUp.IsPressed())
            {
                base.transform.Translate(Vector3.up * Settings.CannonMovementSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonDown.IsPressed())
            {
                base.transform.Translate(-Vector3.up * Settings.CannonMovementSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonTurnUp.IsPressed())
            {
                base.transform.Rotate(Vector3.left * Settings.CannonRotateSpeedSetting * Time.deltaTime);
            }
            if (HotKeys.CannonTurnDown.IsPressed())
            {
                base.transform.Rotate(-Vector3.left * Settings.CannonRotateSpeedSetting * Time.deltaTime);
            }

            if (FengGameManagerMKII.inputRC.isInputCannon(InputCodeRC.cannonFire))
            {
                Fire();
            }
            else if (FengGameManagerMKII.inputRC.isInputCannonDown(InputCodeRC.cannonMount))
            {
                if (myHero != null)
                {
                    myHero.isCannon       = false;
                    myHero.myCannonRegion = null;
                    Camera.main.GetComponent <IN_GAME_MAIN_CAMERA>().setMainObject(myHero.gameObject);
                    myHero.baseRigidBody.velocity = Vector3.zero;
                    myHero.photonView.RPC("ReturnFromCannon", PhotonTargets.Others);
                    myHero.skillCDLast     = myHero.skillCDLastCannon;
                    myHero.skillCDDuration = myHero.skillCDLast;
                    IN_GAME_MAIN_CAMERA.LockCamera(false);
                }

                PhotonNetwork.Destroy(gameObject);
            }
        }
    }