Example #1
0
            internal void Configure(GridConfig cfg)
            {
                this.automaticInitialization = false;
                this.linkOriginToTransform = false;
                this.origin = cfg.origin;
                this.sizeX = cfg.sizeX;
                this.sizeZ = cfg.sizeZ;
                this.cellSize = cfg.cellSize;
                this.generateHeightmap = cfg.generateHeightmap;
                this.heightLookupType = cfg.heightLookupType;
                this.heightLookupMaxDepth = cfg.heightLookupMaxDepth;
                this.lowerBoundary = cfg.lowerBoundary;
                this.upperBoundary = cfg.upperBoundary;
                this.obstacleSensitivityRange = cfg.obstacleSensitivityRange;
                this.subSectionsCellOverlap = cfg.subSectionsCellOverlap;
                this.subSectionsX = cfg.subSectionsX;
                this.subSectionsZ = cfg.subSectionsZ;
                this.friendlyName = cfg.friendlyName;

                Init();

                this.enabled = false;

                _configured = true;
            }
Example #2
0
            internal void ConfigureAndInitialize(GridConfig cfg, int maxMillisecondsUsedPerFrame, Action<GridComponent> callback)
            {
                Configure(cfg);

                Initialize(
                    maxMillisecondsUsedPerFrame,
                    callback);
            }
Example #3
0
        /// <summary>
        /// Creates a runtime Grid instance and initializes it.
        /// </summary>
        /// <param name="host">The host.</param>
        /// <param name="cfg">The configuration.</param>
        /// <param name="maxMillisecondsUsedPerFrame">The maximum milliseconds used per frame while initializing.</param>
        /// <param name="callback">Callback that will be called once initialization is complete. The callback will receive a reference to the created component for convenience.</param>
        /// <returns>The grid instance. Note initialization is not complete at the time of return.</returns>
        public static GridComponent CreateAndInitialize(GameObject host, GridConfig cfg, int maxMillisecondsUsedPerFrame, Action<GridComponent> callback)
        {
            Ensure.ArgumentNotNull(host, "host");
            Ensure.ArgumentNotNull(cfg, "cfg");

            var g = host.AddComponent<RuntimeGridComponent>();
            g.ConfigureAndInitialize(cfg, maxMillisecondsUsedPerFrame, callback);

            return g;
        }
Example #4
0
        /// <summary>
        /// Creates a runtime Grid instance. The grid is disabled and will need to be initialized.
        /// </summary>
        /// <param name="host">The host.</param>
        /// <param name="cfg">The configuration.</param>
        /// <returns>The grid instance.</returns>
        public static GridComponent Create(GameObject host, GridConfig cfg)
        {
            Ensure.ArgumentNotNull(host, "host");
            Ensure.ArgumentNotNull(cfg, "cfg");

            var g = host.AddComponent<RuntimeGridComponent>();
            g.Configure(cfg);

            return g;
        }
Example #5
0
            internal void ConfigureAndInitialize(GridConfig cfg, int maxMillisecondsUsedPerFrame, Action<GridComponent> callback)
            {
                Configure(cfg);

                Initialize(
                    maxMillisecondsUsedPerFrame,
                    callback);
            }
Example #6
0
            internal void Configure(GridConfig cfg)
            {
                this.automaticInitialization = false;
                this.linkOriginToTransform = false;
                this.origin = cfg.origin;
                this.sizeX = cfg.sizeX;
                this.sizeZ = cfg.sizeZ;
                this.cellSize = cfg.cellSize;
                this.generateHeightmap = cfg.generateHeightmap;
                this.heightLookupType = cfg.heightLookupType;
                this.heightLookupMaxDepth = cfg.heightLookupMaxDepth;
                this.lowerBoundary = cfg.lowerBoundary;
                this.upperBoundary = cfg.upperBoundary;
                this.obstacleSensitivityRange = cfg.obstacleSensitivityRange;
                this.subSectionsCellOverlap = cfg.subSectionsCellOverlap;
                this.subSectionsX = cfg.subSectionsX;
                this.subSectionsZ = cfg.subSectionsZ;
                this.friendlyName = cfg.friendlyName;

                Init();

                this.enabled = false;

                _configured = true;
            }
Example #7
0
        /// <summary>
        /// Creates a runtime Grid instance and initializes it.
        /// </summary>
        /// <param name="host">The host.</param>
        /// <param name="cfg">The configuration.</param>
        /// <param name="maxMillisecondsUsedPerFrame">The maximum milliseconds used per frame while initializing.</param>
        /// <param name="callback">Callback that will be called once initialization is complete. The callback will receive a reference to the created component for convenience.</param>
        /// <returns>The grid instance. Note initialization is not complete at the time of return.</returns>
        public static GridComponent CreateAndInitialize(GameObject host, GridConfig cfg, int maxMillisecondsUsedPerFrame, Action<GridComponent> callback)
        {
            Ensure.ArgumentNotNull(host, "host");
            Ensure.ArgumentNotNull(cfg, "cfg");

            var g = host.AddComponent<RuntimeGridComponent>();
            g.ConfigureAndInitialize(cfg, maxMillisecondsUsedPerFrame, callback);

            return g;
        }
Example #8
0
        /// <summary>
        /// Creates a runtime Grid instance. The grid is disabled and will need to be initialized.
        /// </summary>
        /// <param name="host">The host.</param>
        /// <param name="cfg">The configuration.</param>
        /// <returns>The grid instance.</returns>
        public static GridComponent Create(GameObject host, GridConfig cfg)
        {
            Ensure.ArgumentNotNull(host, "host");
            Ensure.ArgumentNotNull(cfg, "cfg");

            var g = host.AddComponent<RuntimeGridComponent>();
            g.Configure(cfg);

            return g;
        }