private void Start()
    {
        Entity rootEntity = _entityDatabase.CreateEntity();

        rootEntity.AddTag(Tag.Root);
        rootEntity.AddComponent <EventComponent>().eventDispatcher = _eventDispatcher;

        _directCommand.Execute(new InitGameCommand());
        _directCommand.Execute(new InitAudioCommand {
            camera = cameraObject, masterMixer = masterMixer
        });
        _directCommand.Execute(new InitCameraCommand {
            camera = cameraObject
        });
        _directCommand.Execute(new InitPlayerCommand {
            playerGameObject = player
        });
        _directCommand.Execute(new InitCameraTargetCommand());
        _directCommand.Execute(new InitGunCommand {
            gunGameObject = gun, faceLight = faceLight
        });
        _directCommand.Execute(new InitEnemySpawnerCommand {
            spawners = spawners
        });
        _directCommand.Execute(new InitUICommand());
    }
    public void Execute()
    {
        Entity cameraEntity = entityDatabase.CreateEntity();

        CameraComponent cameraComponent = cameraEntity.AddComponent <CameraComponent>();

        cameraComponent.floorMask = LayerMask.GetMask("Floor");

        cameraEntity.AddComponent <TransformComponent>().transform = camera.transform;
    }
Exemple #3
0
    public void Execute()
    {
        for (int i = 0; i < spawners.Length; ++i)
        {
            EnemySpawnerComponent enemySpawnerComponent = entityDatabase.CreateEntity().AddComponent <EnemySpawnerComponent>();;
            enemySpawnerComponent.spawnerData = spawners[i];
            enemySpawnerComponent.timer       = enemySpawnerComponent.spawnerData.spawnTime;
        }

        Entity rootEntity = entityDatabase.QueryEntity(Tag.Root);

        rootEntity.AddComponent <ColliderComponentMap>();
    }
    public void Execute()
    {
        Entity playerEntity = entityDatabase.CreateEntity();

        PlayerComponent playerComponent = playerEntity.AddComponent <PlayerComponent>();

        playerComponent.anim        = playerGameObject.GetComponent <Animator>();
        playerComponent.rigidBody   = playerGameObject.GetComponent <Rigidbody>();
        playerComponent.audioSource = playerGameObject.GetComponent <AudioSource>();
        playerComponent.healthModel = healthModel;

        healthModel.health.value = gameData.playerData.startingHealth;

        playerEntity.AddComponent <TransformComponent>().transform = playerGameObject.transform;
    }
    public void Execute()
    {
        Entity gunEntity = entityDatabase.CreateEntity();

        GunComponent gunComponent = gunEntity.AddComponent <GunComponent>();

        gunComponent.shootableMask = LayerMask.GetMask("Shootable");

        gunComponent.gunParticles = gunGameObject.GetComponent <ParticleSystem>();
        gunComponent.gunLine      = gunGameObject.GetComponent <LineRenderer>();
        gunComponent.gunAudio     = gunGameObject.GetComponent <AudioSource>();
        gunComponent.gunLight     = gunGameObject.GetComponent <Light>();
        gunComponent.faceLight    = faceLight;

        gunEntity.AddComponent <TransformComponent>().transform = gunGameObject.transform;
    }