Ejemplo n.º 1
0
 static extern int VeryClassicInit(IntPtr screen, SoundPlay3DHandler play);
Ejemplo n.º 2
0
 static extern int VeryClassicFrame(int lastKey, int c, SoundPlay3DHandler play);
Ejemplo n.º 3
0
        public static void Init(GameObject gameObject)
        {
            IsDone                    = false;
            m_main_texture            = new Texture2D(320, 200, TextureFormat.RGBA32, false);
            m_main_texture.filterMode = FilterMode.Point;
            m_screen_data             = new byte[320 * 200 * 4];
            m_screen_handle           = GCHandle.Alloc(m_screen_data, GCHandleType.Pinned);

            var bCam = GameObject.Find("ui_camera");

            Debug.Log("bCam: " + bCam);
            if (bCam == null)
            {
                Debug.Log("briefing cam not found???");
            }
            else
            {
                var bloom = bCam.gameObject.GetComponent <SENaturalBloomAndDirtyLens>();
                if (bloom != null)
                {
                    bloom.enabled = false;
                }
                var post = bCam.gameObject.GetComponent <PostProcessingBehaviour>();
                if (post != null)
                {
                    post.enabled = false;
                }
            }

            Camera mainCam = Camera.main;

            orgCamGO = mainCam.gameObject;
            orgCamGO.SetActive(false);
            camGO = new GameObject("ClassicCam");
            //camGO.transform.position = mainCam.transform.position;
            camGO.transform.parent = orgCamGO.transform.parent;
            // add distance for backside of cockpit
            camGO.transform.localPosition = mainCam.transform.localPosition;
            camGO.transform.localRotation = mainCam.transform.localRotation;
            //camGO.transform.localScale = mainCam.transform.localScale;
            var cam = camGO.AddComponent <Camera>();

            //cam.nearClipPlane = 0.01f;
            //cam.fieldOfView = mainCam.fieldOfView;
            //cam.depth = mainCam.depth;
            cam.orthographic     = true;
            cam.orthographicSize = 0.44f;
            cam.allowHDR         = false;
            cam.allowMSAA        = false;

            for (var i = 0; i < asrcs.Length; i++)
            {
                asrcs[i] = gameObject.AddComponent <AudioSource>();
            }
            gameObject.AddComponent <VeryClassicController>();

            play = new SoundPlay3DHandler(SoundPlay3D);

            IntPtr x = LoadLibrary("VeryClassic.dll");

            Debug.Log("VeryClassicLib: " + x);
            VeryClassicSettings(GameplayManager.DifficultyLevel, MenuManager.opt_auto_leveling >= 2 ? 1 : 0,
                                MenuManager.opt_volume_sfx, MenuManager.opt_volume_music, GameplayManager.Level.LevelNum + 1);
            int ret = VeryClassicInit(m_screen_handle.AddrOfPinnedObject(), play);

            Debug.Log("VeryClassicInit: " + ret);
#if false
            m_main_texture            = new Texture2D(320, 200, TextureFormat.RGBA32, false);
            m_main_texture.filterMode = FilterMode.Point;
            //Debug.Log("name1: " + gameObject.GetComponent<MeshRenderer>().sharedMaterial.GetTexture("_MainTex").name);
            gameObject.GetComponent <MeshRenderer>().sharedMaterial.SetTexture("_MainTex", m_main_texture);
            Debug.Log("name2: " + gameObject.GetComponent <MeshRenderer>().sharedMaterial.GetTexture("_MainTex").name);
#endif
            GameManager.MaybeLockCursor();
        }