コード例 #1
0
    private void Awake()
    {
        Instance = this;
        string sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;

        _currLevelResultIndex = _levelResults.LevelResultsList.FindIndex(r => r.SceneName == sceneName);
        if (_currLevelResultIndex == -1)
        {
            _levelResults.LevelResultsList.Add(new LevelResults.LevelResult
            {
                SceneName  = sceneName,
                StarsCount = 0
            });
        }

        _rtsCamera        = Camera.GetComponent <RtsCamera>();
        EnemyCount        = 0;
        IsAllWavesSpawned = false;
        if (Camera == null)
        {
            Camera = Camera.main;
        }
        if (_mainBase != null)
        {
            _mainBase.GetComponent <DamagableTower>().DieEvent += OnBaseDie;
        }
        CurrPlayerProtectShrines = (LevelConfig.PlayerProtectShrine[])_levelConfig.playerProtectShrines.Clone();
    }
コード例 #2
0
ファイル: DemoMain.cs プロジェクト: gato0429/GlobalGame2016
    private void Start()
    {
        _rtsCamera = MainCamera.GetComponent<RtsCamera>();
        if (_rtsCamera == null)
            return; // can't really do anything, so we'll bail... avoid lots of null ref exceptions

        _rtsCamera.OnBeginFollow = t =>
                                {
                                    EnableWalkerSelection(t, true);
                                };
        _rtsCamera.OnEndFollow = t =>
                              {
                                  EnableWalkerSelection(t, false);
                              };

        // _rtsCamera.GetTerrainHeight = MyGetTerrainHeightFunction;

        //
        // give each walker a unique name (number)
        //

        var walkers = GameObject.FindGameObjectsWithTag("Walker");
        if (walkers != null && walkers.Length > 0)
        {
            for (var i = 0; i < walkers.Length; i++)
            {
                var walkerName = "Worker " + (i + 1);
                SetWalkerName(walkers[i], walkerName);
            }
        }
    }
コード例 #3
0
    private void Start()
    {
        _scCamera = MainCamera.GetComponent <RtsCamera>();
        if (_scCamera == null)
        {
            return; // can't really do anything, so we'll bail... avoid lots of null ref exceptions
        }
        _scCamera.OnBeginFollow = t =>
        {
            EnableWalkerSelection(t, true);
        };
        _scCamera.OnEndFollow = t =>
        {
            EnableWalkerSelection(t, false);
        };

        // _scCamera.GetTerrainHeight = MyGetTerrainHeightFunction;

        //
        // give each walker a unique name (number)
        //

        var walkers = GameObject.FindGameObjectsWithTag("Walker");

        if (walkers != null && walkers.Length > 0)
        {
            for (var i = 0; i < walkers.Length; i++)
            {
                var walkerName = "Worker " + (i + 1);
                SetWalkerName(walkers[i], walkerName);
            }
        }
    }
コード例 #4
0
ファイル: DemoGui.cs プロジェクト: gato0429/GlobalGame2016
    void Start()
    {
        _scCamera = MainCamera.GetComponent<RtsCamera>();
        _scKeys = MainCamera.GetComponent<RtsCameraKeys>();
        _scMouse = MainCamera.GetComponent<RtsCameraMouse>();

        _scDemoMain = GetComponent<DemoMain>();
    }
コード例 #5
0
    void Start()
    {
        _scCamera = MainCamera.GetComponent <RtsCamera>();
        _scKeys   = MainCamera.GetComponent <RtsCameraKeys>();
        _scMouse  = MainCamera.GetComponent <RtsCameraMouse>();

        _scDemoMain = GetComponent <DemoMain>();
    }
コード例 #6
0
    public void Setup(RtsCamera _rtsCam, FocusingCamera _FocusingCam)
    {
        rtsCam      = _rtsCam;
        FocusingCam = _FocusingCam;

        CameraManager.instance.SetSkillEventCamera(FocusingCam.gameObject);

        Live = true;
    }
コード例 #7
0
ファイル: Picker.cs プロジェクト: yuri410/lrvbsvnicg
 public Picker(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
 {
     this.parent    = parent;
     this.game      = game;
     this.renderSys = game.RenderSystem;
     this.scene     = scene;
     this.logic     = gamelogic;
     this.camera    = scene.Camera;
 }
コード例 #8
0
    protected override void Init()
    {
        base.Init();

        if (base.gameObject == null)
        {
            return;
        }

        proxyTrans = transform.FindChild("TransformProxy");
        if (null == proxyTrans)
        {
            Debug.LogError("you must have TransformProxy Object in CameraManager.");
            return;
        }

        RtsCamera = proxyTrans.GetComponent <RtsCamera>();
        if (null == RtsCamera)
        {
            RtsCamera      = proxyTrans.gameObject.AddComponent <RtsCamera>();
            rtsCameraMouse = proxyTrans.gameObject.AddComponent <RtsCameraMouse>();
            rtsCameraKeys  = proxyTrans.gameObject.AddComponent <RtsCameraKeys>();
        }
        else
        {
            rtsCameraMouse = proxyTrans.GetComponent <RtsCameraMouse>();
            rtsCameraKeys  = proxyTrans.GetComponent <RtsCameraKeys>();
        }

        mainCamera = proxyTrans.GetComponentInChildren <Camera>();
        Shaker     = mainCamera.GetComponent <Thinksquirrel.Utilities.CameraShake>();
        if (null == Shaker)
        {
            Shaker = mainCamera.gameObject.AddComponent <Thinksquirrel.Utilities.CameraShake>();
        }

        if (transform.FindChild("ClickEffect") != null)
        {
            Destroy(transform.FindChild("ClickEffect"));
        }

        GameObject effParent = new GameObject("ClickEffect");

        effParent.transform.parent        = transform;
        effParent.transform.localPosition = Vector3.zero;
        effParent.transform.localScale    = Vector3.one;
        effParent.layer = LayerMask.NameToLayer("UILayer");

        TouchEff = UIHelper.CreateEffectInGame(effParent.transform, "Fx_UI_click_01", true);

        //ActiveCamEff(false);

        InitData();
    }
コード例 #9
0
    // ***************************
    // add private variable here
    // ***************************
    // EXAMPLE: private DepthOfField34 _dof3;

    void Start()
    {
        _ohCam = GetComponent<RtsCamera>();
        if (_ohCam == null)
            this.enabled = false;

        // ***************************
        // get instance of component here
        // ***************************
        // EXAMPLE: _dof3 = GetComponent<DepthOfField34>();
    }
コード例 #10
0
    // ***************************
    // add private variable here
    // ***************************
    // EXAMPLE: private DepthOfField34 _dof3;

    void Start()
    {
        _ohCam = GetComponent <RtsCamera>();
        if (_ohCam == null)
        {
            this.enabled = false;
        }

        // ***************************
        // get instance of component here
        // ***************************
        // EXAMPLE: _dof3 = GetComponent<DepthOfField34>();
    }
コード例 #11
0
    // ***************************
    // add private variable here
    // ***************************

    void Start()
    {
        _ohCam = GetComponent <RtsCamera>();
        if (_ohCam == null)
        {
            this.enabled = false;
        }

        _dof3 = GetComponent <DepthOfField34>();
        _dof4 = GetComponent <DepthOfFieldScatter>();
        // ***************************
        // get instance of component here
        // ***************************
    }
コード例 #12
0
    void OnMouseDown()
    {
        if (_rtsCamera == null)
        {
            _rtsCamera = FindObjectOfType<RtsCamera>();
        }

        if (_rtsCamera == null)
        {
            Debug.LogWarning("FollowOnClick.OnClick - no RtsCamera instance found in this Scene!");
            return;
        }

        _rtsCamera.Follow(this.gameObject, Snap);
    }
コード例 #13
0
    void OnMouseDown()
    {
        if (_rtsCamera == null)
        {
            _rtsCamera = FindObjectOfType <RtsCamera>();
        }

        if (_rtsCamera == null)
        {
            Debug.LogWarning("FollowOnClick.OnClick - no RtsCamera instance found in this Scene!");
            return;
        }

        _rtsCamera.Follow(this.gameObject, Snap);
    }
コード例 #14
0
ファイル: MiniMap.cs プロジェクト: yuri410/lrvbsvnicg
        //float rot;

        public MiniMap(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
        {
            this.parent    = parent;
            this.game      = game;
            this.renderSys = game.RenderSystem;
            this.scene     = scene;
            this.gameLogic = gamelogic;
            this.camera    = scene.Camera;

            FileLocation fl = FileSystem.Instance.Locate("nig_minimap.tex", GameFileLocs.GUI);

            background = UITextureManager.Instance.CreateInstance(fl);


            #region 内容显示
            fl         = FileSystem.Instance.Locate("ig_map_view.tex", GameFileLocs.GUI);
            cameraView = UITextureManager.Instance.CreateInstance(fl);


            //fl = FileSystem.Instance.Locate("ig_mp_redpoint.tex", GameFileLocs.GUI);
            //redDot = UITextureManager.Instance.CreateInstance(fl);
            //fl = FileSystem.Instance.Locate("ig_mp_greenpoint.tex", GameFileLocs.GUI);
            //greenDot = UITextureManager.Instance.CreateInstance(fl);
            //fl = FileSystem.Instance.Locate("ig_mp_yellowpoint.tex", GameFileLocs.GUI);
            //yellowDot = UITextureManager.Instance.CreateInstance(fl);
            //fl = FileSystem.Instance.Locate("ig_mp_bluepoint.tex", GameFileLocs.GUI);
            //blueDot = UITextureManager.Instance.CreateInstance(fl);
            fl     = FileSystem.Instance.Locate("nig_mp_dot.tex", GameFileLocs.GUI);
            mapdot = UITextureManager.Instance.CreateInstance(fl);

            fl        = FileSystem.Instance.Locate("nig_mp_circle.tex", GameFileLocs.GUI);
            mapCircle = UITextureManager.Instance.CreateInstance(fl);


            //fl = FileSystem.Instance.Locate("ig_mp_red.tex", GameFileLocs.GUI);
            //redRing  = UITextureManager.Instance.CreateInstance(fl);
            //fl = FileSystem.Instance.Locate("ig_mp_green.tex", GameFileLocs.GUI);
            //greenRing = UITextureManager.Instance.CreateInstance(fl);
            //fl = FileSystem.Instance.Locate("ig_mp_yellow.tex", GameFileLocs.GUI);
            //yellowRing = UITextureManager.Instance.CreateInstance(fl);
            //fl = FileSystem.Instance.Locate("ig_mp_blue.tex", GameFileLocs.GUI);
            //blueRing = UITextureManager.Instance.CreateInstance(fl);

            #endregion
        }
コード例 #15
0
    private void Start()
    {
        rtsCamera = Camera.main.GetComponent<RtsCamera>();
        goodPosSlider.onValueChanged.AddListener(ChangeGoodPos);
        ServerDemo.Instance.OnRecevieInitData += OnReceiveInitData;
        ServerDemo.Instance.OnRecevieStepData += OnReceiveStepData;
        ServerDemo.Instance.OnRecevieResetCommand += OnReset;

        sceneObject.deskPosX.text = sceneObject.desk.position.x.ToString("0.00");
        sceneObject.deskPosZ.text = sceneObject.desk.position.z.ToString("0.00");
        sceneObject.deskW.text = SceneSizeOptions.Desk.width.ToString("0.00");
        sceneObject.deskH.text = SceneSizeOptions.Desk.heigth.ToString("0.00");
        sceneObject.deskL.text = SceneSizeOptions.Desk.length.ToString("0.00");

        _currentJXB = sceneObject.JXB0;
        sceneObject.jxbPosX.text = _currentJXB.transform.position.x.ToString("0.00");
        sceneObject.jxbPosZ.text = _currentJXB.transform.position.z.ToString("0.00");    
    }
コード例 #16
0
ファイル: GameMain.cs プロジェクト: kyapp69/rtstoy
        public void Start()
        {
            _instance = this;
            Application.targetFrameRate = 30;
            Time.timeScale = 1;
            Debug.unityLogger.logEnabled = true;


            Camera.main.transform.position = gameWorld.getSpawnPointPosition() + (Vector3.forward * 5);
            Camera.main.transform.position = VectorUtil.sitOnTerrain(Camera.main.transform.position) + (Vector3.up * 5);

            mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <RtsCamera>();
            if (mainCamera != null)
            {
                mainCamera.LookAt   = Camera.main.transform.position;
                mainCamera.Rotation = 180;
            }
        }
コード例 #17
0
        public GameScene(RenderSystem rs)
        {
            renderSys = rs;

            Viewport vp          = rs.Viewport;
            float    aspectRatio = vp.Width / (float)vp.Height;

            camera = new RtsCamera(42.5f, aspectRatio);


            SceneRendererParameter sm = new SceneRendererParameter();

            sm.SceneManager = new OctplSceneManager(PlanetEarth.PlanetRadius);
            sm.UseShadow    = true;
            sm.PostRenderer = new GamePostRenderer(renderSys, camera);



            renderer            = new SceneRenderer(renderSys, sm);
            renderer.ClearColor = ColorValue.White;


            camera.NearPlane    = 20;
            camera.FarPlane     = 6000;
            camera.Mode         = RenderMode.Final;
            camera.RenderTarget = renderSys.GetRenderTarget(0);

            renderer.RegisterCamera(camera);



            PlanetEarth earth = new PlanetEarth(renderSys);

            sm.SceneManager.AddObjectToScene(earth);

            OceanWater water = new OceanWater(renderSys);

            sm.SceneManager.AddObjectToScene(water);

            //Atmosphere atmos = new Atmosphere(renderSys);
            //sm.SceneManager.AddObjectToScene(atmos);
        }
コード例 #18
0
    // Use this for initialization
    void Start()
    {
        activeEnemyList              = new List <Enemy>();
        _placedBuildingList          = new List <GameObject>();
        _inActiveBuildingPreviewObjs = new List <GameObject>();

        //assign an ID to the shop items and check prices.
        for (int i = 0; i < shopItemsArray.Length; i++)
        {
            shopItemsArray[i].ID = i;
            CheckShopPrices(shopItemsArray[i]);
        }

        _gridScript        = GetComponent <Grid>();
        goldText.text      = "Gold: " + TotalGold.ToString();
        livesLeftText.text = "Lives Left: " + _livesLeft;
        _camScript         = Camera.main.GetComponent <RtsCamera>();
        _waitTime          = initWaitTime;

        _gameState         = GameState.BuildState;
        gameStateText.text = "Build State";
        levelText.text     = "Level: " + (1 + _currentLevel).ToString();
        LoadLevel(_currentLevel);
    }
コード例 #19
0
ファイル: RtsCameraTouch.cs プロジェクト: fqkw6/AStartTest
 void Awake()
 {
     _rtsCamera = GetComponent <RtsCamera>();
 }
コード例 #20
0
 // Use this for initialization
 private void Start()
 {
     _inputHandler = new InputHandler();
     _rtsCam       = Camera.main.GetComponent <RtsCamera>();
 }
コード例 #21
0
    /// <summary>
    /// 싱글스테이지 일때, 카메라 셋팅 변경
    /// </summary>
    /// <param name="isSingle">true라면 싱글스테이지용 카메라로 셋팅</param>
    public void SetupMainCamera(bool isRps = true, GAME_MODE mode = GAME_MODE.SINGLE, bool rotate = false)
    {
        if (null == CameraManager.instance.mainCamera)
        {
            return;
        }

        CameraManager.instance.EnableRPGCamera(isRps);
        if (isRps && mode != GAME_MODE.NONE)
        {
            // InGame용 카메라 셋팅값
            RtsCamera rts = CameraManager.instance.RtsCamera;
            rts.Distance           = 16;
            rts.Smoothing          = false;
            rts.Rotation           = -150;
            rts.Tilt               = 36;
            rts.LookAtHeightOffset = 1f;
            rts.MoveDampening      = 10f;
            rts.RotationDampening  = 5f;
            CameraManager.instance.mainCamera.fieldOfView = 40;

            if (mode == GAME_MODE.ARENA)
            {
                rts.Rotation    = 180;
                rts.Distance    = 32f;
                rts.MaxDistance = 32f;
                rts.Tilt        = 27;
            }
            else if (mode == GAME_MODE.FREEFIGHT)
            {
                rts.Distance    = 18;             //20;
                rts.Rotation    = 0;
                rts.MaxDistance = 18;
                if (FreeFightGameState.GameMode == GAME_MODE.MULTI_RAID)
                {
                    rts.Distance = 20;
                    rts.Rotation = -150;
                }
            }
            else if (mode == GAME_MODE.TOWER)
            {
                rts.Distance = 16;
                rts.Rotation = -55;
                rts.Tilt     = 25;
                CameraManager.instance.mainCamera.fieldOfView = 35;
            }
            //else if (mode == GAME_MODE.SHOOT)
            //{
            //    rts.Rotation = 180;
            //    rts.Distance = 24;
            //    rts.MaxDistance = 24;
            //    rts.Tilt = 32;
            //}

            if (rotate)
            {
                rts.Rotation = -55;
            }
        }
        else if (mode == GAME_MODE.NONE)
        {
            RtsCamera rts = CameraManager.instance.RtsCamera;
            rts.Distance           = 20f;
            rts.Smoothing          = false;
            rts.Rotation           = -150;
            rts.Tilt               = 36;
            rts.LookAtHeightOffset = 1f;
            rts.MoveDampening      = 10f;
            rts.RotationDampening  = 5f;
            rts.MaxDistance        = 20f;
            //rts.MinDistance = 3f;

            rts.MinDistance = 3.4f;
            rts.MaxDistance = 20f;
            //rts.MinTilt = 4.25f;
            rts.MinTilt = 20f;

            //마을일경우
            CameraManager.instance.mainCamera.transform.localPosition = new Vector3(0f, 0.8f, 0f);
            CameraManager.instance.mainCamera.fieldOfView             = 40;

            //CameraMouseZoom zoom = CameraManager.instance.mainCamera.gameObject.GetComponent<CameraMouseZoom>();
            //zoom.InitSetrot = new Vector3
        }

        Camera mainCam = CameraManager.instance.mainCamera;

        // 안개 색깔을 카메라 clear color로 설정
        mainCam.backgroundColor = RenderSettings.fogColor;
        // 안개로 안덮힌 부분까지만 보이기

        if (TownState.TownActive)
        {
            mainCam.farClipPlane = 100f;
        }
        else
        {
            mainCam.farClipPlane = 1000f;
        }
        //    mainCam.farClipPlane = RenderSettings.fogEndDistance;
    }
コード例 #22
0
ファイル: Game.cs プロジェクト: yuri410/lrvbsvnicg
        //public ScoreEntry[] ResultScore
        //{
        //    get;
        //    private set;
        //}

        public void Update(GameTime time)
        {
            if (!IsPaused)
            {
                scene.Update(time);
            }
            soundWorld.Update(time);

            RtsCamera camera = scene.Camera;

            SoundManager.Instance.ListenerPosition = camera.Position;// PlanetEarth.GetPosition(camera.Longitude, camera.Latitude);
            // scene.Camera.ViewMatrix.TranslationValue;

            if (!IsLoaded)
            {
                bool newVal = TerrainMeshManager.Instance.IsIdle &
                              ModelManager.Instance.IsIdle &
                              TextureManager.Instance.IsIdle &
                              TreeBatchModelManager.Instance.IsIdle;

                if (newVal)
                {
                    if (--loadingCountDown < 0)
                    {
                        IsLoaded = true;
                    }
                }
                else
                {
                    if (++loadingCountDown > 100)
                    {
                        loadingCountDown = 100;
                    }
                }

                int ldop = TerrainMeshManager.Instance.GetCurrentOperationCount();
                ldop += ModelManager.Instance.GetCurrentOperationCount();
                ldop += TextureManager.Instance.GetCurrentOperationCount();
                ldop += TreeBatchModelManager.Instance.GetCurrentOperationCount();

                if (ldop > maxLoadingOp)
                {
                    maxLoadingOp = ldop;
                }

                if (maxLoadingOp > 0)
                {
                    float newPrg = 1 - ldop / (float)maxLoadingOp;
                    if (newPrg > LoadingProgress)
                    {
                        LoadingProgress = newPrg;
                    }
                }

                ingameUI.Update(time);
            }
            else
            {
                //if (gameState.CheckGameOver())
                //{
                //if (!IsOver)
                //{
                //ResultScore = gameState.GetScores();
                //ScoreEntry[] entries = gameState.GetScores();
                //ingameUI.ShowScore(entries);
                //IsOver = true;
                //}
                //}
                //else
                {
                    if (!IsPaused)
                    {
                        gameState.Update(time);
                        if (gameState.CheckGameOver())
                        {
                            ingameUI.ShowFinished();
                        }
                    }
                }

                ingameUI.Update(time);
            }
        }
コード例 #23
0
    //This method is used in the turn system to turn on and off all
    //of the components that the player will need now that it is his turn
    //First disables all of the other player's components
    public void EnablePlayer1()
    {
        #region Disable Player 2
        if (gmScript.turnNumber > 1)
        {
            childCam = player2Inst.transform.FindChild("Camera").gameObject;
            playerCam = childCam.gameObject.GetComponent<Camera>();
            unitCam = player2Inst.transform.FindChild("UnitCam").gameObject.GetComponent<Camera>();
            playerAudio = player2Inst.gameObject.GetComponent<AudioListener>();
            playerScript = player2Inst.gameObject.GetComponent<script_2PPlayer>();
            cam = player2Inst.gameObject.GetComponent<RtsCamera>();
            camKeys = player2Inst.gameObject.GetComponent<RtsCameraKeys>();
            camMouse = player2Inst.gameObject.GetComponent<RtsCameraMouse>();
            effectsUpdater = player2Inst.gameObject.GetComponent<RtsEffectsUpdater>();
            targetScript = player2Inst.gameObject.GetComponent<TargetMover>();
            playerView = player2Inst.gameObject.GetComponent<Camera>();

            playerScript.isMyTurn = false;
            camKeys.enabled = false;
            camMouse.enabled = false;
            cam.enabled = false;
            effectsUpdater.enabled = false;
            targetScript.enabled = false;
            playerCam.enabled = false;
            unitCam.enabled = false;
            playerAudio.enabled = false;
            playerView.enabled = false;

            playerScript.enabled = false;
        }
        #endregion

        #region Enabled Player 1
        if (mainCam != null)
        {
            mainCam = Camera.main;
            GameObject.Destroy(mainCam.gameObject);
        }
        childCam = player1Inst.transform.FindChild("Camera").gameObject;
        playerCam = childCam.gameObject.GetComponent<Camera>();
        unitCam = player1Inst.transform.FindChild("UnitCam").gameObject.GetComponent<Camera>();
        camKeys = player1Inst.gameObject.GetComponent<RtsCameraKeys>();
        camMouse = player1Inst.gameObject.GetComponent<RtsCameraMouse>();
        cam = player1Inst.gameObject.GetComponent<RtsCamera>();
        playerScript = player1Inst.gameObject.GetComponent<script_2PPlayer>();
        effectsUpdater = player1Inst.gameObject.GetComponent<RtsEffectsUpdater>();
        targetScript = player1Inst.gameObject.GetComponent<TargetMover>();
        playerAudio = player1Inst.gameObject.GetComponent<AudioListener>();
        playerView = player1Inst.gameObject.GetComponent<Camera>();

        playerAudio.enabled = true;
        camKeys.enabled = true;
        camMouse.enabled = true;
        cam.enabled = true;
        playerScript.enabled = true;
        effectsUpdater.enabled = true;
        targetScript.enabled = true;
        playerView.enabled = true;

        if (gmScript.turnNumber <= 2)
        {
            cam.MinBounds = playerMinCoords;
            cam.MaxBounds = playerMaxCoords;
            cam.LookAt = player1SpawnCoords;
        }

        playerCam.enabled = true;
        unitCam.enabled = true;
        playerScript.isMyTurn = true;
        playerScript.movesRemaining = 5;
        #endregion
    }
コード例 #24
0
ファイル: TargetSelector.cs プロジェクト: cmadh/RTS-Camera
 private void Start()
 {
     cam    = gameObject.GetComponent <RtsCamera>();
     camera = gameObject.GetComponent <Camera>();
 }
コード例 #25
0
 public void StartEvent(float speed, RtsCamera _rtsCamera)
 {
     rtsCamera = _rtsCamera;
     StartCoroutine(PanelUpdate(speed));
 }
コード例 #26
0
ファイル: FollowHelper.cs プロジェクト: fqkw6/AStartTest
 void Start()
 {
     _rtsCamera = Camera.main.GetComponent <RtsCamera>();
     SetTarget();
 }
コード例 #27
0
ファイル: FollowHelper.cs プロジェクト: JBillingsley/SpyParty
 void Start()
 {
     _rtsCamera = Camera.main.GetComponent<RtsCamera>();
     SetTarget();
 }
コード例 #28
0
ファイル: Cursor.cs プロジェクト: yuri410/lrvbsvnicg
        void UpdateScroll(GameTime time)
        {
            #region 屏幕边缘滚动视野
            const int ScrollPadding = 3;
            RtsCamera camera        = parent.Scene.Camera;

            camera.Height += MouseInput.DScrollWheelValue * 0.05f;
            cursorState    = MouseCursor.Normal;
            if (MouseInput.X <= ScrollPadding)
            {
                camera.MoveLeft();
                cursorState |= MouseCursor.LeftArrow;
            }
            if (MouseInput.X >= Program.Window.ClientSize.Width - ScrollPadding)
            {
                camera.MoveRight();
                cursorState |= MouseCursor.RightArrow;
            }
            if (MouseInput.Y <= ScrollPadding)
            {
                camera.MoveFront();
                cursorState |= MouseCursor.UpArrow;
            }
            if (MouseInput.Y >= Program.Window.ClientSize.Height - ScrollPadding)
            {
                camera.MoveBack();
                cursorState |= MouseCursor.DownArrow;
            }

            #endregion
            if (MouseInput.IsMouseDownRight)
            {
                mouseRightPosition.X = MouseInput.X;
                mouseRightPosition.Y = MouseInput.Y;
            }
            if (MouseInput.IsRightPressed)
            {
                if (MouseInput.X != mouseRightPosition.X && MouseInput.Y != mouseRightPosition.Y)
                {
                    int dx = MouseInput.X - mouseRightPosition.X;
                    int dy = MouseInput.Y - mouseRightPosition.Y;

                    if (dx > 10)
                    {
                        dx = 20;
                    }
                    if (dx < -10)
                    {
                        dx = -20;
                    }
                    if (dy > 10)
                    {
                        dy = 20;
                    }
                    if (dy < -10)
                    {
                        dy = -20;
                    }

                    camera.Move(dx * -0.05f, dy * -0.05f);
                }
            }
        }
コード例 #29
0
 protected void Start()
 {
     _rtsCamera = gameObject.GetComponent<RtsCamera>();
 }
コード例 #30
0
 protected void Start()
 {
     _rtsCamera = gameObject.GetComponent <RtsCamera>();
 }
コード例 #31
0
    void Start()
    {
        _rtsCamera = gameObject.GetComponent <RtsCamera>();

        InputManager.instance.AddNonUIHitDelegate(UpdateInput);
    }
コード例 #32
0
ファイル: CameraManager.cs プロジェクト: c2001324/Leo
 public void Initialize()
 {
     camera      = GameObject.FindGameObjectWithTag(Tags.mainCamera).GetComponent <Camera>();
     m_RTSCamera = GameObject.FindGameObjectWithTag(Tags.mainCamera).GetComponent <RtsCamera>();
     GameEvent.TurnBaseEvent.onEntityTurnStart.AddListener(OnEntityTurnStart);
 }