Exemple #1
0
    public EStateType Update(float in_time)
    {
        //if(Mathf.Approximately(_owner.GetVectorBetweenCameraAndPoint().magnitude, 0f))
        //if(_owner.GetVectorBetweenCameraAndPoint().magnitude < 0.001f)
        if (_owner.IsAngleObtuse())
        {
            _owner.StopAllCameraMovements();
            Debug.Log(string.Format("GO TO IDLE; Distance = {0}", _owner.GetVectorBetweenCameraAndPoint().magnitude));
            return(EStateType.Idle);
        }


        Vector3 cam_velocity_project   = Vector3.Project(_owner.GetCameraVelocity(), _owner.GetVectorBetweenCameraAndPoint().normalized);
        Vector3 point_velocity_project = Vector3.Project(_owner.GetPointVelocity(), _owner.GetVectorBetweenCameraAndPoint().normalized);

        if (cam_velocity_project.magnitude < point_velocity_project.magnitude)
        {
            Debug.Log(string.Format("GO TO ACCELERATE; Distance = {0}", _owner.GetVectorBetweenCameraAndPoint().magnitude));
            return(EStateType.Accelerate);
        }

        Debug.Log(string.Format("GETSLOW: Current Camera Velocity = {0}, Current Point Velocity = {1}, Distance Between Camera and Point = {2}",
                                _owner.GetCameraVelocity().magnitude, _owner.GetPointVelocity().magnitude, _owner.GetVectorBetweenCameraAndPoint().magnitude));

        return(EStateType.GetSlow);
    }
Exemple #2
0
    public EStateType Update(float in_time)
    {
        Vector3 cam_velocity_project   = Vector3.Project(_owner.GetCameraVelocity(), _owner.GetVectorBetweenCameraAndPoint().normalized);
        Vector3 point_velocity_project = Vector3.Project(_owner.GetPointVelocity(), _owner.GetVectorBetweenCameraAndPoint().normalized);

        Debug.Log(string.Format("IDLE: Camera Velocity Project = {0} , Point Velocity Project = {1}, Distance = {2}",
                                cam_velocity_project.magnitude, point_velocity_project.magnitude, _owner.GetVectorBetweenCameraAndPoint().magnitude));

        if (cam_velocity_project.magnitude < point_velocity_project.magnitude)
        {
            Debug.Log(string.Format("GO TO ACCELERATE; Distance = {0}", _owner.GetVectorBetweenCameraAndPoint().magnitude));
            return(EStateType.Accelerate);
        }

        return(EStateType.Idle);
    }
Exemple #3
0
    public EStateType Update(float in_time)
    {
        float cur_velocity   = _owner.GetCameraVelocity().magnitude;
        float deceleration   = _owner.GetCameraDeceleration();
        float break_distance = -(cur_velocity * cur_velocity) / (2 * deceleration);

        Debug.Log(string.Format("ACCELERATE: Break distance = {0}, Current Camera Velocity = {1}, Current Point Velocity = {2}, Distance Between Camera and Point = {3}",
                                break_distance, cur_velocity, _owner.GetPointVelocity().magnitude, _owner.GetVectorBetweenCameraAndPoint().magnitude));

        if (break_distance < _owner.GetVectorBetweenCameraAndPoint().magnitude)
        {
            return(EStateType.Accelerate);
        }
        else
        {
            Debug.Log(string.Format("GO TO GETSLOW; Distance = {0}", _owner.GetVectorBetweenCameraAndPoint().magnitude));
            return(EStateType.GetSlow);
        }
    }