Ejemplo n.º 1
0
 public void SetMove(W_Axis axis, float timer, float speed)
 {
     moving    = true;
     moveFlag  = false;
     moveAxis  = axis;
     moveTimer = timer;
     moveSpeed = speed;
 }
Ejemplo n.º 2
0
 public void SetRotate(W_Axis axis, float timer, float speed)
 {
     rotating    = true;
     rotateFlag  = false;
     rotateAxis  = axis;
     rotateTimer = timer;
     rotateSpeed = speed;
 }
Ejemplo n.º 3
0
 public void SetMoveAndRotate(W_Axis moveAxis, W_Axis rotateAxis, float moveSpeed, float rotateSpeed, float moveTimer, float rotateTimer)
 {
     moving           = true;
     moveFlag         = false;
     rotating         = true;
     rotateFlag       = false;
     this.moveAxis    = moveAxis;
     this.rotateAxis  = rotateAxis;
     this.moveTimer   = moveTimer;
     this.rotateTimer = rotateTimer;
     this.moveSpeed   = moveSpeed;
     this.rotateSpeed = rotateSpeed;
 }
Ejemplo n.º 4
0
 //旋转和位移同轴运动,旋转和位移的运动时间保持一定的比例
 public virtual void SetMoveAndRotate(W_Axis axis, float moveSpeed, float rotateSpeed, float timer, float rotateToMove = 1)
 {
     moving           = true;
     moveFlag         = false;
     rotating         = true;
     rotateFlag       = false;
     moveAxis         = axis;
     rotateAxis       = axis;
     moveTimer        = timer;
     rotateTimer      = timer * rotateToMove;
     this.moveSpeed   = moveSpeed;
     this.rotateSpeed = rotateSpeed;
 }
Ejemplo n.º 5
0
 void RotateTimer()
 {
     if (!ratateFlag)
     {
         rotateTimer -= Time.deltaTime;
         if (rotateTimer <= 0)
         {
             ratateFlag = true;
             rotateAxis = W_Axis.none;
             moveAxis   = W_Axis.none;
         }
     }
 }
Ejemplo n.º 6
0
 void MoveTimer()
 {
     if (!moveFlag)
     {
         moveTimer -= Time.deltaTime;
         if (moveTimer <= 0)
         {
             moveFlag   = true;
             rotateAxis = W_Axis.none;
             moveAxis   = W_Axis.none;
         }
     }
 }
Ejemplo n.º 7
0
    public static void RotateDegree(Transform trans, W_Axis axis, float degree, float duration, RotateMode rotateMode = RotateMode.FastBeyond360)
    {
        Vector3 localOri = trans.localEulerAngles;
        Vector3 worldOri = trans.eulerAngles;

        Debug.Log("转");
        switch (axis)
        {
        case W_Axis.localX: trans.DOLocalRotate(localOri + new Vector3(degree, 0, 0), duration, rotateMode); break;

        case W_Axis.localY: trans.DOLocalRotate(localOri + new Vector3(0, degree, 0), duration, rotateMode); break;

        case W_Axis.localZ: trans.DOLocalRotate(localOri + new Vector3(0, 0, degree), duration, rotateMode); break;

        case W_Axis.worldX: trans.DORotate(worldOri + new Vector3(degree, 0, 0), duration, rotateMode); break;

        case W_Axis.worldY: trans.DORotate(worldOri + new Vector3(0, degree, 0), duration, rotateMode); break;

        case W_Axis.worldZ: trans.DORotate(worldOri + new Vector3(0, 0, degree), duration, rotateMode); break;

        case W_Axis.none: Debug.Log("请填入转轴"); break;
        }
    }