示例#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());
             }
         }
     }
 }
示例#2
0
 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);
 }
示例#3
0
 protected bool mLateUpdate = true;          // 是否在LateUpdate中更新连接器
 public CameraLinker(Type type, string name)
     : base(type, name)
 {
     mCurSwitch    = null;
     mLookAtOffset = new Vector3(0.0f, 2.0f, 0.0f);
     mLookAtTarget = false;
     mLinkObject   = null;
     mSwitchList   = new Dictionary <CAMERA_LINKER_SWITCH, CameraLinkerSwitch>();
 }
示例#4
0
 protected void destroySwitch()
 {
     foreach (var item in mSwitchList)
     {
         item.Value.destroy();
     }
     mSwitchList.Clear();
     mCurSwitch = null;
 }
示例#5
0
 public override void resetProperty()
 {
     base.resetProperty();
     mSwitchList.Clear();
     mCurSwitch        = null;
     mLinkObject       = null;
     mCamera           = null;
     mRelativePosition = Vector3.zero;
     mLookAtOffset     = new Vector3(0.0f, 2.0f, 0.0f);
     mLateUpdate       = true;
     mLookAtTarget     = false;
 }
示例#6
0
 public void destroySwitch()
 {
     if (mSwitchList.Count == 0)
     {
         return;
     }
     foreach (var item in mSwitchList)
     {
         item.Value.destroy();
     }
     mSwitchList.Clear();
     mCurSwitch = null;
 }
示例#7
0
 public virtual void notifyFinishSwitching(CameraLinkerSwitch fixedSwitch)
 {
     mCurSwitch = null;
 }                                                                                                    // 由转换器调用,通知连接器转换已经完成
示例#8
0
 // 由转换器调用,通知连接器转换已经完成
 public virtual void notifyFinishSwitching(CameraLinkerSwitch fixedSwitch)
 {
     mCurSwitch = null;
 }