Пример #1
0
    public void SetCameraRotate()
    {
        float num = 0f;

        if (PlayerPrefs.HasKey("CameraRotate"))
        {
            num = PlayerPrefs.GetFloat("CameraRotate");
            if (num <= this.m_fMinCameraRotate)
            {
                num = 0f;
            }
            if (num >= this.m_fMaxCameraRotate)
            {
                num = 1f;
            }
        }
        else
        {
            maxCamera component = Camera.main.GetComponent <maxCamera>();
            if (component != null)
            {
                num = component.MobileRotate;
            }
        }
        this.m_MobileRotate.defaultValue = num;
        this.m_MobileRotate.Value        = num;
    }
Пример #2
0
    public void CameraDataRestore()
    {
        if (!NrBattleCamera.m_BackupCameraData.checkbackup)
        {
            return;
        }
        GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);

        if (gameObject == null)
        {
            return;
        }
        Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");

        if (child == null)
        {
            return;
        }
        maxCamera component = child.GetComponent <maxCamera>();

        component.distance        = NrBattleCamera.m_BackupCameraData.distance;
        component.xDeg            = NrBattleCamera.m_BackupCameraData.xDeg;
        component.yDeg            = NrBattleCamera.m_BackupCameraData.yDeg;
        component.currentDistance = NrBattleCamera.m_BackupCameraData.currentDistance;
        component.desiredDistance = NrBattleCamera.m_BackupCameraData.desiredDistance;
        component.m_nCameraLevel  = NrBattleCamera.m_BackupCameraData.CameraLevel;
        NrBattleCamera.m_BackupCameraData.trParent = null;
        component.RestoreBattleCamera();
    }
    public void StartCutScene()
    {
        this.fStartTime = Time.realtimeSinceStartup;
        maxCamera component = Camera.main.GetComponent <maxCamera>();

        if (component != null)
        {
            this.m_TargetCamera = component;
            this.m_TargetCamera.CastedTarget.BackUpCameraInfo();
            this.m_TargetCamera.CastedTarget.enabled = false;
        }
        if (this.bHide)
        {
            NrTSingleton <NkBattleCharManager> .Instance.ChangeCharLayer((eBATTLE_ALLY)this.nHideAlly, -1, false, true);
        }
        NrTSingleton <NkBattleCharManager> .Instance.AllCharNameHide(false);

        Battle.BATTLE.GRID_MANAGER.ShowHideGrid(false);
        GameObject gameObject = GameObject.Find("UI Camera");

        if (gameObject != null)
        {
            Camera componentInChildren = gameObject.GetComponentInChildren <Camera>();
            if (componentInChildren != null)
            {
                componentInChildren.enabled = false;
            }
        }
    }
Пример #4
0
    /// <summary>
    /// Sets the center of the scene on the original center or on an atom.
    /// </summary>
    /// <param name='mode'>
    /// Setting mode (0 for original center, 1 for atom center). Int.
    /// </param>
    private void SetCenter(int mode)
    {
        GameObject CamTarget = GameObject.Find("Cam Target");

        // choose the main function 0 to restart position or 1 to center around an atom
        if (mode == 0)
        {
            Debug.Log("Entering :: SetCenter for cam target to" + MoleculeModel.cameraLocation.z);
            if (scenecontroller.GetComponent <maxCamera>().enabled)
            {
                maxCamera comp = scenecontroller.GetComponent <maxCamera>();
                comp.ToCenter();
            }
            if (UIData.atomtype == UIData.AtomType.hyperball)
            {
                GameObject   hbManagerObj = GameObject.FindGameObjectWithTag("HBallManager");
                HBallManager hbManager    = hbManagerObj.GetComponent <HBallManager>();
                hbManager.ResetPositions();
            }
        }
        else if (mode == 1)
        {
            Debug.Log("target : " + MoleculeModel.target);
            CamTarget.transform.rotation = transform.rotation;
            CamTarget.transform.position = MoleculeModel.target;
        }
    }
Пример #5
0
 public void SetSlowMotionCamera(NkBattleChar pkTarget, bool bSet)
 {
     if (bSet)
     {
         if (NrBattleCamera.m_BackupCameraData.checkbackup && NrBattleCamera.m_BackupCameraData.trParent != null)
         {
             return;
         }
         if (pkTarget == null)
         {
             return;
         }
         GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);
         if (gameObject == null)
         {
             return;
         }
         Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");
         if (child == null)
         {
             return;
         }
         maxCamera component = child.GetComponent <maxCamera>();
         if (component == null)
         {
             return;
         }
         NrBattleCamera.m_BackupCameraData.CameraLevel = component.m_nCameraLevel;
         NrBattleCamera.m_BackupCameraData.checkbackup = true;
         component.m_nCameraLevel = 4;
         component.SetLevelValue();
         this.m_veTriggerStartPos = this.m_TargetGo.transform.position;
         this.SetcameraPos(pkTarget.GetCharPos());
     }
     else if (NrBattleCamera.m_BackupCameraData.checkbackup && NrBattleCamera.m_BackupCameraData.trParent == null)
     {
         GameObject gameObject2 = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);
         if (gameObject2 == null)
         {
             return;
         }
         Transform child2 = NkUtil.GetChild(gameObject2.transform, "Main Camera");
         if (child2 == null)
         {
             return;
         }
         maxCamera component2 = child2.GetComponent <maxCamera>();
         if (component2 == null)
         {
             return;
         }
         component2.m_nCameraLevel = NrBattleCamera.m_BackupCameraData.CameraLevel;
         component2.SetLevelValue();
         NrBattleCamera.m_BackupCameraData.checkbackup = false;
         this.SetcameraPos(this.m_veTriggerStartPos);
     }
 }
Пример #6
0
 public void SetFollowHeroCamera(bool bSet)
 {
     if (Camera.main != null)
     {
         maxCamera component = Camera.main.GetComponent <maxCamera>();
         if (component != null)
         {
             component.SetFollowHero(bSet);
         }
     }
 }
Пример #7
0
    public void BackMainCameraInfo()
    {
        if (Camera.main == null)
        {
            return;
        }
        maxCamera component = Camera.main.GetComponent <maxCamera>();

        if (component != null)
        {
            component.BackUpCameraInfo();
        }
    }
Пример #8
0
    public void CameraRotate_Reset()
    {
        float     num       = 0.37f;
        maxCamera component = Camera.main.GetComponent <maxCamera>();

        if (component != null)
        {
            component.MobileRotate           = num;
            this.m_MobileRotate.defaultValue = num;
            this.m_MobileRotate.Value        = num;
        }
        PlayerPrefs.SetFloat("CameraRotate", num);
    }
Пример #9
0
//	███████╗████████╗ █████╗ ██████╗ ████████╗
//	██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝
//	███████╗   ██║   ███████║██████╔╝   ██║
//	╚════██║   ██║   ██╔══██║██╔══██╗   ██║
//	███████║   ██║   ██║  ██║██║  ██║   ██║
//	╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝
    void Start()
    {
        // Initialize Terrain vars
        thisTerrain = Terrain.activeTerrain;
        size        = thisTerrain.terrainData.size;
        xRes        = thisTerrain.terrainData.heightmapWidth;
        zRes        = thisTerrain.terrainData.heightmapHeight;
        xPixSize    = size.x / xRes;
        zPixSize    = size.z / zRes;
        heights     = thisTerrain.terrainData.GetHeights(0, 0, xRes, zRes);

        // Initialize other vars
        FPC       = GameObject.Find("First Person Controller");
        FPCCont   = FPC.GetComponent <CharacterController> ();
        FPCCamera = GameObject.Find("FPCamera").GetComponent <Camera>();
        //FPCCameraScript = GameObject.Find ("FPCamera").GetComponent<MouseLook>();

        orbitCamera       = GameObject.Find("GodCamera").GetComponent <Camera>();
        orbitCameraScript = GameObject.Find("GodCamera").GetComponent <maxCamera> ();

        dirLightObj     = GameObject.Find("base_sun");
        dirLight        = dirLightObj.GetComponent <Light> ();
        cursorProjector = GetComponentInChildren <Projector> ();
        cursorProjector.orthographic     = true;
        cursorProjector.orthographicSize = pullRadius;

        // Refit terrain under certain UI flags
        if (resizeOnStart)
        {
            resizeTerrain(newX, newY, newX);
        }
        if (flattenOnStart)
        {
            flattenTerrain(flattenedHeight);
        }
        if (newPerlin)
        {
            perlinTerrain();
        }

        // Apply new Textures based on terrain topology
        splatmapData = new float[thisTerrain.terrainData.alphamapWidth, thisTerrain.terrainData.alphamapHeight, thisTerrain.terrainData.alphamapLayers];
        clearAlphaMaps();                       // set Alpha Map to solid black
        applyTexture();                         // apply Alpha Map according to start configuration

        // Set the FPC's position to sit on top of Terrain's center
        float   h          = thisTerrain.terrainData.GetInterpolatedHeight(0.5f, 0.5f);
        Vector3 terrCenter = new Vector3(size.x / 2, h + FPCCont.height / 2 + 1, size.z / 2);

        FPC.transform.position = terrCenter;
    }
Пример #10
0
    private void _AttachCharController()
    {
        if (null == base.gameObject)
        {
            return;
        }
        CapsuleCollider component = base.gameObject.GetComponent <CapsuleCollider>();

        if (null == component)
        {
            return;
        }
        this.kCharController        = base.gameObject.AddComponent <CharacterController>();
        this.kCharController.radius = component.radius * component.transform.localScale.x;
        this.kCharController.center = component.center * component.transform.localScale.x;
        this.kCharController.height = component.height * component.transform.localScale.x;
        Vector3 center = this.kCharController.center;

        center.y = Mathf.Max(this.kCharController.height, this.kCharController.radius * 2f) * 0.5f;
        this.kCharController.center = center;
        UnityEngine.Object.DestroyObject(component);
        Collider[] componentsInChildren = base.gameObject.GetComponentsInChildren <Collider>();
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Collider collider = componentsInChildren[i];
            if (!(collider is CharacterController))
            {
                UnityEngine.Object.DestroyObject(collider);
            }
        }
        this.kAnimation  = base.gameObject.GetComponent <Animation>();
        this.v3DestPos   = base.transform.position;
        this.goCameraPos = GameObject.Find("CameraPos");
        if (null == this.goCameraPos)
        {
            this.goCameraPos = new GameObject("CameraPos");
            this.goCameraPos.transform.position = base.transform.position;
        }
        if (null == Camera.main)
        {
            GameObject gameObject = new GameObject("Main Camera");
            gameObject.AddComponent <Camera>();
            gameObject.tag = "MainCamera";
        }
        maxCamera maxCamera = Camera.main.gameObject.AddComponent <maxCamera>();

        maxCamera.target      = this.goCameraPos.transform;
        maxCamera.maxDistance = 10000f;
    }
Пример #11
0
    public void AttachCamera()
    {
        GameObject gameObject = GameObject.Find("Main Camera");

        if (null == gameObject)
        {
            gameObject     = new GameObject("Main Camera");
            gameObject.tag = "MainCamera";
        }
        this.maxCam = gameObject.AddComponent <maxCamera>();
        this.maxCam.UseCameraLevel  = false;
        this.maxCam.m_bToolCamera   = true;
        this.maxCam.fieldOfView     = 35f;
        this.maxCam.currentDistance = (this.maxCam.desiredDistance = (this.maxCam.distance = 5f));
        this.maxCam.minDistance     = 0.1f;
        this.maxCam.maxDistance     = 1000f;
    }
Пример #12
0
    public void ChangeCameraClipPlane(TsQualityManager.Level level)
    {
        if (null == Camera.main)
        {
            return;
        }
        maxCamera component = Camera.main.GetComponent <maxCamera>();

        if (null != component)
        {
            Camera component2 = component.GetComponent <Camera>();
            if (component2)
            {
                component2.farClipPlane  = TsQualityManager.Instance[level].CamFar;
                component2.nearClipPlane = 0.1f;
            }
        }
    }
Пример #13
0
    private void Awake()
    {
        this._WorldCamera = Camera.main.gameObject.GetComponent <maxCamera>();
        if (this._WorldCamera != null)
        {
            this._WorldCamera.enabled      = false;
            this._BackupCamera.Position    = this._WorldCamera.transform.position;
            this._BackupCamera.Angle       = this._WorldCamera.transform.eulerAngles;
            this._BackupCamera.fieldOfView = this._WorldCamera.camera.fieldOfView;
        }
        AudioListener currentAudioListener = TsAudioManager.Instance.CurrentAudioListener;

        if (currentAudioListener.transform.parent.gameObject != base.gameObject)
        {
            this._PreAudioListener = currentAudioListener.transform.parent.gameObject;
            TsAudioListenerSwitcher tsAudioListenerSwitcher = new TsAudioListenerSwitcher(base.gameObject);
            tsAudioListenerSwitcher.Switch();
        }
    }
Пример #14
0
    public void SetCameraLevel(int nLevel)
    {
        GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);

        if (gameObject == null)
        {
            return;
        }
        Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");

        if (child == null)
        {
            return;
        }
        maxCamera component = child.GetComponent <maxCamera>();

        component.m_nCameraLevel = nLevel;
        component.RestoreBattleCamera();
    }
Пример #15
0
    public void SetCameraMode(int nMode, Vector3 vePos, float fAngle)
    {
        if (this.m_nCurrentCameraMode == nMode)
        {
            return;
        }
        GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);

        if (gameObject == null)
        {
            return;
        }
        Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");

        if (child == null)
        {
            return;
        }
        maxCamera component = child.GetComponent <maxCamera>();

        if (nMode != 1)
        {
            if (!NrBattleCamera.m_BackupCameraData.checkbackup)
            {
                NrBattleCamera.m_BackupCameraData.distance        = component.distance;
                NrBattleCamera.m_BackupCameraData.xDeg            = component.xDeg;
                NrBattleCamera.m_BackupCameraData.yDeg            = component.yDeg;
                NrBattleCamera.m_BackupCameraData.currentDistance = component.currentDistance;
                NrBattleCamera.m_BackupCameraData.desiredDistance = component.desiredDistance;
                NrBattleCamera.m_BackupCameraData.CameraLevel     = component.m_nCameraLevel;
                NrBattleCamera.m_BackupCameraData.checkbackup     = true;
            }
            component.SetCameraMode(nMode, vePos, fAngle);
        }
        else
        {
            component.SetCameraMode(nMode, vePos, fAngle);
            this.CameraDataRestore();
            NrBattleCamera.m_BackupCameraData.checkbackup = false;
        }
        this.m_nCurrentCameraMode = nMode;
    }
Пример #16
0
    public void SaveCameraRotate()
    {
        float num = this.m_MobileRotate.Value;

        if (num < this.m_fMinCameraRotate)
        {
            num = this.m_fMinCameraRotate;
        }
        if (num > this.m_fMaxCameraRotate)
        {
            num = this.m_fMaxCameraRotate;
        }
        maxCamera component = Camera.main.GetComponent <maxCamera>();

        if (component != null)
        {
            component.MobileRotate = num;
        }
        PlayerPrefs.SetFloat("CameraRotate", num);
    }
Пример #17
0
 private void Update()
 {
     if (this.maxCam)
     {
         if (Input.GetKeyUp(KeyCode.UpArrow))
         {
             maxCamera expr_2A_cp_0 = this.maxCam;
             expr_2A_cp_0.targetOffset.y = expr_2A_cp_0.targetOffset.y - 0.1f;
         }
         if (Input.GetKeyUp(KeyCode.DownArrow))
         {
             maxCamera expr_55_cp_0 = this.maxCam;
             expr_55_cp_0.targetOffset.y = expr_55_cp_0.targetOffset.y + 0.1f;
         }
     }
     if (this.bFadeIn)
     {
         this.FadeIn();
     }
 }
    /*
     * Instantiate network and memory objects and initialize project
     */
    void Awake()
    {
        //camera = GameObject.Find ("Main Camera");
        color1.a     = 0.4f;
        color2.a     = 0.4f;
        shader2      = Shader.Find("Transparent/VertexLit");
        cameraScript = (maxCamera)Camera.main.GetComponent(typeof(maxCamera));
        Debug.Log("i am awake\n");

        //pipe1 = Instantiate (Resources.Load ("networkPrefab")) as GameObject;
        pipe1      = Instantiate(Resources.Load("spherePrefab")) as GameObject;
        pipe1.name = "theNetwork";

        pipeScript = (pipeBehavior)pipe1.GetComponent(typeof(pipeBehavior));
        GameObject mem = GameObject.Find("Memory1");

        memoryScript           = (memory)mem.GetComponent(typeof(memory));
        mem.transform.position = memoryStart;
        mem.transform.rotation = Quaternion.Euler(memoryRotation);
        initProject(project);
    }
Пример #19
0
    public override void SetComponent()
    {
        this.m_bttransbutton                 = (base.GetControl("Button_Transbutton") as Button);
        this.m_bttransbutton.Click           = new EZValueChangedDelegate(this.ClickClose);
        this.m_bttransbutton.UseDefaultSound = false;
        this.backImage        = (base.GetControl("NPCTalk_BG") as DrawTexture);
        this.m_CenterNpcImage = (base.GetControl("DrawTexture_NPCFace01") as DrawTexture);
        this.m_CenterNpcImage.SetTexture(eCharImageType.LARGE, 242, -1, string.Empty);
        this.m_CenterNpcName      = (base.GetControl("NPCTalk_npcname") as Label);
        this.m_CenterNpcName.Text = NrTSingleton <NrCharKindInfoManager> .Instance.GetName(242);

        this.m_CenterNpcNameBack[0] = (base.GetControl("DrawTexture_NPCTalk_npcnameBG_left_line") as DrawTexture);
        this.m_CenterNpcNameBack[1] = (base.GetControl("DrawTexture_NPCTalk_npcnameBG_right_line") as DrawTexture);
        this.m_CenterNpcNameBack[2] = (base.GetControl("DrawTexture_NPCTalk_npcnameBG_left") as DrawTexture);
        this.m_CenterNpcNameBack[3] = (base.GetControl("DrawTexture_NPCTalk_npcnameBG_right") as DrawTexture);
        this.close = (base.GetControl("NPCTalk_close") as Button);
        this.close.AddValueChangedDelegate(new EZValueChangedDelegate(this.ClickClose));
        this.excute = (base.GetControl("Button_Button9") as Button);
        this.excute.AddValueChangedDelegate(new EZValueChangedDelegate(this.ClickExcuteGameGuide));
        this.talkText         = (base.GetControl("NPCTalk_talklabel") as FlashLabel);
        this.talkText.Visible = true;
        this.item1            = (base.GetControl("ItemTexture_Item1") as ItemTexture);
        this.backItem1        = (base.GetControl("DrawTexture_itemtexture1") as DrawTexture);
        this.item2            = (base.GetControl("ItemTexture_Item2") as ItemTexture);
        base.SetShowLayer(2, false);
        this.RepositionControl();
        NrTSingleton <NkCharManager> .Instance.ShowHideAll(false, false, false);

        this.SetTalkText();
        if (null != Camera.main)
        {
            this.m_WorldCamera = Camera.main.GetComponent <maxCamera>();
            if (this.m_WorldCamera != null)
            {
                NrTSingleton <NkClientLogic> .Instance.BackMainCameraInfo();

                this.m_WorldCamera.StopCameraControl();
            }
        }
    }
Пример #20
0
    public void CloseBattle()
    {
        this.SetLastAttackCamera(null, false);
        GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);

        if (gameObject == null)
        {
            return;
        }
        Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");

        if (child == null)
        {
            return;
        }
        maxCamera component = child.GetComponent <maxCamera>();

        if (this.m_nCurrentCameraMode != 1)
        {
            component.SetCameraMode(1, Vector3.zero, 0f);
        }
        if (!component.enabled && NrBattleCamera.m_BackupCameraData.trParent != null)
        {
            child.parent      = NrBattleCamera.m_BackupCameraData.trParent;
            component.enabled = true;
            NrBattleCamera.m_BackupCameraData.trParent = null;
        }
        UnityEngine.Object.Destroy(this.m_TargetGo);
        component.m_bBattleCamera = false;
        NrBattleCamera.m_BackupCameraData.distance        = component.distance;
        NrBattleCamera.m_BackupCameraData.xDeg            = component.xDeg;
        NrBattleCamera.m_BackupCameraData.yDeg            = component.yDeg;
        NrBattleCamera.m_BackupCameraData.currentDistance = component.currentDistance;
        NrBattleCamera.m_BackupCameraData.desiredDistance = component.desiredDistance;
        NrBattleCamera.m_BackupCameraData.CameraLevel     = component.m_nCameraLevel;
        NrBattleCamera.m_BackupCameraData.checkbackup     = true;
        NrBattleCamera.m_BackupCameraData.trParent        = null;
    }
Пример #21
0
    public void SyncRotate()
    {
        if (this.m_pkHeadUpRoot == null)
        {
            return;
        }
        if (Camera.main == null)
        {
            return;
        }
        maxCamera component = Camera.main.GetComponent <maxCamera>();

        if (component == null)
        {
            TsLog.LogError("maxCamera Script is Null in maincamera", new object[0]);
            return;
        }
        if (component.target == null)
        {
            return;
        }
        this.m_pkHeadUpRoot.transform.rotation = component.transform.rotation;
    }
Пример #22
0
    private void Init()
    {
        Camera main = Camera.main;

        this.WCam = main.GetComponent <maxCamera>();
        if (this.WCam)
        {
            this.WCam.enabled = false;
        }
        this.mCam                     = main.gameObject.AddComponent <CameraController>();
        this.mCam.yMinLimit           = 45f;
        this.mCam.yMaxLimit           = 45f;
        this.mCam.Angley              = 45f;
        this.mCam.distanceMin         = 20f;
        this.mCam.m_bMotionBlurCamera = true;
        this.mCam.distanceMax         = 200f;
        this.mCam.distance            = 150f;
        this.mCam.fFov                = 33f;
        this.mCam.ffovMax             = 33f;
        this.mCam.ffovMin             = 33f;
        this.mCam.InitSrcPos(base.transform.position);
        this.m_Time     = Time.time + this.SHOW_TIME;
        this.m_SendTime = Time.time + this.SHOW_TIME;
    }
Пример #23
0
    // Update is called once per frame
    void Update()
    {
        // requestPDB.Loading looks actually useless since progress bar is commented (see below)

        /*if (RequestPDB.isDone){
         * requestPDB.Loading = false;
         * }
         * else{
         * requestPDB.Loading = true;
         * }*/

        if (isControl && (!UIData.cameraStop2))        // Seems to be true as long as the mouse is in the game window and not on the gui
        {
            MouseOperate();
            KeyOperate();

            //SetCenterbySpace();
            HiddenOperate();
            OpenMenuOperate();
            OpenBoundOperate();
        }

        // Always false ?

        /*if (GUIMoleculeController.toggle_HB_SANIM) {
         *      GUIMoleculeController.shrink +=  Time.deltaTime * GUIMoleculeController.hb_sanim * GUIMoleculeController.hb_ssign;
         *      if (GUIMoleculeController.shrink > 0.95f )
         *              GUIMoleculeController.hb_ssign = -1.0f;
         *      if (GUIMoleculeController.shrink < 0.05f )
         *              GUIMoleculeController.hb_ssign = 1.0f;
         * }*/

        // Always false ?

        /*if (GUIMoleculeController.toggle_HB_RANIM) {
         *      GUIMoleculeController.globalRadius +=  Time.deltaTime * GUIMoleculeController.hb_ranim * GUIMoleculeController.hb_rsign;
         *      if (GUIMoleculeController.globalRadius > 0.95f )
         *              GUIMoleculeController.hb_rsign = -1.0f;
         *      if (GUIMoleculeController.globalRadius < 0.05f )
         *              GUIMoleculeController.hb_rsign = 1.0f;
         * }*/

        if (GUIMoleculeController.toggle_HB_TRANS)        // Always true ?
        {
            GUIMoleculeController.transDelta = 25.0f;
        }
        else
        {
            GUIMoleculeController.transDelta = 1.0f;
        }

        if (GUIMoleculeController.transMETAPHOR)
        {
            GUIMoleculeController.globalRadius = transition(GUIMoleculeController.globalRadius, GUIMoleculeController.newGlobalRadius, GUIMoleculeController.deltaRadius);
            GUIMoleculeController.linkScale    = transition(GUIMoleculeController.linkScale, GUIMoleculeController.newScale, GUIMoleculeController.deltaScale);
            GUIMoleculeController.shrink       = transition(GUIMoleculeController.shrink, GUIMoleculeController.newShrink, GUIMoleculeController.deltaShrink);
            if (GUIMoleculeController.globalRadius == GUIMoleculeController.newGlobalRadius && GUIMoleculeController.linkScale == GUIMoleculeController.newScale && GUIMoleculeController.shrink == GUIMoleculeController.newShrink)
            {
                GUIMoleculeController.transMETAPHOR = false;
            }
        }

        LineUpdate.scale = GUIMoleculeController.linkScale;

        StickUpdate.radiusFactor  = GUIMoleculeController.globalRadius;
        StickUpdate.shrink        = GUIMoleculeController.shrink;
        StickUpdate.scale         = GUIMoleculeController.linkScale;
        BallUpdateHB.radiusFactor = GUIMoleculeController.globalRadius;
//		BallUpdateHB.depthfactor = GUIMoleculeController.depthfactor;
        HBallManager.depthFactor      = GUIMoleculeController.depthfactor;
        HStickManager.depthFactor     = GUIMoleculeController.depthfactor;
        BallUpdateSphere.radiusFactor = GUIMoleculeController.globalRadius;
        BallUpdateCube.radiusFactor   = GUIMoleculeController.globalRadius;
        BallUpdateRC.radiusFactor     = GUIMoleculeController.globalRadius;

        BallUpdateHB.drag   = GUIMoleculeController.drag;
        BallUpdateHB.spring = GUIMoleculeController.spring;

        BallUpdateHB.EnergyGrayColor = GUIMoleculeController.EnergyGrayColor.color;

        // TODO: This is gross. Should be fixed.
        GameObject[] FieldLines = GameObject.FindGameObjectsWithTag("FieldLineManager");
        foreach (GameObject FieldLine in FieldLines)
        {
            LineRenderer curLineRenderer;
            curLineRenderer = FieldLine.GetComponent <LineRenderer>();
            curLineRenderer.material.SetFloat("_timeOff", Time.time);

            // for benoist video comment next line
            curLineRenderer.material.SetColor("_Color", GUIMoleculeController.EnergyGrayColor.color);

            if (GUIMoleculeController.fieldLineColorGradient)
            {
                curLineRenderer.material.SetFloat("_colormode", 0f);
            }
            else
            {
                curLineRenderer.material.SetFloat("_colormode", 1f);
            }

            curLineRenderer.material.SetFloat("_Speed", GUIMoleculeController.speed);
            curLineRenderer.material.SetFloat("_Density", GUIMoleculeController.density);
            curLineRenderer.material.SetFloat("_Length", GUIMoleculeController.linelength);
            curLineRenderer.SetWidth(GUIMoleculeController.linewidth, GUIMoleculeController.linewidth);
            curLineRenderer.material.SetFloat("_depthcut", (GUIMoleculeController.depthCut - maxCamera.currentDistance));
            curLineRenderer.material.SetFloat("_adjust", (GUIMoleculeController.adjustFieldLineCut));
            curLineRenderer.material.SetVector("_SurfacePos", FieldLine.transform.position);

            if (GUIMoleculeController.surfaceMobileCut)
            {
                curLineRenderer.material.SetFloat("_cut", 2f);
            }
            else if (GUIMoleculeController.surfaceStaticCut)
            {
                curLineRenderer.material.SetFloat("_cut", 1f);
                curLineRenderer.material.SetVector("_cutplane", new Vector4(GUIMoleculeController.cutX,
                                                                            GUIMoleculeController.cutY,
                                                                            GUIMoleculeController.cutZ,
                                                                            GUIMoleculeController.depthCut));
            }
        }

        GameObject[] Surfaces = GameObject.FindGameObjectsWithTag("SurfaceManager");

        foreach (GameObject Surface in Surfaces)
        {
            if ((GUIMoleculeController.surfaceTexture || GUIMoleculeController.externalSurfaceTexture) && !GUIMoleculeController.surfaceTextureDone)
            {
                if (GUIMoleculeController.externalSurfaceTexture)
                {
                    if (!UIData.grayscalemode)
                    {
                        Surface.renderer.material.SetTexture("_MatCap", GUIMoleculeController.extSurf);
                    }
                    else
                    {
                        GameObject   hbManagerObj = GameObject.FindGameObjectWithTag("HBallManager");
                        HBallManager hbManager    = hbManagerObj.GetComponent <HBallManager>();
                        Surface.renderer.material.SetTexture("_MatCap", hbManager.ToGray(GUIMoleculeController.extSurf));
                    }
                    Debug.Log("File choose surface texture");
                }
                else
                {
                    if (!UIData.grayscalemode)
                    {
                        Surface.renderer.material.SetTexture("_MatCap", (Texture)Resources.Load(GUIMoleculeController.surfaceTextureName));                        // do not do that every frame!
                    }
                    else
                    {
                        GameObject   hbManagerObj = GameObject.FindGameObjectWithTag("HBallManager");
                        HBallManager hbManager    = hbManagerObj.GetComponent <HBallManager>();
                        Surface.renderer.material.SetTexture("_MatCap", hbManager.ToGray((Texture)Resources.Load(GUIMoleculeController.surfaceTextureName)));
                    }
                    Debug.Log("Quick choose surface texture");
                }
            }
            else if ((GUIMoleculeController.buildSurface || GUIMoleculeController.dxRead) && !GUIMoleculeController.buildSurfaceDone)
            {
                Surface.renderer.material.SetTexture("_MatCap", (Texture)Resources.Load("lit_spheres/divers/daphz1"));
                Debug.Log("Default surface texture");
            }

            // send all the paramter to the surface shader
            // Surface.renderer.material.SetFloat("_Shininess", GUIMoleculeController.intensity);
            // if (Input.GetKey("n")) // uncoment for benoist

            Surface.renderer.material.SetColor("_Color", GUIMoleculeController.SurfaceGrayColor.color);
            Surface.renderer.material.SetColor("_ColorIN", GUIMoleculeController.SurfaceInsideColor.color);
            //Surface.renderer.material.SetColor("_Color", new Color(1f,1f,1f)); // couleur blanche fixé
            Surface.renderer.material.SetFloat("_depthcut", GUIMoleculeController.depthCut);
            Surface.renderer.material.SetFloat("_cutX", GUIMoleculeController.cutX);
            Surface.renderer.material.SetFloat("_cutY", GUIMoleculeController.cutY);
            Surface.renderer.material.SetFloat("_cutZ", GUIMoleculeController.cutZ);
            Surface.renderer.material.SetVector("_SurfacePos", Surface.transform.position);

            if (GUIMoleculeController.surfaceMobileCut && Surface.renderer.material.shader.name == "Mat Cap Cut")               // set the cutting mode
            {
                if (Surface.renderer.material.GetFloat("_cut") != 2f)
                {
                    Surface.renderer.material.SetFloat("_cut", 2f);
                }
            }
            else if (GUIMoleculeController.surfaceStaticCut && Surface.renderer.material.shader.name == "Mat Cap Cut")
            {
                if (Surface.renderer.material.GetFloat("_cut") != 1f)
                {
                    Surface.renderer.material.SetFloat("_cut", 1f);
                }
            }
            else if (Surface.renderer.material.shader.name == "Mat Cap Cut")
            {
                if (Surface.renderer.material.GetFloat("_cut") != 0f)
                {
                    Surface.renderer.material.SetFloat("_cut", 0f);
                }
            }
        }
        GUIMoleculeController.surfaceTextureDone = true;
        GUIMoleculeController.buildSurfaceDone   = true;

        //FPS Count

        timeleft -= Time.deltaTime;
        accum    += Time.timeScale / Time.deltaTime;
        ++frames;

        // Interval ended - update GUI text and start new interval
        if (timeleft <= 0.0f)
        {
            // display two fractional digits (f2 format)
            float fps = accum / frames;          //(1 / Time.deltaTime);
            MoleculeModel.FPS = fps.ToString("f2");
            //Write FPS data into file
            if (fpsLogToggle)
            {
                fpsCount++;
                fpsSum += fps;
                if (fpsCount > 35)
                {
                    Debug.Log("Info :; End fps measure");
                    toggleFPSLog();
                    fpsCount = 0;
                    fpsSum   = 0;
                    GameObject LoadBox = GameObject.Find("LoadBox");
                    maxCamera  comp    = LoadBox.GetComponent <maxCamera>();
                    comp.automove = false;
                }
            }
            timeleft = updateInterval;
            accum    = 0.0f;
            frames   = 0;
        }

        //SetVolumetricDensity();
        // gUIDisplay.gUIMoleculeController.GetPanelPixel();
    }
Пример #24
0
    //----------------------------------------------------------------------------------------------------------------
    // Use this for initialization
    void Start()
    {
        replayControl = GameObject.Find("replayControl");
        ctunity       = GameObject.Find("CTunity").GetComponent <CTunity>(); // reference CTgroupstate script
        gameOptions   = GameObject.Find("Setup").gameObject;

        // define menu objects
        myCamera = GameObject.Find("Main Camera").GetComponent <maxCamera>();

        Server   = GameObject.Find("Server");
        Session  = GameObject.Find("Session");
        Player   = GameObject.Find("Player1");
        Deploy   = GameObject.Find("Deploy");
        Login    = GameObject.Find("Login");
        User     = GameObject.Find("User");
        Password = GameObject.Find("Password");

        // setup callbacks

        Button[] buttons = gameObject.GetComponentsInChildren <Button>();
        foreach (Button b in buttons)
        {
            switch (b.name)
            {
            case "Login":
                b.onClick.AddListener(loginButton);
                break;

            case "Quit":
                b.onClick.AddListener(quitButton);
                break;
            }
        }

        Dropdown[] drops = gameObject.GetComponentsInChildren <Dropdown>();
        foreach (Dropdown d in drops)
        {
            switch (d.name)
            {
            case "Session":
                //                    ctunity.Session = d.GetComponent<Dropdown>().options[d.value].text;  // initialize
                // add listener to update session settings
                d.onValueChanged.AddListener(delegate
                {
                    ctunity.Session = d.GetComponent <Dropdown>().options[d.value].text; // set selected session
                    updateSession();
                    myCamera.setTarget(null);                                            // reset cam target to default
                    myCamera.Init();

                    if (playerDrop != null)
                    {
                        ctunity.Player = playerDrop.GetComponent <Dropdown>().options[0].text;
                        ctunity.serverConnect();      // reset player path
                        playerDrop.value = 0;
                    }
                });

                break;

            case "Deploy":
                // add listener to deploy new world
                d.onValueChanged.AddListener(delegate
                                             { if (d.value != 0)
                                               {
                                                   string svalue = d.GetComponent <Dropdown>().options[d.value].text;

                                                   if (svalue.Equals(ctunity.Save))
                                                   {
                                                       ctunity.SnapShot();
                                                       //	StartCoroutine("getInventoryList");         // update list of "World" prefabs
                                                   }
                                                   else if (svalue.Equals(ctunity.Clear))
                                                   {
                                                       ctunity.clearWorld();
                                                   }
                                                   else if (svalue.Equals(ctunity.Load))
                                                   {
                                                       ctunity.clearWorld();
                                                       ctunity.loadWorld();
                                                   }
                                                   else
                                                   {
                                                       ctunity.deployInventory(svalue);
                                                   }

                                                   d.value = 0; // reset to blank
                                               }
                                             });

                break;

            case "Player1":
                playerDrop     = d;
                ctunity.Player = d.GetComponent <Dropdown>().options[d.value].text;         // init?
                //  playerDrop.GetComponent<Button>().onClick.AddListener(onClick);
                d.onValueChanged.AddListener(delegate
                {
                    String player = d.GetComponent <Dropdown>().options[d.value].text;
//                        Debug.Log("onValueChanged, d.value: " + d.value + ", ctunity.Player: " + ctunity.Player + ", player: " + player);
                    if (!player.Equals(ctunity.Player))
                    {
                        updateSession();                      // avoid new player set as child of prior player?
                        ctunity.Player = player;
//                           Debug.Log("new Player: " + player + ", d.value: " + d.value);
                        ctunity.serverConnect();      // reset player path
                    }
                    replayControl.SetActive(ctunity.observerMode());
                });
                break;
            }
        }

        modeSelect();
    }
Пример #25
0
    public bool SetPlunderCamera()
    {
        GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.SoldierBatchScene);

        if (gameObject == null)
        {
            return(false);
        }
        Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");

        if (child == null)
        {
            return(false);
        }
        Transform child2 = NkUtil.GetChild(gameObject.transform, "battle_terrain");

        if (child2 == null)
        {
            return(false);
        }
        if (this.m_TargetGo != null)
        {
            this.m_TargetGo.name = "SoldierBatchCameraTarget";
        }
        else
        {
            this.m_TargetGo = GameObject.Find("SoldierBatchCameraTarget");
            if (this.m_TargetGo == null)
            {
                this.m_TargetGo = new GameObject("SoldierBatchCameraTarget");
            }
        }
        Vector3 position = child.transform.position;

        this.m_TargetGo.transform.position = position;
        maxCamera component = child.GetComponent <maxCamera>();
        Transform child3    = NkUtil.GetChild(this.m_TargetGo.transform, "CameraTarget");

        if (child3 != null)
        {
            this.m_goTargetAni = child3.gameObject;
        }
        component.m_bBattleCamera = true;
        component.m_nCameraLevel  = 3;
        if (this.m_goTargetAni != null)
        {
            component.target = this.m_goTargetAni.transform;
        }
        else
        {
            component.target = this.m_TargetGo.transform;
        }
        component.Init();
        this.currentDistance = this.m_TargetGo.transform.position.y;
        this.desiredDistance = this.m_TargetGo.transform.position.y;
        if (Application.isEditor)
        {
            Transform  child4      = NkUtil.GetChild(gameObject.transform, "CAMERATARGETCUBE");
            GameObject gameObject2 = null;
            if (child4 != null)
            {
                gameObject2 = child4.gameObject;
            }
            if (gameObject2 == null)
            {
                gameObject2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
                Collider component2 = gameObject2.GetComponent <Collider>();
                UnityEngine.Object.Destroy(component2);
                gameObject2.transform.parent        = this.m_TargetGo.transform;
                gameObject2.transform.localPosition = Vector3.zero;
                gameObject2.transform.localScale    = new Vector3(0.1f, 0.1f, 0.1f);
                gameObject2.name = "CAMERATARGETCUBE";
            }
            MeshRenderer component3 = gameObject2.GetComponent <MeshRenderer>();
            if (component3 != null)
            {
                component3.material = new Material(component3.sharedMaterial)
                {
                    color = new Color(1f, 0f, 0f)
                };
            }
        }
        TsSceneSwitcher.Instance.Collect(TsSceneSwitcher.ESceneType.SoldierBatchScene, this.m_TargetGo);
        child.camera.useOcclusionCulling = false;
        if (SoldierBatch.SOLDIER_BATCH_MODE == eSOLDIER_BATCH_MODE.MODE_MYTHRAID)
        {
            component.SetCameraMode(6, Vector3.zero, 0f);
        }
        else
        {
            component.SetCameraMode(5, Vector3.zero, 0f);
        }
        component.CameraWork();
        return(true);
    }
Пример #26
0
    public void SetLastAttackCamera(NkBattleChar pkTarget, bool bSet)
    {
        if (bSet)
        {
            if (pkTarget == null)
            {
                return;
            }
            if (pkTarget.Get3DChar() == null)
            {
                Debug.LogError("ERROR, SetLastAttackCamera(), pkTarget.Get3DChar() is Null");
                return;
            }
            if (pkTarget.Get3DChar().GetRootGameObject() == null)
            {
                Debug.LogError("ERROR, SetLastAttackCamera(), pkTarget.Get3DChar().GetRootGameObject() is Null");
                return;
            }
            GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);
            if (gameObject == null)
            {
                return;
            }
            Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");
            if (child == null)
            {
                return;
            }
            maxCamera component = child.GetComponent <maxCamera>();
            if (component == null)
            {
                return;
            }
            Transform child2 = NkUtil.GetChild(pkTarget.Get3DChar().GetRootGameObject().transform, "dmaction1");
            if (child2 != null)
            {
                Transform child3 = NkUtil.GetChild(child2, "actioncam");
                if (child3 != null)
                {
                    Camera component2 = child3.GetComponent <Camera>();
                    if (component2 == null)
                    {
                        return;
                    }
                    if (component2.renderingPath != RenderingPath.Forward)
                    {
                        component2.renderingPath = RenderingPath.Forward;
                    }
                    component2.backgroundColor = new Color(0f, 0f, 0f);
                    if (component2 != null)
                    {
                        component.enabled = false;
                        Camera component3 = child.GetComponent <Camera>();
                        if (component3 == null)
                        {
                            return;
                        }
                        int cullingMask = component3.cullingMask;
                        component3.CopyFrom(component2);
                        component3.cullingMask = cullingMask;
                        if (NrBattleCamera.m_BackupCameraData == null)
                        {
                            return;
                        }
                        NrBattleCamera.m_BackupCameraData.trParent = child.parent;
                        child.parent = child2;
                        NrBattleCamera.m_BackupCameraData.CameraLevel = component.m_nCameraLevel;
                        NrBattleCamera.m_BackupCameraData.checkbackup = true;
                        if (this.m_TargetGo != null)
                        {
                            this.m_veTriggerStartPos = this.m_TargetGo.transform.position;
                        }
                        this.SetcameraPos(pkTarget.GetCharPos());
                        Transform child4 = NkUtil.GetChild(gameObject.transform, "@battlemap");
                        if (child4 != null)
                        {
                            Transform child5 = NkUtil.GetChild(child4, "normal1");
                            if (child5 != null)
                            {
                                child5.gameObject.SetActive(false);
                                this.m_SkyBoxMaterial = RenderSettings.skybox;
                                RenderSettings.skybox = null;
                                NrTSingleton <NkBattleCharManager> .Instance.ShowHideAlly(pkTarget.Ally, pkTarget.GetBUID(), false, true);

                                Battle.BATTLE.GRID_MANAGER.ShowHideGrid(false);
                            }
                        }
                        GameObject gameObject2 = GameObject.Find("UI Camera");
                        if (gameObject2 != null)
                        {
                            Camera componentInChildren = gameObject2.GetComponentInChildren <Camera>();
                            if (componentInChildren != null)
                            {
                                componentInChildren.enabled = false;
                            }
                        }
                        Battle.BATTLE.InputControlTrigger = true;
                    }
                }
            }
        }
        else
        {
            if (NrBattleCamera.m_BackupCameraData == null)
            {
                return;
            }
            if (NrBattleCamera.m_BackupCameraData.checkbackup && NrBattleCamera.m_BackupCameraData.trParent != null)
            {
                GameObject gameObject3 = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);
                if (gameObject3 == null)
                {
                    return;
                }
                Transform child6 = NkUtil.GetChild(gameObject3.transform, "Main Camera");
                if (child6 == null)
                {
                    return;
                }
                maxCamera component4 = child6.GetComponent <maxCamera>();
                if (component4 == null)
                {
                    return;
                }
                if (!component4.enabled && NrBattleCamera.m_BackupCameraData.trParent != null)
                {
                    child6.parent      = NrBattleCamera.m_BackupCameraData.trParent;
                    component4.enabled = true;
                    NrBattleCamera.m_BackupCameraData.trParent = null;
                }
                component4.m_nCameraLevel = NrBattleCamera.m_BackupCameraData.CameraLevel;
                component4.SetLevelValue();
                NrBattleCamera.m_BackupCameraData.checkbackup = false;
                this.SetcameraPos(this.m_veTriggerStartPos);
                Battle.BATTLE.InputControlTrigger = false;
                Transform child7 = NkUtil.GetChild(gameObject3.transform, "@battlemap");
                if (child7 != null)
                {
                    Transform child8 = NkUtil.GetChild(child7, "normal1");
                    if (child8 != null)
                    {
                        child8.gameObject.SetActive(true);
                        if (this.m_SkyBoxMaterial != null)
                        {
                            RenderSettings.skybox = this.m_SkyBoxMaterial;
                            this.m_SkyBoxMaterial = null;
                        }
                        NrTSingleton <NkBattleCharManager> .Instance.ShowHideAlly(pkTarget.Ally, pkTarget.GetBUID(), true, true);

                        Battle.BATTLE.GRID_MANAGER.ShowHideGrid(true);
                    }
                }
                GameObject gameObject4 = GameObject.Find("UI Camera");
                if (gameObject4 != null)
                {
                    Camera componentInChildren2 = gameObject4.GetComponentInChildren <Camera>();
                    if (componentInChildren2 != null)
                    {
                        componentInChildren2.enabled = true;
                    }
                }
            }
        }
    }
Пример #27
0
    public bool SetBattleCamera(ref NrBattleMap battleMap)
    {
        GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene);

        if (gameObject == null)
        {
            return(false);
        }
        Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera");

        if (child == null)
        {
            return(false);
        }
        Transform child2 = NkUtil.GetChild(gameObject.transform, "battle_terrain");

        if (child2 == null)
        {
            return(false);
        }
        Transform child3 = NkUtil.GetChild(gameObject.transform, "@battlemap");

        if (child3 != null)
        {
            Transform child4 = NkUtil.GetChild(child3, "normal1");
            if (child4 != null)
            {
                child4.gameObject.SetActive(true);
            }
        }
        if (Battle.BATTLE.CameraTarget != null)
        {
            this.m_TargetGo = (UnityEngine.Object.Instantiate(Battle.BATTLE.CameraTarget) as GameObject);
            this.m_TargetGo.SetActive(true);
        }
        if (this.m_TargetGo != null)
        {
            this.m_TargetGo.name = "BattleCameraTarget";
        }
        else
        {
            this.m_TargetGo = GameObject.Find("BattleCameraTarget");
            if (this.m_TargetGo == null)
            {
                this.m_TargetGo = new GameObject("BattleCameraTarget");
            }
        }
        Vector3 vector = child.position;

        vector.y = battleMap.GetBattleMapHeight(vector);
        if (vector.y == 0f)
        {
            vector = battleMap.GetBattleMapCenterPos();
        }
        this.m_TargetGo.transform.position = vector;
        maxCamera component = child.GetComponent <maxCamera>();
        Transform child5    = NkUtil.GetChild(this.m_TargetGo.transform, "CameraTarget");

        if (child5 != null)
        {
            this.m_goTargetAni = child5.gameObject;
        }
        component.m_bBattleCamera = true;
        if (Battle.BATTLE.BattleRoomtype != eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_BABELTOWER && Battle.BATTLE.BattleRoomtype != eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_BOUNTYHUNT)
        {
            component.m_nCameraLevel = 3;
        }
        else if (Battle.BabelPartyCount > 1)
        {
            component.m_nCameraLevel = 1;
        }
        else
        {
            component.m_nCameraLevel = 3;
        }
        if (this.m_goTargetAni != null)
        {
            component.target = this.m_goTargetAni.transform;
        }
        else
        {
            component.target = this.m_TargetGo.transform;
        }
        component.Init();
        this.CameraAniStop();
        GameObject gameObject2 = GameObject.Find("bp1");
        GameObject gameObject3 = GameObject.Find("bp2");

        if (gameObject2 != null && gameObject3 != null)
        {
            this.m_fMoveLimitX = gameObject2.transform.position.x;
            this.m_fMoveLimitZ = gameObject2.transform.position.z;
            this.m_fMapXSize   = gameObject3.transform.position.x;
            this.m_fMapZSize   = gameObject3.transform.position.z;
        }
        else
        {
            this.m_fMapXSize = (float)battleMap.GetSizeX() - this.m_fMoveLimitX;
            this.m_fMapZSize = (float)battleMap.GetSizeY() - this.m_fMoveLimitZ;
        }
        this.currentDistance = this.m_TargetGo.transform.position.y;
        this.desiredDistance = this.m_TargetGo.transform.position.y;
        if (Application.isEditor)
        {
            Transform  child6      = NkUtil.GetChild(gameObject.transform, "CAMERATARGETCUBE");
            GameObject gameObject4 = null;
            if (child6 != null)
            {
                gameObject4 = child6.gameObject;
            }
            if (gameObject4 == null)
            {
                gameObject4 = GameObject.CreatePrimitive(PrimitiveType.Cube);
                Collider component2 = gameObject4.GetComponent <Collider>();
                UnityEngine.Object.Destroy(component2);
                gameObject4.transform.parent        = this.m_TargetGo.transform;
                gameObject4.transform.localPosition = Vector3.zero;
                gameObject4.transform.localScale    = new Vector3(0.1f, 0.1f, 0.1f);
                gameObject4.name = "CAMERATARGETCUBE";
            }
            MeshRenderer component3 = gameObject4.GetComponent <MeshRenderer>();
            if (component3 != null)
            {
                component3.material = new Material(component3.sharedMaterial)
                {
                    color = new Color(1f, 0f, 0f)
                };
            }
        }
        TsSceneSwitcher.Instance.Collect(TsSceneSwitcher.ESceneType.BattleScene, this.m_TargetGo);
        child.camera.useOcclusionCulling = false;
        Camera component4 = child.GetComponent <Camera>();

        if (component4 != null && component4.renderingPath != RenderingPath.Forward)
        {
            component4.renderingPath = RenderingPath.Forward;
        }
        return(true);
    }
Пример #28
0
    //    ███████╗████████╗ █████╗ ██████╗ ████████╗
    //    ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝
    //    ███████╗   ██║   ███████║██████╔╝   ██║
    //    ╚════██║   ██║   ██╔══██║██╔══██╗   ██║
    //    ███████║   ██║   ██║  ██║██║  ██║   ██║
    //    ╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝
    void Start()
    {
        // Initialize Terrain vars
        thisTerrain = Terrain.activeTerrain;
        size = thisTerrain.terrainData.size;
        xRes = thisTerrain.terrainData.heightmapWidth;
        zRes = thisTerrain.terrainData.heightmapHeight;
        xPixSize = size.x / xRes;
        zPixSize = size.z / zRes;
        heights = thisTerrain.terrainData.GetHeights (0, 0, xRes, zRes);

        // Initialize other vars
        FPC = GameObject.Find ("First Person Controller");
        FPCCont = FPC.GetComponent<CharacterController> ();
        FPCCamera = GameObject.Find ("FPCamera").GetComponent<Camera>();
        //FPCCameraScript = GameObject.Find ("FPCamera").GetComponent<MouseLook>();

        orbitCamera = GameObject.Find ("GodCamera").GetComponent<Camera>();
        orbitCameraScript = GameObject.Find ("GodCamera").GetComponent<maxCamera> ();

        dirLightObj = GameObject.Find ("base_sun");
        dirLight = dirLightObj.GetComponent<Light> ();
        cursorProjector = GetComponentInChildren<Projector> ();
        cursorProjector.orthographic = true;
        cursorProjector.orthographicSize = pullRadius;

        // Refit terrain under certain UI flags
        if (resizeOnStart) {
            resizeTerrain(newX, newY, newX);
        }
        if (flattenOnStart) {
            flattenTerrain(flattenedHeight);
        }
        if (newPerlin) {
            perlinTerrain();
        }

        // Apply new Textures based on terrain topology
        splatmapData = new float[thisTerrain.terrainData.alphamapWidth, thisTerrain.terrainData.alphamapHeight, thisTerrain.terrainData.alphamapLayers];
        clearAlphaMaps (); 		// set Alpha Map to solid black
        applyTexture ();  		// apply Alpha Map according to start configuration

        // Set the FPC's position to sit on top of Terrain's center
        float h = thisTerrain.terrainData.GetInterpolatedHeight(0.5f, 0.5f);
        Vector3 terrCenter = new Vector3 (size.x / 2, h + FPCCont.height / 2 + 1, size.z / 2);
        FPC.transform.position = terrCenter;
    }