コード例 #1
0
        // ----------------------------------------------------
        #region // Unity Events

        /// <summary>
        /// UnityEvent : Start
        /// </summary>
        void Start()
        {
            this._entityManager = World.Active.GetOrCreateManager <EntityManager>();
            this._mainCamera    = Camera.main;
            FPSCounterInstance  = new FPSCounter();

            this._titleCanvas.enabled  = true;
            this._resultCanvas.enabled = false;

            // Archetypes Settings
            PlayerArchetype = this._entityManager.CreateArchetype(
                ComponentType.Create <Position>(),
                ComponentType.Create <PlayerInput>(),
                ComponentType.Create <PlayerLife>(),
                ComponentType.Create <MeshInstanceRenderer>(),
                ComponentType.Create <PlayerSettings>(),
                ComponentType.Create <PlayerCollision>(),
                ComponentType.Create <PlayerColor>());

            EnemyBulletArchetype = this._entityManager.CreateArchetype(
                ComponentType.Create <Position>(),
                ComponentType.Create <BulletData>(),
                ComponentType.Create <EnemyBullet>(),
                ComponentType.Create <MeshInstanceRenderer>(),
                ComponentType.Create <BulletCollision>());

            PlayerBulletArchetype = this._entityManager.CreateArchetype(
                ComponentType.Create <Position>(),
                ComponentType.Create <BulletData>(),
                ComponentType.Create <PlayerBullet>(),
                ComponentType.Create <MeshInstanceRenderer>(),
                ComponentType.Create <BulletCollision>());

            EnemySpawnSystemArchetype = this._entityManager.CreateArchetype(
                ComponentType.Create <EnemySpawnSystemData>(),
                ComponentType.Create <EnemySpawnSystemSettings>());

            CommonEnemyArchetype = this._entityManager.CreateArchetype(
                ComponentType.Create <Position>(),
                ComponentType.Create <EnemyData>(),
                ComponentType.Create <MeshInstanceRenderer>(),
                ComponentType.Create <EnemyCollision>());
            // ▼ SharedComponentData
            // - [BarrageSettings_DirectionBullet] or [BarrageSettings_CircularBullet]
            //      →こちらについて、登録するSharedComponentDataによって敵が撃ってくる弾幕が変わる。どちらか片方しか登録されない想定。

            // MeshInstanceRenderers Settings
            PlayerLook       = this.CreateMeshInstanceRenderer(this._playerRendererData);
            EnemyLook        = this.CreateMeshInstanceRenderer(this._enemyRendererData);
            PlayerBulletLook = this.CreateMeshInstanceRenderer(this._playerBulletRendererData);
            EnemyBulletLook  = this.CreateMeshInstanceRenderer(this._enemyBulletRendererData);

            // BarrageSettings
            BarrageSettings_DirectionBullet = this._gameSettings.BarrageSettings_DirectionBulletInstance;
            BarrageSettings_CircularBullet  = this._gameSettings.BarrageSettings_CircularBulletInstance;

            // Collisions
            PlayerCollision = this._gameSettings.PlayerCollisionInstance;
            EnemyCollision  = this._gameSettings.EnemyCollisionInstance;
            BulletCollision = this._gameSettings.BulletCollisionInstance;
        }
コード例 #2
0
        // ----------------------------------------------------
        #region // Unity Events

        /// <summary>
        /// UnityEvent : Start
        /// </summary>
        void Start()
        {
            this._entityManager = World.Active.GetOrCreateManager <EntityManager>();
            this._mainCamera    = Camera.main;
            FPSCounterInstance  = new FPSCounter();

            this._titleCanvas.enabled  = true;
            this._resultCanvas.enabled = false;

            // Archetypes Settings
            PlayerArchetype = this._entityManager.CreateArchetype(
                typeof(Position2D),
                typeof(PlayerInput),
                typeof(PlayerLife),
                typeof(TransformMatrix));
            // ▼ SharedComponentData      ※SharedComponentDataはArchetypeに登録出来ないので使用される物をメモ
            // - MeshInstanceRenderer
            // - PlayerSettings
            // - PlayerCollision
            // - PlayerColor

            EnemyBulletArchetype = this._entityManager.CreateArchetype(
                typeof(Position2D),
                typeof(BulletData),
                typeof(EnemyBullet),
                typeof(TransformMatrix));
            // ▼ SharedComponentData
            // - MeshInstanceRenderer
            // - BulletCollision

            PlayerBulletArchetype = this._entityManager.CreateArchetype(
                typeof(Position2D),
                typeof(BulletData),
                typeof(PlayerBullet),
                typeof(TransformMatrix));
            // ▼ SharedComponentData
            // - MeshInstanceRenderer
            // - BulletCollision

            EnemySpawnSystemArchetype = this._entityManager.CreateArchetype(
                typeof(EnemySpawnSystemData));
            // ▼ SharedComponentData
            // - EnemySpawnSystemSettings

            CommonEnemyArchetype = this._entityManager.CreateArchetype(
                typeof(Position2D),
                typeof(EnemyData),
                typeof(TransformMatrix));
            // ▼ SharedComponentData
            // - MeshInstanceRenderer
            // - EnemyCollision
            // - [BarrageSettings_DirectionBullet] or [BarrageSettings_CircularBullet]
            //      →こちらについて、登録するSharedComponentDataによって敵が撃ってくる弾幕が変わる。どちらか片方しか登録されない想定。

            // MeshInstanceRenderers Settings
            PlayerLook       = this.CreateMeshInstanceRenderer(this._playerRendererData);
            EnemyLook        = this.CreateMeshInstanceRenderer(this._enemyRendererData);
            PlayerBulletLook = this.CreateMeshInstanceRenderer(this._playerBulletRendererData);
            EnemyBulletLook  = this.CreateMeshInstanceRenderer(this._enemyBulletRendererData);

            // BarrageSettings
            BarrageSettings_DirectionBullet = this._gameSettings.BarrageSettings_DirectionBulletInstance;
            BarrageSettings_CircularBullet  = this._gameSettings.BarrageSettings_CircularBulletInstance;

            // Collisions
            PlayerCollision = this._gameSettings.PlayerCollisionInstance;
            EnemyCollision  = this._gameSettings.EnemyCollisionInstance;
            BulletCollision = this._gameSettings.BulletCollisionInstance;
        }