コード例 #1
0
        /// <summary>
        /// Gets the spawn position.
        /// </summary>
        /// <returns>The spawn position.</returns>
        /// <param name="_base_offset">Base offset.</param>
        public Vector3 GetSpawnPosition(float _base_offset = 0)
        {
            Vector3 _position = Vector3.zero;

            GameObject _object = GetBestSpawnPointGameObject();

            if (_object != null)
            {
                if (UseRandomRect)
                {
                    _position = PositionTools.GetRandomRectPosition(_object.transform.position, RandomRect, true);
                }
                else if (SpawningRangeMax > 0)
                {
                    _position = PositionTools.GetRandomCirclePosition(_object.transform.position, SpawningRangeMin, SpawningRangeMax);
                }
                else
                {
                    _position = _object.transform.position;
                }

                _position.y  = PositionTools.GetGroundLevel(_position, CreatureRegister.GroundCheck, CreatureRegister.GroundLayerMask, 0.5f, LevelDifference, _base_offset);
                _position.y += _base_offset + LevelOffset;
            }

            return(_position);
        }