Exemple #1
0
 public virtual void setRelativePosition(Vector3 pos, CAMERA_LINKER_SWITCH switchType = CAMERA_LINKER_SWITCH.CLS_NONE,
                                         bool useDefaultSwitchSpeed = true, float switchSpeed = 1.0f)
 {
     // 如果不使用转换器,则直接设置位置
     if (switchType == CAMERA_LINKER_SWITCH.CLS_NONE)
     {
         mRelativePosition = pos;
     }
     // 如果使用转换器,则查找相应的转换器,设置参数
     else
     {
         mCurSwitch = getSwitch(switchType);
         // 找不到则直接设置位置
         if (mCurSwitch == null)
         {
             mRelativePosition = pos;
         }
         else
         {
             // 如果不适用默认速度,其实是转换器当前的速度,则设置新的速度
             if (!useDefaultSwitchSpeed)
             {
                 mCurSwitch.init(mRelativePosition, pos, switchSpeed);
             }
             // 否则就将转换器当前的速度设置进去
             else
             {
                 mCurSwitch.init(mRelativePosition, pos, mCurSwitch.getSwitchSpeed());
             }
         }
     }
 }
 public virtual void setRelativePosition(Vector3 pos, Type switchType = null,
                                         bool useDefaultSwitchSpeed   = true,
                                         float switchSpeed            = 1.0f)
 {
     // 如果不使用转换器,则直接设置位置
     if (switchType == null)
     {
         mRelativePosition = pos;
         mCurSwitch        = null;
         return;
     }
     // 如果使用转换器,则查找相应的转换器,设置参数
     mCurSwitch = getSwitch(switchType);
     // 找不到则直接设置位置
     if (mCurSwitch == null)
     {
         mRelativePosition = pos;
         return;
     }
     // 如果不使用默认速度,其实是转换器当前的速度,则设置新的速度
     if (useDefaultSwitchSpeed)
     {
         switchSpeed = mCurSwitch.getSwitchSpeed();
     }
     mCurSwitch.init(mRelativePosition, pos, switchSpeed);
 }