Ejemplo n.º 1
0
    /// <summary>
    /// 自身载具移动
    /// </summary>
    protected virtual void MoveObj()
    {
        if (currentTargetPos == Vector3.zero)
        {
            Debug.LogError("cnm");
        }
        // 通过寻路系逐点到达
        if (!myPath.isFinish)
        {
            //currentTargetPos = path.WayPoint;
            if (myPath.IsReach(transform))
            {
                myPath.NextWaypoint();
                currentTargetPos = myPath.WayPoint;
            }

            transform.Translate(Vector3.forward * moveSpeed * Time.fixedDeltaTime);
            if (isWheelRotate)
            {
                WheelRotate();      // 轮子的旋转
            }
        }
        else if (engineSource != null && engineSource.isPlaying)
        {
            engineSource.Stop();    // 停止音效
        }
    }