Exemple #1
0
    protected virtual void UpdateCameraStates()
    {
        // CAMERA STATE - you can change the CameraState here, the bool means if you want lerp of not, make sure to use the same CameraState String that you named on TPCameraListData

        if (cam == null)
        {
            cam = FindObjectOfType <ThirdPersonCamera>();
            if (cam == null)
            {
                return;
            }
            if (cam)
            {
                cam.SetMainTarget(this.transform);
                cam.Init();
            }
        }
        if (changeCameraState)
        {
            cam.ChangeState(desiredCameraState, customlookAtPoint, smoothCameraState);
        }
        else if (blackboard.isCrouching)
        {
            cam.ChangeState("Crouch", true);
        }
        else
        {
            cam.ChangeState("MovementState", true);
        }
    }
Exemple #2
0
    /***********************************************************************
    *                           Init Methods
    ***********************************************************************/
    #region .
    private void InitializeComponents()
    {
        // Gets
        SmartWalker walker = GetComponentInChildren <SmartWalker>();

        Walker = walker.transform;

        RBody = GetComponent <Rigidbody>();
        Anim  = GetComponentInChildren <Animator>();

        FPCam = GetComponentInAllChildren <FirstPersonCamera>();
        TPCam = GetComponentInAllChildren <ThirdPersonCamera>();
        FPCam.Init();
        TPCam.Init();

        // Error Check
        if (RBody == null)
        {
            Debug.LogError("플레이어 캐릭터에 리지드바디가 존재하지 않습니다.");
        }
        if (Anim == null)
        {
            Debug.LogError("플레이어 캐릭터에 애니메이터가 존재하지 않습니다.");
        }

        // Init Component Values
        RBody.constraints    = RigidbodyConstraints.FreezeRotation;
        Anim.applyRootMotion = false;
    }
    /// <summary>
    /// 初始
    /// </summary>
    public void Init()
    {
        Messenger.AddListener(MessengerConst.OnCutsceneMovieBegin, OnCutsceneMovieBegin);

        LinkCamera();
//        m_bDirty = true;

        m_ThirdPersonCamera = new ThirdPersonCamera();
        m_ThirdPersonCamera.Init();
        m_CurrentCamera = m_ThirdPersonCamera;
        // m_EffectRenderTexture = new SynRenderTexture();
        //  m_EffectRenderTexture.Init();
    }
Exemple #4
0
 /// <summary>
 ///     Set the TPC Camara
 /// </summary>
 protected virtual void InitializeTpCamera()
 {
     if (tpCamera == null)
     {
         tpCamera = FindObjectOfType <ThirdPersonCamera>();
         if (tpCamera == null)
         {
             return;
         }
         if (tpCamera)
         {
             tpCamera.SetMainTarget(this.transform);
             tpCamera.Init();
         }
     }
 }
    public override void Init(object context = null, Action callback = null)
    {
        if (_instance == null)
        {
            _instance      = this;
            _entities      = new List <Entity>();
            _combatEvents  = new List <CombatEvent>();
            _actorsInScene = new List <Actor>(Object.FindObjectsOfType <Actor>());
            MainCamera     = gameCamera.GetComponent <Camera>();
            gameCamera.Init();
        }

        if (context is Actor actor)
        {
            _actorIndex = _actorsInScene.IndexOf(actor);
            SetPlayer(actor, true);
        }

        SetPhysicsPaused(_cachedPhysicsPaused);
        callback?.Invoke();
    }
Exemple #6
0
 private void Start()
 {
     cam         = Camera.main;
     m_RigidBody = GetComponent <Rigidbody>();
     foreach (CapsuleCollider c in GetComponents <CapsuleCollider>())
     {
         if (!c.isTrigger)
         {
             m_Capsule = c; break; //make sure to get the right capsule collider
         }
     }
     m_inter = GetComponent <Interaction>();
     m_anim  = GetComponentInChildren <Animator>();
     mouseLook.Init(this, cam);
     mouseLook2.Init(this, cam);
     world             = GameObject.FindGameObjectWithTag("CONTROL").GetComponent <World>(); //get world script
     CAMERAPERSPECTIVE = 0;
     shellOffset       = 0.1F; groundCheckDistance = 0.1F;
     posOld            = gameObject.transform.position;
     //jumped = false;
     //jumpWait = 1.0f;
     itemsInReach = new List <GameObject>();
 }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     m_curCameraMode = CameraMode.ThirdPersonFree;
     ThirdPersonCamera.Init(m_curCameraMode);
 }