예제 #1
0
    private void Start()
    {
        LocalDataManager.Init();
        ResourcesManager.Init();
        PlayerManager.Init();
        JoystickUtil.Init();

        SingletonManager.AddSingleton <ShaderManager>();
        SingletonManager.AddSingleton <CameraManager>();
        SingletonManager.AddSingleton <TimeManager>();
        SingletonManager.AddSingleton <ParticleManager>();
        SingletonManager.AddSingleton <ParticleDecalManager>();
        SingletonManager.AddSingleton <ProjectileManager>();
        SingletonManager.AddSingleton <AudioManager>();
        SingletonManager.AddSingleton <InputManager>();
        SingletonManager.AddSingleton <UIManager>();

        GameObject localPlayer       = CharacterFactory.GenerateLocalPlayer();
        GameObject interactionSystem = new GameObject("Interaction System");

        interactionSystem.transform.localScale = new Vector3(4f, 2f, 4f);
        interactionSystem.layer = LayerManager.InteractionLayer;
        localPlayer.AddComponent <InputOperator>().InteractionSystem = interactionSystem.AddComponent <InteractionSystem>();
        GameObject sprite0 = IBSpriteFactory.GenerateIBSprite("up_punch");
        GameObject sprite1 = IBSpriteFactory.GenerateIBSprite("complex_shooter");
        GameObject sprite2 = IBSpriteFactory.GenerateIBSprite("shooter");
        GameObject sprite3 = IBSpriteFactory.GenerateIBSprite("rocket_launcher");
        GameObject sprite4 = IBSpriteFactory.GenerateIBSprite("complex_newton_thrower");
        GameObject sprite5 = IBSpriteFactory.GenerateIBSprite("hammer");

        localPlayer.GetComponent <CharacterController>().EquipIBSprite(sprite0.GetComponent <IBSpriteController>());
        localPlayer.GetComponent <CharacterController>().EquipIBSprite(sprite1.GetComponent <IBSpriteController>());
        localPlayer.GetComponent <CharacterController>().EquipIBSprite(sprite2.GetComponent <IBSpriteController>());
        localPlayer.GetComponent <CharacterController>().EquipIBSprite(sprite3.GetComponent <IBSpriteController>());
        localPlayer.GetComponent <CharacterController>().EquipIBSprite(sprite4.GetComponent <IBSpriteController>());
        localPlayer.GetComponent <CharacterController>().EquipIBSprite(sprite5.GetComponent <IBSpriteController>());

        level.localPlayer = localPlayer.GetComponent <CharacterController>();

        // localPlayer.transform.position = playerSpawnPosition == null ? new Vector3(3, 1, 0) : playerSpawnPosition.position;
        // CameraManager.MainCamera.GetComponent<SceneScanEffectController>().center = localPlayer.transform;
        // localPlayer.transform.position = new Vector3(4, 8, 0);

        mainTargetGroup.m_Targets = new[] { new CinemachineTargetGroup.Target {
                                                target = localPlayer.transform, weight = 1f, radius = 5f
                                            } };
        combatVirtualCamera.Follow = localPlayer.transform;
        combatVirtualCamera.LookAt = localPlayer.transform;

        GameObject enemy0 = CharacterFactory.GenerateEnemy("Enemy 0");

        enemy0.transform.position = new Vector3(3, 8, 0);
        GameObject sprite6 = IBSpriteFactory.GenerateIBSprite("hammer");

        enemy0.GetComponent <CharacterController>().EquipIBSprite(sprite6.GetComponent <IBSpriteController>(), false);
        enemy0.AddComponent <NaiveAIOperator>();

        /*
         * GameObject enemy1 = CharacterFactory.GenerateLocalPlayer();
         * TagManager.SetAllTags(enemy1, TagManager.ENEMY_TAG);
         * enemy1.name = "Enemy 1";
         * enemy1.transform.position = new Vector3(12, 8, 0);
         */

        if (bgm)
        {
            AudioSource source = GetComponent <AudioSource>();
            source.clip = bgm;
            source.Play();
            source.loop       = true;
            source.spatialize = false;
        }

        combatComposer = combatVirtualCamera.GetCinemachineComponent <CinemachineComposer>();
        Debug.Log(JoystickUtil.JoystickNum + " Joysticks Detected : " + string.Join(", ", JoystickUtil.JoystickNames));
        Debug.Log(JoystickUtil.HapticDeviceNum + " Haptic Device Detected : " + string.Join(", ", JoystickUtil.HapticDeviceNames));
        JoystickUtil.LogPowerState();
        JoystickUtil.LogSensorState();

        level.Activate();
    }