Inheritance: UnityEngine.MonoBehaviour
Ejemplo n.º 1
0
		public override void applicationRunOnceOnBuilding ()
		{
			
			#if !UNITY_EDITOR
			if(Application.isMobilePlatform) 
			{ 
				Cursor.visible = false; // Once Android cursor bug is fixed, you can delete the next 3 lines. 
				Texture2D cursorTexture = new Texture2D(1, 1); 
				cursorTexture.SetPixel(0, 0, Color.clear); 
				Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.Auto); 
			}
			#endif
			//CCGLView
			{
				GameObject obj = new GameObject ();
				obj.transform.parent = _window.transform;
				_view = obj.AddComponent<CCGLView> ();
			}
			//CCComponentsPool
			{
				GameObject obj = new GameObject();
				obj.transform.parent = this.transform;
				_factory = obj.AddComponent<CCFactory>();
			}

			//audio
			{
				GameObject obj = new GameObject ();
				obj.transform.parent = this.transform;
				_audioEngine = obj.AddComponent<SimpleAudioEngine> ();
			}
		}
        public override void applicationRunOnceOnBuilding()
        {
                        #if !UNITY_EDITOR
            if (Application.isMobilePlatform)
            {
                Cursor.visible = false;                 // Once Android cursor bug is fixed, you can delete the next 3 lines.
                Texture2D cursorTexture = new Texture2D(1, 1);
                cursorTexture.SetPixel(0, 0, Color.clear);
                Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.Auto);
            }
                        #endif
            //CCGLView
            {
                GameObject obj = new GameObject();
                obj.transform.parent = _window.transform;
                _view = obj.AddComponent <CCGLView> ();
            }
            //CCComponentsPool
            {
                GameObject obj = new GameObject();
                obj.transform.parent = this.transform;
                _factory             = obj.AddComponent <CCFactory>();
            }

            //audio
            {
                GameObject obj = new GameObject();
                obj.transform.parent = this.transform;
                _audioEngine         = obj.AddComponent <SimpleAudioEngine> ();
            }
        }
Ejemplo n.º 3
0
        public virtual void Awake()
        {
            if (_Instance != null && _Instance != this)
            {
                Destroy(this.gameObject);
                return;
            }
            else
            {
                _Instance = this;
            }
            if (Application.isPlaying)
            {
                _backgroundMusicVolume = 1;
                _effectsVolume         = 1;
                _currentSource         = 0;
            }
            if (firstPassFlag)
            {
                gameObject.transform.position = Vector3.zero;
                gameObject.name = "AudioEngine";
                firstPassFlag   = false;

                _backgroundMusicSource = gameObject.AddComponent <AudioSource>();
                _audioSources          = new AudioSource[AUDIO_SOURCES_NUM];
                for (int i = 0; i < AUDIO_SOURCES_NUM; i++)
                {
                    _audioSources[i] = gameObject.AddComponent <AudioSource>();
                }
            }
        }
		public virtual void Awake() {
			if (_Instance != null && _Instance != this) {
				Destroy (this.gameObject);
				return;
			} else {
				_Instance = this;
			}
			if (Application.isPlaying) {
				_backgroundMusicVolume = 1;
				_effectsVolume = 1;
				_currentSource = 0;
			} 
			if (firstPassFlag) {
				gameObject.transform.position = Vector3.zero;
				gameObject.name = "AudioEngine";
				firstPassFlag = false;
				
				_backgroundMusicSource = gameObject.AddComponent<AudioSource>();
				_audioSources = new AudioSource[AUDIO_SOURCES_NUM];
				for(int i=0; i<AUDIO_SOURCES_NUM; i++)
					_audioSources[i] = gameObject.AddComponent<AudioSource>();
			}
		}