// ---------------------------------------------------- #region // Public Methods public void Initialize() { this._blittableFieldsPtr = (BlittableFields *)UnsafeUtilityHelper.Malloc <BlittableFields>(Allocator.Persistent); this.CopyBlittableFields(); if (this.m_center != null) { this._centerMatrixPtr = (float4x4 *)UnsafeUtilityHelper.Malloc <float4x4>(Allocator.Persistent); this.UpdateCenterMatrix(); } if (this.ColliderGroups != null && this.ColliderGroups.Length > 0) { this._colliderGroupInstanceIDs = new NativeArray <int>(this.ColliderGroups.Length, Allocator.Persistent); for (var i = 0; i < this._colliderGroupInstanceIDs.Length; i++) { this._colliderGroupInstanceIDs[i] = this.ColliderGroups[i].GetInstanceID(); } } foreach (var go in RootBones) { if (go == null) { continue; } this.CreateNode(go); } }
// ---------------------------------------------------- #region // Public Methods public void Initialize(EntityManager entityManager) { Assert.IsFalse(this.RootBones == null || this.RootBones.Count <= 0); this._entityManager = entityManager; // コライダーの初期化 if (this.ColliderGroups != null && this.ColliderGroups.Length > 0) { foreach (var collider in this.ColliderGroups) { collider.Initialize(this._entityManager); } this._colliderGroupInstanceIDs = new NativeArray <int>(this.ColliderGroups.Length, Allocator.Persistent); for (var i = 0; i < this._colliderGroupInstanceIDs.Length; i++) { this._colliderGroupInstanceIDs[i] = this.ColliderGroups[i].GetInstanceID(); } } this._centerEntity = Entity.Null; if (this.m_center != null) { var centerEntity = GetOrAddComponent <GameObjectEntity>(this.m_center.gameObject); this._centerEntity = centerEntity.Entity; this._entityManager.AddComponentData( this._centerEntity, new Center() { Value = this.m_center.localToWorldMatrix }); } // 各種パラメータ用のメモリ確保 + 初期化 { this._blittableFieldsPtr = (BlittableFields *)UnsafeUtilityHelper.Malloc <BlittableFields>(Allocator.Persistent); this.CopyBlittableFields(); } this.Nodes = new List <Node>(); foreach (var go in RootBones) { if (go == null) { continue; } this.CreateNode(go); } }