Exemple #1
0
 /// <summary>
 /// Enables GameObject using cache.
 /// </summary>
 /// <param name="str"></param>
 public static void EnableObject(string str)
 {
     if (GameObjectCache.Find(str))
     {
         GameObjectCache.Find(str).SetActive(true);
     }
 }
 private void reset()
 {
     if (gametype == GAMETYPE.SINGLE)
     {
         GameObjectCache.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().restartGameSingle();
     }
 }
Exemple #3
0
 /// <summary>
 /// Disables GameObject using cache.
 /// </summary>
 /// <param name="str"></param>
 public static void DisableObject(string str)
 {
     if (GameObjectCache.Find(str))
     {
         GameObjectCache.Find(str).SetActive(false);
     }
 }
Exemple #4
0
    void ResizeCellCount(int cellCount)
    {
        if (cellCache == null)
        {
            cellCache = new GameObjectCache();
            cellCache.autoUnactive = false;
            cellCache.Init(this.content, cellTemplate);
        }

        if (allCells.Count < cellCount)
        {
            int addCount = cellCount - allCells.Count;
            for (int i = 0; i < addCount; ++i)
            {
                allCells.Add(null);
            }
        }
        else if (allCells.Count > cellCount)
        {
            for (int i = allCells.Count - 1; i >= cellCount; --i)
            {
                ReleaseCell(allCells[i]);
                allCells.RemoveAt(i);
            }
        }

        this.cellCount = allCells.Count;
    }
    public void setDayLight(DayLight val)
    {
        dayLight = val;
        bool custom = Settings.CustomAmbientSetting;

        switch (dayLight)
        {
        case DayLight.Night:
            var obj2 = (GameObject)Instantiate(Resources.Load("flashlight"));
            obj2.transform.parent       = transform;
            obj2.transform.position     = transform.position;
            obj2.transform.rotation     = Quaternion.Euler(353f, 0f, 0f);
            RenderSettings.ambientLight = custom ? new Color(Settings.CustomAmbientColorSetting[2][0], Settings.CustomAmbientColorSetting[2][1], Settings.CustomAmbientColorSetting[2][2]) : FengColor.nightAmbientLight;
            GameObjectCache.Find("mainLight").GetComponent <Light>().color = FengColor.nightLight;
            gameObject.GetComponent <Skybox>().material = skyBoxNIGHT;
            break;

        case DayLight.Day:
            RenderSettings.ambientLight = custom ? new Color(Settings.CustomAmbientColorSetting[0][0], Settings.CustomAmbientColorSetting[0][1], Settings.CustomAmbientColorSetting[0][2]) : FengColor.dayLight;
            GameObjectCache.Find("mainLight").GetComponent <Light>().color = FengColor.dayLight;
            gameObject.GetComponent <Skybox>().material = skyBoxDAY;
            break;

        case DayLight.Dawn:
            RenderSettings.ambientLight = custom ? new Color(Settings.CustomAmbientColorSetting[1][0], Settings.CustomAmbientColorSetting[1][1], Settings.CustomAmbientColorSetting[1][2]) : FengColor.dawnAmbientLight;
            GameObjectCache.Find("mainLight").GetComponent <Light>().color = FengColor.dawnAmbientLight;
            gameObject.GetComponent <Skybox>().material = skyBoxDAWN;
            break;
        }

        snapShotCamera.gameObject.GetComponent <Skybox>().material = gameObject.GetComponent <Skybox>().material;
    }
Exemple #6
0
    private void Start()
    {
        EventMgr.initEvent.OnStart();
        DontDestroyOnLoad(gameObject);
        GameObjectCache.Init();
        isInit = true;//初始化完毕

        if (BuildDataPath)
        {
            // 建立单位数据路径
            string[] paths = GameDB.Instance.unitDataPath.paths = new string[(int)UnitName.MaxIndex];
            for (int i = 0; i < paths.Length; i++)
            {
                paths[i] = "Unit/" + ((UnitName)i).ToString() + "Data";
            }
            // 建立技能数据路径
            paths = GameDB.Instance.skillDataPath.paths = new string[GameDB.MAX_SKILL_INDEX];
            foreach (SkillName name in Enum.GetValues(typeof(SkillName)))
            {
                int i = (int)name;
                paths[i] = "Skill/" + name + "Data";
            }
            // 建立Prefab路径
            Array enums = Enum.GetValues(typeof(PrefabName));
            paths = GameDB.Instance.prefabPath.paths = new string[enums.Length];
            foreach (PrefabName name in enums)
            {
                int i = (int)name;
                paths[i] = name.ToString();
            }
        }

        //加载游戏场景
        SceneManager.LoadSceneAsync(GameDB.MyScene.GameScene);
    }
Exemple #7
0
        public void SetUp()
        {
            containingObject = new GameObject();
#pragma warning disable 0618
            subject = containingObject.AddComponent <GameObjectCache>();
#pragma warning restore 0618
        }
Exemple #8
0
    public static GameObjectCache CreateCache(uint count, GameObject objPrefab, Transform objParent)
    {
        GameObjectCache cache = new GameObjectCache();

        cache.mPrefab = objPrefab;
        cache.mParent = objParent;
        cache.Create(count);
        return(cache);
    }
 private void Start()
 {
     GameObjectCache.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().addCamera(this);
     isPausing    = false;
     inputManager = GameObjectCache.Find("InputManagerController").GetComponent <FengCustomInputs>();
     setDayLight(dayLight);
     locker = GameObjectCache.Find("locker");
     createSnapShotRT();
 }
    public void snapShotUpdate()
    {
        if (startSnapShotFrameCount)
        {
            snapShotStartCountDownTime -= Time.deltaTime;
            if (snapShotStartCountDownTime <= 0f)
            {
                snapShot2(1);
                startSnapShotFrameCount = false;
            }
        }

        if (hasSnapShot)
        {
            snapShotCountDown -= Time.deltaTime;
            if (snapShotCountDown <= 0f)
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = false;
                hasSnapShot       = false;
                snapShotCountDown = 0f;
            }
            else if (snapShotCountDown < 1f)
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture = snapshot3;
            }
            else if (snapShotCountDown < 1.5f)
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture = snapshot2;
            }

            if (snapShotCount < 3)
            {
                snapShotInterval -= Time.deltaTime;
                if (snapShotInterval <= 0f)
                {
                    snapShotInterval = 0.05f;
                    snapShotCount++;
                    snapShot2(snapShotCount);
                }
            }
        }
    }
Exemple #11
0
    private void Start()
    {
        EventMgr.initEvent.OnStart();
        DontDestroyOnLoad(gameObject);
        GameObjectCache.Init();
        isInit = true;//初始化完毕

        if (BuildDataPath)
        {
            Build();
        }

        ////加载游戏场景
        //if (check)
        //{
        //    SceneManager.LoadSceneAsync(gameScene);
        //}
        //else
        //    SceneManager.LoadSceneAsync(GameDB.MyScene.GameScene);

        //SceneManager.LoadSceneAsync("Demo_Exterior");
    }
Exemple #12
0
    public override bool Initialize(string defaultWorldName)
    {
        var defaultWorld       = CreateDefaultWorld("Default World");
        var subSceneReferences = GameObject.FindObjectOfType <SubSceneReferencesSingleton>().CreateInstance();

        // Server initialization
        if (RequestedPlayType != PlayType.Client)
        {
            var serverWorld   = CreateServerWorld(defaultWorld, "Server World");
            var networkStream = serverWorld.GetExistingSystem <NetworkStreamReceiveSystem>();
            var endPoint      = NetworkEndPoint.AnyIpv4;

            // SubSceneRequestSystem.CreateSubSceneLoadRequest(serverWorld.EntityManager, subSceneReferences.StaticGeometry.SceneGUID);
            // SubSceneRequestSystem.CreateSubSceneLoadRequest(serverWorld.EntityManager, subSceneReferences.GameState.SceneGUID);
            endPoint.Port = DEFAULT_PORT;
            networkStream.Listen(endPoint);
            UnityEngine.Debug.Log($"Server listening on port {endPoint.Port}.");
        }

        // Client initialization
        if (RequestedPlayType != PlayType.Server)
        {
            var clientWorld       = CreateClientWorld(defaultWorld, "Client World");
            var applicationWorld  = CreateClientApplicationWorld(clientWorld, "Client Application World");
            var gameObjectPrefabs = Resources.LoadAll <GameObject>("");
            var audioClips        = Resources.LoadAll <AudioClip>("");
            var gameObjectCache   = GameObjectCache.FromResources(gameObjectPrefabs);
            var audioClipCache    = AudioClipCache.FromResources(audioClips);
            var cachesEntity      = clientWorld.EntityManager.CreateEntity(typeof(GameObjectCache), typeof(AudioClipCache));

            clientWorld.EntityManager.AddComponentData(cachesEntity, gameObjectCache);
            clientWorld.EntityManager.AddComponentData(cachesEntity, audioClipCache);
        }

        return(true);
    }
    public void update()
    {
        if (Settings.MinimapSetting && RCSettings.globalDisableMinimap != 1 && !Minimap.instance.isEnabled)
        {
            gameObject.GetComponent <Minimap>().SetEnabled(true);
            Minimap.TryRecaptureInstance();
        }

        if (flashDuration > 0f)
        {
            flashDuration -= Time.deltaTime;
            if (flashDuration <= 0f)
            {
                flashDuration = 0f;
            }

            GameObjectCache.Find("flash").GetComponent <UISprite>().alpha = flashDuration * 0.5f;
        }

        if (gametype == GAMETYPE.STOP)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        }
        else
        {
            if (gametype != GAMETYPE.SINGLE && gameOver)
            {
                if (inputManager.isInputDown[InputCode.attack1])
                {
                    if (spectatorMode)
                    {
                        setSpectorMode(false);
                    }
                    else
                    {
                        setSpectorMode(true);
                    }
                }

                if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    currentPeekPlayerIndex++;
                    var length = GameObject.FindGameObjectsWithTag("Player").Length;
                    if (currentPeekPlayerIndex >= length)
                    {
                        currentPeekPlayerIndex = 0;
                    }

                    if (length > 0)
                    {
                        setMainObject(GameObject.FindGameObjectsWithTag("Player")[currentPeekPlayerIndex]);
                        setSpectorMode(false);
                        lockAngle = false;
                    }
                }

                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    currentPeekPlayerIndex--;
                    var num2 = GameObject.FindGameObjectsWithTag("Player").Length;
                    if (currentPeekPlayerIndex >= num2)
                    {
                        currentPeekPlayerIndex = 0;
                    }

                    if (currentPeekPlayerIndex < 0)
                    {
                        currentPeekPlayerIndex = num2;
                    }

                    if (num2 > 0)
                    {
                        setMainObject(GameObject.FindGameObjectsWithTag("Player")[currentPeekPlayerIndex]);
                        setSpectorMode(false);
                        lockAngle = false;
                    }
                }

                if (spectatorMode)
                {
                    return;
                }
            }

            if (inputManager.isInputDown[InputCode.pause])
            {
                if (isPausing)
                {
                    if (main_object != null)
                    {
                        var position = transform.position;
                        position           = head == null ? main_object.transform.position : head.transform.position;
                        position          += Vector3.up * heightMulti;
                        transform.position = Vector3.Lerp(transform.position, position - transform.forward * 5f, 0.2f);
                    }

                    return;
                }

                isPausing = !isPausing;
                if (isPausing)
                {
                    if (gametype == GAMETYPE.SINGLE)
                    {
                        Time.timeScale = 0f;
                    }

                    GameObjectCache.Find("InputManagerController").GetComponent <FengCustomInputs>().menuOn = true;
                    Page.GetInstance <PauseMenu>().Enable();
                    Screen.showCursor = true;
                    Screen.lockCursor = false;
                }
            }

            if (needSetHUD)
            {
                needSetHUD = false;
                setHUDposition();
                Screen.lockCursor = !Screen.lockCursor;
                Screen.lockCursor = !Screen.lockCursor;
            }

            if (inputManager.isInputDown[InputCode.fullscreen])
            {
                Screen.fullScreen = !Screen.fullScreen;
                if (Screen.fullScreen)
                {
                    Screen.SetResolution(960, 600, false);
                }
                else
                {
                    Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
                }

                needSetHUD = true;
                Minimap.OnScreenResolutionChanged();
            }

            if (inputManager.isInputDown[InputCode.restart])
            {
                reset();
            }

            if (main_object != null)
            {
                RaycastHit hit;
                if (inputManager.isInputDown[InputCode.camera])
                {
                    switch (cameraMode)
                    {
                    case CAMERA_TYPE.ORIGINAL:
                        if (Settings.CameraTypeSettings[2])
                        {
                            cameraMode        = CAMERA_TYPE.WOW;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[1])
                        {
                            cameraMode        = CAMERA_TYPE.TPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[3])
                        {
                            cameraMode        = CAMERA_TYPE.OLDTPS;
                            Screen.lockCursor = true;
                        }

                        break;

                    case CAMERA_TYPE.WOW:
                        if (Settings.CameraTypeSettings[1])
                        {
                            cameraMode        = CAMERA_TYPE.TPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[3])
                        {
                            cameraMode        = CAMERA_TYPE.OLDTPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[0])
                        {
                            cameraMode        = CAMERA_TYPE.ORIGINAL;
                            Screen.lockCursor = false;
                        }

                        break;

                    case CAMERA_TYPE.TPS:
                        if (Settings.CameraTypeSettings[3])
                        {
                            cameraMode        = CAMERA_TYPE.OLDTPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[0])
                        {
                            cameraMode        = CAMERA_TYPE.ORIGINAL;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[2])
                        {
                            cameraMode        = CAMERA_TYPE.WOW;
                            Screen.lockCursor = false;
                        }

                        break;

                    case CAMERA_TYPE.OLDTPS:
                        if (Settings.CameraTypeSettings[0])
                        {
                            cameraMode        = CAMERA_TYPE.ORIGINAL;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[2])
                        {
                            cameraMode        = CAMERA_TYPE.WOW;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[1])
                        {
                            cameraMode        = CAMERA_TYPE.TPS;
                            Screen.lockCursor = true;
                        }

                        break;
                    }

                    if ((int)FengGameManagerMKII.settings[245] == 1 || main_object.GetComponent <HERO>() == null)
                    {
                        Screen.showCursor = false;
                    }
                }

                if (inputManager.isInputDown[InputCode.hideCursor])
                {
                    Screen.showCursor = !Screen.showCursor;
                }

                if (inputManager.isInputDown[InputCode.focus])
                {
                    triggerAutoLock = !triggerAutoLock;
                    if (triggerAutoLock)
                    {
                        lockTarget = findNearestTitan();
                        if (closestDistance >= 150f)
                        {
                            lockTarget      = null;
                            triggerAutoLock = false;
                        }
                    }
                }

                if (gameOver && main_object != null)
                {
                    if (FengGameManagerMKII.inputRC.isInputHumanDown(InputCodeRC.liveCam))
                    {
                        if ((int)FengGameManagerMKII.settings[263] == 0)
                        {
                            FengGameManagerMKII.settings[263] = 1;
                        }
                        else
                        {
                            FengGameManagerMKII.settings[263] = 0;
                        }
                    }

                    var component = main_object.GetComponent <HERO>();
                    if (component != null && (int)FengGameManagerMKII.settings[263] == 1 && component.GetComponent <SmoothSyncMovement>().enabled&& component.isPhotonCamera)
                    {
                        CameraMovementLive(component);
                    }
                    else if (lockAngle)
                    {
                        transform.rotation = Quaternion.Lerp(transform.rotation, main_object.transform.rotation, 0.2f);
                        transform.position = Vector3.Lerp(transform.position, main_object.transform.position - main_object.transform.forward * 5f, 0.2f);
                    }
                    else
                    {
                        camareMovement();
                    }
                }
                else
                {
                    camareMovement();
                }

                if (triggerAutoLock && lockTarget != null)
                {
                    var z         = this.transform.eulerAngles.z;
                    var transform = lockTarget.transform.Find("Amarture/Core/Controller_Body/hip/spine/chest/neck");
                    var vector2   = transform.position - (head == null ? main_object.transform.position : head.transform.position);
                    vector2.Normalize();
                    lockCameraPosition      = head == null ? main_object.transform.position : head.transform.position;
                    lockCameraPosition     -= vector2 * distance * distanceMulti * distanceOffsetMulti;
                    lockCameraPosition     += Vector3.up * 3f * heightMulti * distanceOffsetMulti;
                    this.transform.position = Vector3.Lerp(this.transform.position, lockCameraPosition, Time.deltaTime * 4f);
                    if (head != null)
                    {
                        this.transform.LookAt(head.transform.position * 0.8f + transform.position * 0.2f);
                    }
                    else
                    {
                        this.transform.LookAt(main_object.transform.position * 0.8f + transform.position * 0.2f);
                    }

                    this.transform.localEulerAngles = new Vector3(this.transform.eulerAngles.x, this.transform.eulerAngles.y, z);
                    Vector2 vector3 = camera.WorldToScreenPoint(transform.position - transform.forward * lockTarget.transform.localScale.x);
                    locker.transform.localPosition = new Vector3(vector3.x - Screen.width * 0.5f, vector3.y - Screen.height * 0.5f, 0f);
                    if (lockTarget.GetComponent <TITAN>() != null && lockTarget.GetComponent <TITAN>().hasDie)
                    {
                        lockTarget = null;
                    }
                }
                else
                {
                    locker.transform.localPosition = new Vector3(0f, -Screen.height * 0.5f - 50f, 0f);
                }

                var end        = head == null ? main_object.transform.position : head.transform.position;
                var vector5    = (head == null ? main_object.transform.position : head.transform.position) - this.transform.position;
                var normalized = vector5.normalized;
                end -= distance * normalized * distanceMulti;
                LayerMask mask  = 1 << LayerMask.NameToLayer("Ground");
                LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox");
                LayerMask mask3 = mask | mask2;
                if (head != null)
                {
                    if (Physics.Linecast(head.transform.position, end, out hit, mask))
                    {
                        transform.position = hit.point;
                    }
                    else if (Physics.Linecast(head.transform.position - normalized * distanceMulti * 3f, end, out hit, mask2))
                    {
                        transform.position = hit.point;
                    }

                    Debug.DrawLine(head.transform.position - normalized * distanceMulti * 3f, end, Color.red);
                }
                else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hit, mask3))
                {
                    transform.position = hit.point;
                }

                shakeUpdate();
            }
        }
    }
    public void snapShot2(int index)
    {
        Vector3    vector;
        RaycastHit hit;

        snapShotCamera.transform.position = head == null ? main_object.transform.position : head.transform.position;
        var transform = snapShotCamera.transform;

        transform.position += Vector3.up * heightMulti;
        var transform2 = snapShotCamera.transform;

        transform2.position -= Vector3.up * 1.1f;
        var worldPosition = vector = snapShotCamera.transform.position;
        var vector3       = (worldPosition + snapShotTargetPosition) * 0.5f;

        snapShotCamera.transform.position = vector3;
        worldPosition = vector3;
        snapShotCamera.transform.LookAt(snapShotTargetPosition);
        if (index == 3)
        {
            snapShotCamera.transform.RotateAround(this.transform.position, Vector3.up, Random.Range(-180f, 180f));
        }
        else
        {
            snapShotCamera.transform.RotateAround(this.transform.position, Vector3.up, Random.Range(-20f, 20f));
        }

        snapShotCamera.transform.LookAt(worldPosition);
        snapShotCamera.transform.RotateAround(worldPosition, this.transform.right, Random.Range(-20f, 20f));
        var num = Vector3.Distance(snapShotTargetPosition, vector);

        if (snapShotTarget != null && snapShotTarget.GetComponent <TITAN>() != null)
        {
            num += (index - 1) * snapShotTarget.transform.localScale.x * 10f;
        }

        var transform3 = snapShotCamera.transform;

        transform3.position -= snapShotCamera.transform.forward * Random.Range(num + 3f, num + 10f);
        snapShotCamera.transform.LookAt(worldPosition);
        snapShotCamera.transform.RotateAround(worldPosition, this.transform.forward, Random.Range(-30f, 30f));
        var end     = head == null ? main_object.transform.position : head.transform.position;
        var vector5 = (head == null ? main_object.transform.position : head.transform.position) - snapShotCamera.transform.position;

        end -= vector5;
        LayerMask mask  = 1 << LayerMask.NameToLayer("Ground");
        LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox");
        LayerMask mask3 = mask | mask2;

        if (head != null)
        {
            if (Physics.Linecast(head.transform.position, end, out hit, mask))
            {
                snapShotCamera.transform.position = hit.point;
            }
            else if (Physics.Linecast(head.transform.position - vector5 * distanceMulti * 3f, end, out hit, mask3))
            {
                snapShotCamera.transform.position = hit.point;
            }
        }
        else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hit, mask3))
        {
            snapShotCamera.transform.position = hit.point;
        }

        switch (index)
        {
        case 1:
            snapshot1 = RTImage(snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(snapshot1, snapShotDmg);
            break;

        case 2:
            snapshot2 = RTImage(snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(snapshot2, snapShotDmg);
            break;

        case 3:
            snapshot3 = RTImage(snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(snapshot3, snapShotDmg);
            break;
        }

        snapShotCount     = index;
        hasSnapShot       = true;
        snapShotCountDown = 2f;
        if (index == 1)
        {
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture             = snapshot1;
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localScale    = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f);
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f);
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.rotation      = Quaternion.Euler(0f, 0f, 10f);
            if (Settings.SnapshotsShowInGameSetting)
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = true;
            }
            else
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = false;
            }
        }
    }
 public void setSpectorMode(bool val)
 {
     spectatorMode = val;
     GameObjectCache.Find("MainCamera").GetComponent <SpectatorMovement>().disable = !val;
     GameObjectCache.Find("MainCamera").GetComponent <MouseLook>().disable         = !val;
 }
    public void setHUDposition()
    {
        GameObjectCache.Find("Flare").transform.localPosition = new Vector3((int)(-Screen.width * 0.5f) + 14, (int)(-Screen.height * 0.5f), 0f);
        var obj2 = GameObjectCache.Find("LabelInfoBottomRight");

        obj2.transform.localPosition = new Vector3((int)(Screen.width * 0.5f), (int)(-Screen.height * 0.5f), 0f);
        if (Settings.LegacyLabelsSetting)
        {
            obj2.GetComponent <UILabel>().text = "Pause : " + GameObject.Find("InputManagerController").GetComponent <FengCustomInputs>().inputString[InputCode.pause] + " ";
        }
        else
        {
            Labels.BottomRight = "Pause : " + GameObjectCache.Find("InputManagerController").GetComponent <FengCustomInputs>().inputString[InputCode.pause];
        }
        GameObjectCache.Find("LabelInfoTopCenter").transform.localPosition = new Vector3(0f, (int)(Screen.height * 0.5f), 0f);
        GameObjectCache.Find("LabelInfoTopRight").transform.localPosition  = new Vector3((int)(Screen.width * 0.5f), (int)(Screen.height * 0.5f), 0f);
        GameObjectCache.Find("LabelNetworkStatus").transform.localPosition = new Vector3((int)(-Screen.width * 0.5f), (int)(Screen.height * 0.5f), 0f);
        GameObjectCache.Find("LabelInfoTopLeft").transform.localPosition   = new Vector3((int)(-Screen.width * 0.5f), (int)(Screen.height * 0.5f - 20f), 0f);
        GameObjectCache.Find("Chatroom").transform.localPosition           = new Vector3((int)(-Screen.width * 0.5f), (int)(-Screen.height * 0.5f), 0f);
        if (GameObjectCache.Find("Chatroom") != null)
        {
            GameObjectCache.Find("Chatroom").GetComponent <InRoomChat>().SetPosition();
        }

        if (!usingTitan || gametype == GAMETYPE.SINGLE)
        {
            GameObjectCache.Find("skill_cd_bottom").transform.localPosition      = new Vector3(0f, (int)(-Screen.height * 0.5f + 5f), 0f);
            GameObjectCache.Find("GasUI").transform.localPosition                = GameObjectCache.Find("skill_cd_bottom").transform.localPosition;
            GameObjectCache.Find("stamina_titan").transform.localPosition        = new Vector3(0f, 9999f, 0f);
            GameObjectCache.Find("stamina_titan_bottom").transform.localPosition = new Vector3(0f, 9999f, 0f);
        }
        else
        {
            var vector = new Vector3(0f, 9999f, 0f);
            GameObjectCache.Find("skill_cd_bottom").transform.localPosition      = vector;
            GameObjectCache.Find("skill_cd_armin").transform.localPosition       = vector;
            GameObjectCache.Find("skill_cd_eren").transform.localPosition        = vector;
            GameObjectCache.Find("skill_cd_jean").transform.localPosition        = vector;
            GameObjectCache.Find("skill_cd_levi").transform.localPosition        = vector;
            GameObjectCache.Find("skill_cd_marco").transform.localPosition       = vector;
            GameObjectCache.Find("skill_cd_mikasa").transform.localPosition      = vector;
            GameObjectCache.Find("skill_cd_petra").transform.localPosition       = vector;
            GameObjectCache.Find("skill_cd_sasha").transform.localPosition       = vector;
            GameObjectCache.Find("GasUI").transform.localPosition                = vector;
            GameObjectCache.Find("stamina_titan").transform.localPosition        = new Vector3(-160f, (int)(-Screen.height * 0.5f + 15f), 0f);
            GameObjectCache.Find("stamina_titan_bottom").transform.localPosition = new Vector3(-160f, (int)(-Screen.height * 0.5f + 15f), 0f);
        }

        if (main_object != null && main_object.GetComponent <HERO>() != null)
        {
            if (gametype == GAMETYPE.SINGLE)
            {
                main_object.GetComponent <HERO>().setSkillHUDPosition();
            }
            else if (main_object.GetPhotonView() != null && main_object.GetPhotonView().isMine)
            {
                main_object.GetComponent <HERO>().setSkillHUDPosition();
            }
        }

        if (stereoType == STEREO_3D_TYPE.SIDE_BY_SIDE)
        {
            gameObject.GetComponent <Camera>().aspect = Screen.width / Screen.height;
        }

        createSnapShotRT();
    }
Exemple #17
0
 protected virtual void Start()
 {
     mCache = new GameObjectCache(transform, ParticlePrefab);
 }
 public void flashBlind()
 {
     GameObjectCache.Find("flash").GetComponent <UISprite>().alpha = 1f;
     flashDuration = 2f;
 }
Exemple #19
0
 public static void GetPosition()
 {
     string[] msg = { "Your position:\n", "\nX", " - ", $"{GameObjectCache.Find("MainCamera").GetComponent<IN_GAME_MAIN_CAMERA>().main_object.transform.position.x.ToString()}" + "\nY", " - ", $"{GameObjectCache.Find("MainCamera").GetComponent<IN_GAME_MAIN_CAMERA>().main_object.transform.position.y.ToString()}" + "\nZ", " - ", $"{GameObjectCache.Find("MainCamera").GetComponent<IN_GAME_MAIN_CAMERA>().main_object.transform.position.z.ToString()}" };
     SystemMessageLocal(msg);
 }
Exemple #20
0
 public static void Destroy(GameObject gameObject)
 {
     GameObjectCache.Destroy(gameObject);
 }
Exemple #21
0
 public static GameObject Instantiate(GameObject gameObject, Vector3 position, Quaternion rotation, Transform parent)
 {
     return(GameObjectCache.Instantiate(gameObject, position, rotation, parent));
 }
Exemple #22
0
 public void SetUp()
 {
     containingObject = new GameObject();
     subject          = containingObject.AddComponent <GameObjectCache>();
 }