/// <summary>
        /// Initializes a new instance of the <see cref="HeightStrategy"/> class.
        /// </summary>
        /// <param name="mode">The mode.</param>
        /// <param name="sampleGranularity">The sample granularity.</param>
        /// <param name="ledgeThreshold">The ledge threshold.</param>
        /// <param name="useGlobalHeightNavigationSettings">if set to <c>true</c> global height navigation settings will be used.</param>
        /// <param name="unitsHeightNavigationCapability">The global unit height navigation capability.</param>
        /// <param name="heightMapDetail">The height map detail.</param>
        public HeightStrategy(HeightSamplingMode mode, float sampleGranularity, float ledgeThreshold, bool useGlobalHeightNavigationSettings, HeightNavigationCapabilities unitsHeightNavigationCapability, HeightMapDetailLevel heightMapDetail)
        {
            switch (mode)
            {
                case HeightSamplingMode.HeightMap:
                {
                    _sampler = new HeightMapSampler();
                    break;
                }

                case HeightSamplingMode.Raycast:
                {
                    _sampler = new RaycastSampler();
                    break;
                }

                default:
                case HeightSamplingMode.NoHeightSampling:
                {
                    _sampler = new NullSampler();
                    break;
                }
            }

            this.heightMode = mode;
            this.sampleGranularity = sampleGranularity;
            this.ledgeThreshold = ledgeThreshold;
            this.useGlobalHeightNavigationSettings = useGlobalHeightNavigationSettings;
            this.unitsHeightNavigationCapability = unitsHeightNavigationCapability;
            this.heightMapDetail = heightMapDetail;
        }
Exemplo n.º 2
0
        public HeightStrategy(HeightSamplingMode mode, float sampleGranularity, float ledgeThreshold, bool useGlobalHeightNavigationSettings, HeightNavigationCapabilities unitsHeightNavigationCapability, HeightMapDetailLevel heightMapDetail)
        {
            switch (mode)
            {
            case HeightSamplingMode.HeightMap:
            {
                _sampler = new HeightMapSampler();
                break;
            }

            case HeightSamplingMode.Raycast:
            {
                _sampler = new RaycastSampler();
                break;
            }

            case HeightSamplingMode.Spherecast:
            {
                _sampler = new SpherecastSampler();
                break;
            }

            default:
            case HeightSamplingMode.NoHeightSampling:
            {
                _sampler = new NullSampler();
                break;
            }
            }

            this.heightMode        = mode;
            this.sampleGranularity = sampleGranularity;
            this.ledgeThreshold    = ledgeThreshold;
            this.useGlobalHeightNavigationSettings = useGlobalHeightNavigationSettings;
            this.unitsHeightNavigationCapability   = unitsHeightNavigationCapability;
            this.heightMapDetail = heightMapDetail;
        }
Exemplo n.º 3
0
        private void Awake()
        {
            this.WarnIfMultipleInstances<IUnitProperties>();

            _transform = this.transform;

            var heightStrat = GameServices.heightStrategy;
            _effectiveHeightCapabilities = heightStrat.useGlobalHeightNavigationSettings ? heightStrat.unitsHeightNavigationCapability : _heightCapabilities;
            GameServices.gameStateManager.RegisterUnit(this.gameObject);
        }
Exemplo n.º 4
0
        public void CloneFrom(UnitComponent unitComp)
        {
            _isSelectable = unitComp.isSelectable;
            this.selectionVisual = unitComp.selectionVisual;

            _heightCapabilities = unitComp._heightCapabilities;
            _effectiveHeightCapabilities = unitComp._effectiveHeightCapabilities;

            this.radius = unitComp.radius;
            this.fieldOfView = unitComp.fieldOfView;
            this.baseToPositionOffset = unitComp.baseToPositionOffset;

            this.height = unitComp.height;
            this.yAxisoffset = unitComp.yAxisoffset;
        }
Exemplo n.º 5
0
        private void Awake()
        {
            this.WarnIfMultipleInstances<IUnitProperties>();

            _transform = this.transform;

            var heightStrat = GameServices.heightStrategy;
            _effectiveHeightCapabilities = heightStrat.useGlobalHeightNavigationSettings ? heightStrat.unitsHeightNavigationCapability : _heightCapabilities;
            StartCoroutine(delayToRegister());
        }