Esempio n. 1
0
    protected void UpdateCamFightLockState()
    {
        if (!IsFightLock || _CamCtrlMode != CTRL_MODE.FOLLOW)
        {
            return;
        }

        if (_FightLockTarget == null)
        {
            QuitCamFightLock();
            return;
        }

        Vector3 player_look_pos  = GetRealLookPos(_CurHeightOffset); //主角身上的视点
        Vector3 monster_look_pos = GetLockTargetLookAtPos();
        //锁定视角的视点,在怪物和玩家连线上的一个点
        Vector3 cur_dir       = monster_look_pos - player_look_pos;
        float   length        = cur_dir.magnitude * CamConfig.FightLogkLookAtPointRate;
        float   dist_ratio    = (_DistOffset - CamConfig.CamMinOffsetDist) / _CurMaxDistOffset;
        float   cur_lock_dist = length * dist_ratio; //视点与锁定目标当前的水平距离

        float lock_dist_rate = cur_lock_dist / CamConfig.GetCamToPlayerMinDist();

        if (lock_dist_rate > CamConfig.UnLockDistRate)
        {
            //主角与目标的距离与最小距离比率超出配置比率,退出锁定视角
            QuitCamFightLock();
        }
    }
Esempio n. 2
0
        public static async Task <CamConfig> CheckConfiguration()
        {
            try {
                CamConfig newConfig;
                string    result = defaultResult;

                Console.WriteLine("checking for cam");
                result = await CustomScriptCommands.QuickQuery("queryconfig");

                if (result == null || result == defaultResult || result.Length < 12 || !result.ToLower().Contains("6d"))
                {
                    Console.WriteLine("checked null");
                    MainForm.m.WriteToResponses("Cam config received null", false);
                    return(CamConfig.Null);
                }

                string type = result.Substring(13, 1);
                MainForm.m.WriteToResponses("Cam config received response: " + result + "(" + type + ")", false);

                switch (type)
                {
                case "0":
                    newConfig = CamConfig.SSTraditional;
                    break;

                case "1":
                    newConfig = CamConfig.Strict;
                    break;

                case "2":
                    newConfig = CamConfig.RevTilt;
                    break;

                case "3":
                    newConfig = CamConfig.Legacy;
                    break;

                default:
                    newConfig = CamConfig.Null;
                    break;
                }


                MainForm.m.WriteToResponses("Cam config type: " + newConfig.ToString(), false);
                Console.WriteLine("Cam config type: " + newConfig.ToString());

                currentConfig = newConfig;

                return(newConfig);
            } catch (Exception e) {
                Console.WriteLine(e.ToString());
                MessageBox.Show("CHECK CAM CONFIG\n" + e.ToString());
                return(CamConfig.Null);
            }
        }
Esempio n. 3
0
    //更新相机向前的角度
    protected void UpdateForwardDeg(Vector3 local_forward)
    {
        local_forward.y = 0.0f;
        local_forward.Normalize();
        float yaw_deg_dest = Mathf.Acos(Vector3.Dot(Vector3.forward, local_forward)) * Mathf.Rad2Deg;

        if (local_forward.x < 0.0f)
        {
            yaw_deg_dest = 360.0f - yaw_deg_dest;
        }

        _YawDegDest   = yaw_deg_dest;
        _PitchDegDest = Mathf.Clamp(_PitchDegDest, CamConfig.GetMinPitch(), CamConfig.GetMaxPitch());
    }