コード例 #1
0
ファイル: CrowdAvoidanceParams.cs プロジェクト: zwong91/Titan
        /// <summary>
        /// Creates a standard high quality configuration.
        /// </summary>
        /// <returns>A high quality configuration.</returns>
        public static CrowdAvoidanceParams CreateStandardHigh()
        {
            CrowdAvoidanceParams result = new CrowdAvoidanceParams();

            result.velocityBias      = 0.5f;
            result.adaptiveDivisions = 7;
            result.adaptiveRings     = 3;
            result.adaptiveDepth     = 3;

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Sets the shared avoidance configuration for a specified index.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Multiple avoidance configurations can be set for the manager with agents assigned to
        /// different avoidance behaviors via the <see cref="CrowdAgentParams"/> object.
        /// </para>
        /// </remarks>
        /// <param name="index">
        /// The index. [Limits: 0 &lt;= value &lt; <see cref="MaxAvoidanceParams"/>].
        /// </param>
        /// <param name="config">The avoidance configuration.</param>
        /// <returns>True if the configuration is successfully set.</returns>
        public bool SetAvoidanceConfig(int index
                                       , CrowdAvoidanceParams config)
        {
            if (IsDisposed || index < 0 || index >= MaxAvoidanceParams)
            {
                return(false);
            }

            CrowdManagerEx.dtcSetObstacleAvoidanceParams(root, index, config);

            return(true);
        }
コード例 #3
0
        /// <summary>
        /// Gets the shared avoidance configuration for a specified index.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Getting a configuration for an index that has not been set will return a configuration
        /// in an undefined state.
        /// </para>
        /// </remarks>
        /// <param name="index">
        /// The index. [Limits: 0 &lt;= value &lt; <see cref="MaxAvoidanceParams"/>]
        /// </param>
        /// <returns>An avoidance configuration.</returns>
        public CrowdAvoidanceParams GetAvoidanceConfig(int index)
        {
            if (!IsDisposed && index >= 0 && index < MaxAvoidanceParams)
            {
                CrowdAvoidanceParams result = new CrowdAvoidanceParams();
                CrowdManagerEx.dtcGetObstacleAvoidanceParams(root
                                                             , index
                                                             , result);

                return(result);
            }
            return(null);
        }
コード例 #4
0
ファイル: CrowdAvoidanceSet.cs プロジェクト: oathx/Six
    /// <summary>
    /// Restores the object to its default state, releasing all references to existing 
    /// configurations.
    /// </summary>
    public void Reset()
    {
        mConfigs = new CrowdAvoidanceParams[CrowdManager.MaxAvoidanceParams];

        mConfigs[0] = CrowdAvoidanceParams.CreateStandardLow();
        mConfigs[1] = CrowdAvoidanceParams.CreateStandardMedium();
        mConfigs[2] = CrowdAvoidanceParams.CreateStandardGood();
        mConfigs[3] = CrowdAvoidanceParams.CreateStandardHigh();

        for (int i = 4; i < mConfigs.Length; i++)
        {
            mConfigs[i] = new CrowdAvoidanceParams();
        }
    }
コード例 #5
0
ファイル: CrowdAvoidanceParams.cs プロジェクト: zwong91/Titan
        /// <summary>
        /// Clones the current object. (Usually more appropriate than sharing references.)
        /// </summary>
        /// <returns>A clone of the object.</returns>
        public CrowdAvoidanceParams Clone()
        {
            CrowdAvoidanceParams result = new CrowdAvoidanceParams();

            result.velocityBias          = velocityBias;
            result.weightDesiredVelocity = weightDesiredVelocity;
            result.weightCurrentVelocity = weightCurrentVelocity;
            result.weightSide            = weightSide;
            result.weightToi             = weightToi;
            result.horizontalTime        = horizontalTime;
            result.gridSize          = gridSize;
            result.adaptiveDivisions = adaptiveDivisions;
            result.adaptiveRings     = adaptiveRings;
            result.adaptiveDepth     = adaptiveDepth;
            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Creates a standard high quality configuration.
        /// </summary>
        /// <returns>A high quality configuration.</returns>
        public static CrowdAvoidanceParams CreateStandardHigh()
        {
            CrowdAvoidanceParams result = new CrowdAvoidanceParams();

            result.velocityBias = 0.5f;
            result.adaptiveDivisions = 7;
            result.adaptiveRings = 3;
            result.adaptiveDepth = 3;

            return result;
        }
コード例 #7
0
 /// <summary>
 /// Clones the current object. (Usually more appropriate than sharing references.)
 /// </summary>
 /// <returns>A clone of the object.</returns>
 public CrowdAvoidanceParams Clone()
 {
     CrowdAvoidanceParams result = new CrowdAvoidanceParams();
     result.velocityBias = velocityBias;
     result.weightDesiredVelocity = weightDesiredVelocity;
     result.weightCurrentVelocity = weightCurrentVelocity;
     result.weightSide = weightSide;
     result.weightToi = weightToi;
     result.horizontalTime = horizontalTime;
     result.gridSize = gridSize;
     result.adaptiveDivisions = adaptiveDivisions;
     result.adaptiveRings = adaptiveRings;
     result.adaptiveDepth = adaptiveDepth;
     return result;
 }
コード例 #8
0
        /// <summary>
        /// Gets the shared avoidance configuration for a specified index.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Getting a configuration for an index that has not been set will return a configuration 
        /// in an undefined state.
        /// </para>
        /// </remarks>
        /// <param name="index">
        /// The index. [Limits: 0 &lt;= value &lt; <see cref="MaxAvoidanceParams"/>]
        /// </param>
        /// <returns>An avoidance configuration.</returns>
        public CrowdAvoidanceParams GetAvoidanceConfig(int index)
        {
            if (!IsDisposed && index >= 0 && index < MaxAvoidanceParams)
            {
                CrowdAvoidanceParams result = new CrowdAvoidanceParams();
                CrowdManagerEx.dtcGetObstacleAvoidanceParams(root
                    , index
                    , result);

                return result;             
            }
            return null;
        }
コード例 #9
0
        /// <summary>
        /// Sets the shared avoidance configuration for a specified index.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Multiple avoidance configurations can be set for the manager with agents assigned to 
        /// different avoidance behaviors via the <see cref="CrowdAgentParams"/> object.
        /// </para>
        /// </remarks>
        /// <param name="index">
        /// The index. [Limits: 0 &lt;= value &lt; <see cref="MaxAvoidanceParams"/>].
        /// </param>
        /// <param name="config">The avoidance configuration.</param>
        /// <returns>True if the configuration is successfully set.</returns>
        public bool SetAvoidanceConfig(int index
            , CrowdAvoidanceParams config)
        {
            if (IsDisposed || index < 0 || index >= MaxAvoidanceParams)
                return false;

            CrowdManagerEx.dtcSetObstacleAvoidanceParams(root, index, config);

            return true;
        }