示例#1
0
        /// <summary>
        /// Returns a vector which can be multiplied with an input vector to apply the current locks of the specified DoF.
        /// </summary>
        /// <param name="doF"></param>
        /// <returns></returns>
        public static Vector3 GetLocks(DoF doF)
        {
            Locks locks = doF == DoF.Translation ? GetCurrentTranslationLocks() : GetCurrentRotationLocks();

            return(new Vector3(
                       (locks.X || locks.All) && !Application.isPlaying ? 0 : 1,
                       (locks.Y || locks.All) && !Application.isPlaying ? 0 : 1,
                       (locks.Z || locks.All) && !Application.isPlaying ? 0 : 1));
        }
        /// <summary>
        /// Sets the defined component of Force object
        /// </summary>
        /// <param name="dof"></param>
        /// <returns></returns>
        public void SetComponent(DoF dof, double value)
        {
            switch (dof)
            {
            case DoF.Dx: dx = value; break;

            case DoF.Dy: dy = value; break;

            case DoF.Dz: dz = value; break;

            case DoF.Rx: rx = value; break;

            case DoF.Ry: ry = value; break;

            case DoF.Rz: rz = value; break;

            default: throw new ArgumentOutOfRangeException("dof");
            }
        }
        /// <summary>
        /// Gets the defined component of Force object
        /// </summary>
        /// <param name="dof"></param>
        /// <returns></returns>
        public double GetComponent(DoF dof)
        {
            switch (dof)
            {
            case DoF.Dx: return(dx);

            case DoF.Dy: return(dy);

            case DoF.Dz: return(dz);

            case DoF.Rx: return(rx);

            case DoF.Ry: return(ry);

            case DoF.Rz: return(rz);

            default: throw new ArgumentOutOfRangeException("dof");
            }
        }
示例#4
0
        /// <summary>
        /// Sets the defined component of Force object
        /// </summary>
        /// <param name="dof"></param>
        /// <returns></returns>
        public void SetComponent(DoF dof, double value)
        {
            switch (dof)
            {
            case DoF.Dx: Fx = value; break;

            case DoF.Dy: Fy = value; break;

            case DoF.Dz: Fz = value; break;

            case DoF.Rx: Mx = value; break;

            case DoF.Ry: My = value; break;

            case DoF.Rz: Mz = value; break;

            default: throw new ArgumentOutOfRangeException("dof");
            }
        }
示例#5
0
        /// <summary>
        /// Utility function to determine whether a specific axis is locked for the specified DoF.
        /// </summary>
        /// <param name="doF"></param>
        /// <param name="axis"></param>
        /// <returns></returns>
        public static bool GetLock(DoF doF, Axis axis)
        {
            Locks locks = doF == DoF.Translation ? GetCurrentTranslationLocks() : GetCurrentRotationLocks();

            switch (axis)
            {
            case Axis.X:
                return((locks.X || locks.All) && !Application.isPlaying);

            case Axis.Y:
                return((locks.Y || locks.All) && !Application.isPlaying);

            case Axis.Z:
                return((locks.Z || locks.All) && !Application.isPlaying);

            default:
                throw new ArgumentOutOfRangeException("axis");
            }
        }
示例#6
0
        /// <summary>
        /// Utility function for retrieving axis locking settings at runtime.
        /// </summary>
        /// <param name="doF"></param>
        /// <param name="axis"></param>
        /// <returns></returns>
        public static bool GetLock(DoF doF, Axis axis)
        {
            Locks translationLocks = Mode == OperationMode.Fly || Mode == OperationMode.Orbit ? NavTranslationLock : ManipulateTranslationLock;
            Locks rotationLocks    = Mode == OperationMode.Fly || Mode == OperationMode.Orbit ? NavRotationLock : ManipulateRotationLock;
            Locks locks            = doF == DoF.Translation ? translationLocks : rotationLocks;

            switch (axis)
            {
            case Axis.X:
                return((locks.X || locks.All) && !Application.isPlaying);

            case Axis.Y:
                return((locks.Y || locks.All) && !Application.isPlaying);

            case Axis.Z:
                return((locks.Z || locks.All) && !Application.isPlaying);

            default:
                throw new ArgumentOutOfRangeException("axis");
            }
        }
    void Start()
    {
        _dof = GetComponentInChildren <DoF>();

        GameObject gm = GameObject.Find("GameManager");

        if (!gm)
        {
            Debug.LogError("Spectator could't find GameManager object");
            return;
        }

        _gameManager   = gm.GetComponent <GameManager>();
        _photonManager = gm.GetComponent <PhotonManager>();

        _gameManager.onGameOver.AddListener(End);

        StartCoroutine(CameraFinder());

        EnableMode(mode);
    }
        public DofConstraint GetComponent(DoF dof)
        {
            switch (dof)
            {
            case DoF.Dx:
                return(DX);

                break;

            case DoF.Dy:
                return(DY);

                break;

            case DoF.Dz:
                return(DZ);

                break;

            case DoF.Rx:
                return(RX);

                break;

            case DoF.Ry:
                return(RX);

                break;

            case DoF.Rz:
                return(RX);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(dof), dof, null);
            }
        }
示例#9
0
 public ElementLocalDof(int nodeIndex, DoF dof)
 {
     NodeIndex = nodeIndex;
     Dof       = dof;
 }