Exemple #1
0
    public void SpawnWorker()
    {
        if (_scCamera == null)
        {
            return; // no camera, bail!
        }
        var walker = SpawnWalker();

        if (walker != null)
        {
            _scCamera.Follow(walker);
        }
    }
 private void CheckWalkerClick()
 {
     if (Input.GetKeyDown(KeyCode.Mouse0))
     {
         RaycastHit hit;
         var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit, 1000f))
         {
             var tag = hit.collider.gameObject.tag;
             if (tag == "Walker")
             {
                 _rtsCamera.Follow(hit.collider.gameObject);
             }
         }
     }
 }
    /// <summary>
    /// 카메라가 대상을 바라보면서 따라다니도록 한다.
    /// </summary>
    /// <param name="target"></param>
    /// <param name="snap"></param>
    public void Follow(Transform target, bool snap = false)
    {
        if (null != RtsCamera)
        {
            RtsCamera.Follow(target, snap);
        }

        //Debug.Log( "Follow() : " + RtsCamera.FollowTarget, transform );
    }
    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);
    }
Exemple #5
0
 private void SetTarget()
 {
     _rtsCamera.Follow(FollowTarget, Snap);
     _prevFollowTarget = FollowTarget;
 }
Exemple #6
0
    IEnumerator PanelUpdate(float speed)
    {
        rtsCamera.Distance      = 11;
        rtsCamera.ZoomDampening = 6;

        if (G_GameInfo.CharacterMgr.allTypeDic.ContainsKey(UnitType.Boss) && G_GameInfo.CharacterMgr.allTypeDic[UnitType.Boss].Count > 0 && G_GameInfo.CharacterMgr.allTypeDic[UnitType.Boss][0] != null)
        {
            rtsCamera.Follow(G_GameInfo.CharacterMgr.allTypeDic[UnitType.Boss][0].transform);
        }

        //if (GameDefine.GamePerformance && _TiltShiftHdr != null && _MotionBlur != null)
        //{
        //_TiltShiftHdr.enabled = true;
        //_MotionBlur.enabled = true;

        //    while (true)
        //    {
        //        NowValue += speed * Time.deltaTime;
        //        NowBlurSize += (speed * 10) * Time.deltaTime;

        //        _TiltShiftHdr.maxBlurSize = NowBlurSize;

        //        if (NowValue >= 0.4f)
        //            break;

        //        yield return null;
        //    }

        //    render.enabled = false;
        //    speed *= 0.3f;
        //    while (true)
        //    {
        //        NowValue -= speed * Time.deltaTime;
        //        NowBlurSize -= (speed * 10) * Time.deltaTime;

        //        _TiltShiftHdr.maxBlurSize = NowBlurSize;
        //        if (NowValue <= 0)
        //            break;

        //        yield return null;
        //    }


        //    _TiltShiftHdr.enabled = false;
        //    Destroy(_TiltShiftHdr);
        //    //Destroy(_MotionBlur);
        //}

        //else
        {
            while (true)
            {
                NowValue += speed * Time.deltaTime;
                if (NowValue >= 0.4f)
                {
                    break;
                }

                yield return(null);
            }

            speed *= 0.3f;
            while (true)
            {
                NowValue -= speed * Time.deltaTime;
                if (NowValue <= 0)
                {
                    break;
                }

                yield return(null);
            }
        }



        Destroy(this.gameObject);
    }
Exemple #7
0
 void OnEntityTurnStart(CControllerComponent controller)
 {
     m_RTSCamera.JumpTo(controller.entity.transform);
     m_RTSCamera.Follow(controller.entity.transform);
 }